Rename to pifs. That is what it is, after all.

This commit is contained in:
aynic.os 2023-01-07 12:24:32 +00:00
parent 8f87ae29ae
commit b57a0c70d0
2 changed files with 15 additions and 3 deletions

View File

@ -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 π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 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% space again - π holds every file that could possibly exist! They said 100%

View File

@ -22,6 +22,7 @@
#include <limits.h> #include <limits.h>
#include <stddef.h> #include <stddef.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/statvfs.h> #include <sys/statvfs.h>
#include <sys/xattr.h> #include <sys/xattr.h>
@ -167,12 +168,12 @@ static int pifs_read(const char *path, char *buf, size_t count, off_t offset,
return -1; return -1;
} }
do { 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) { if (ret == -1 && errno != EAGAIN) {
return -errno; return -errno;
} }
sprintf(&buf[offset+size], "%s", buffer);
size += ret; size += ret;
// buf = realloc( buf, size * sizeof(char) + 1 );
count -= ret; count -= ret;
} while( ret == sizeof(buffer)-1 && count > 0 ); } while( ret == sizeof(buffer)-1 && count > 0 );
buf[offset + size] = '\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); dup2(info->fh, STDOUT_FILENO);
close(fd[0]); close(fd[0]);
close(fd[1]); close(fd[1]);
// ret = execlp("ipfs", "ipfs", "add", "-q", "-s", "rabin-262144-524288-1048576", NULL);
ret = execlp("ipfs", "ipfs", "add", "-q", NULL); ret = execlp("ipfs", "ipfs", "add", "-q", NULL);
if (ret == -1) { if (ret == -1) {
return -errno; return -errno;