diff --git a/README.md b/README.md index e9192eb..b06e457 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,16 @@ -πfs: Never worry about data again! +pifs: Never worry about data again! ================================== +## FORK + +The idea of this fork is to replace the actual read/write operations by a call +to the `ipfs cat` and `ipfs add` commands. + +I do not know what is optimal but my initial goal is to read/write 256k blocks +of data and read/write their ipfs hashes in the metadata file. + +EOF + πfs is a revolutionary new file system that, instead of wasting space storing your data on your hard drive, stores your data in π! You'll never run out of space again - π holds every file that could possibly exist! They said 100% diff --git a/src/πfs.c b/src/πfs.c index 0c36931..8aba540 100644 --- a/src/πfs.c +++ b/src/πfs.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -167,12 +168,12 @@ static int pifs_read(const char *path, char *buf, size_t count, off_t offset, return -1; } do { - ret = fread(&buf[offset + size], sizeof(char), sizeof(buffer)-1, fp); + ret = fread(buffer, sizeof(char), sizeof(buffer)-1, fp); if (ret == -1 && errno != EAGAIN) { return -errno; } + sprintf(&buf[offset+size], "%s", buffer); size += ret; - // buf = realloc( buf, size * sizeof(char) + 1 ); count -= ret; } while( ret == sizeof(buffer)-1 && count > 0 ); buf[offset + size] = '\0'; @@ -203,6 +204,7 @@ static int pifs_write(const char *path, const char *buf, size_t count, dup2(info->fh, STDOUT_FILENO); close(fd[0]); close(fd[1]); + // ret = execlp("ipfs", "ipfs", "add", "-q", "-s", "rabin-262144-524288-1048576", NULL); ret = execlp("ipfs", "ipfs", "add", "-q", NULL); if (ret == -1) { return -errno;