Compare commits
5 Commits
d40be1e1d0
...
50d62741fc
Author | SHA1 | Date |
---|---|---|
aynic.os | 50d62741fc | |
Alexander Mihalicyn | 3d9cc9db6a | |
Philip Langdale | 060edaf22d | |
Philip Langdale | 285e3c9103 | |
Ævar Arnfjörð Bjarmason | 77007cf1ee |
13
README.md
13
README.md
|
@ -8,7 +8,16 @@ compression was impossible? You're looking at it!
|
|||
|
||||
πfs is dead simple to build:
|
||||
|
||||
Firstly, you must install autoconf, automake, libfuse packages in your system.
|
||||
For example, if you have Debian try:
|
||||
```sh
|
||||
sudo apt-get install autotools-dev
|
||||
sudo apt-get install automake
|
||||
sudo apt-get install libfuse-dev
|
||||
```
|
||||
|
||||
```sh
|
||||
./autogen.sh
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
@ -42,7 +51,7 @@ From here, it is a small leap to see that if π contains all possible files,
|
|||
why are we wasting exabytes of space storing those files, when we could just
|
||||
look them up in π!
|
||||
|
||||
Every file that could possible exist?
|
||||
Every file that could possibly exist?
|
||||
-------------------------------------
|
||||
|
||||
That's right! Every file you've ever created, or anyone else has created or
|
||||
|
@ -69,7 +78,7 @@ So I've looked up my bytes in π, but how do I remember where they are?
|
|||
Well, you've obviously got to write them down somewhere; you could use a piece of
|
||||
paper, but remember all that storage space we saved by moving our data into π? Why
|
||||
don't we store our file locations there!?! Even better, the location of our files in
|
||||
π is metadata and as [we all know](http://araman-consulting.co.uk/2012/metadata-the-importance-of-being-found/)
|
||||
π is metadata and as [we all know](http://datatechnologytoday.wordpress.com/2010/09/07/on-the-importance-of-metadata/)
|
||||
metadata is becoming more and more important in everything we do. Doesn't it feel
|
||||
great to have generated so much metadata? Why waste time with old fashioned data
|
||||
when you can just deal with metadata, and lots of it!
|
||||
|
|
39
src/πfs.c
39
src/πfs.c
|
@ -179,23 +179,38 @@ static int pifs_read(const char *path, char *buf, size_t count, off_t offset,
|
|||
static int pifs_write(const char *path, const char *buf, size_t count,
|
||||
off_t offset, struct fuse_file_info *info)
|
||||
{
|
||||
int fd[2];
|
||||
int ret = lseek(info->fh, offset * 2, SEEK_SET);
|
||||
if (ret == -1) {
|
||||
return -errno;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
short index;
|
||||
for (index = 0; index < SHRT_MAX; index++) {
|
||||
if (get_byte(index) == *buf) {
|
||||
break;
|
||||
if(pipe(fd)){
|
||||
perror("pipe(2) failed");
|
||||
return -1;
|
||||
}
|
||||
switch(fork()){
|
||||
case -1:
|
||||
perror("fork(2) failed");
|
||||
return -1;
|
||||
case 0:
|
||||
// child
|
||||
dup2(fd[0], STDIN_FILENO);
|
||||
dup2(info->fh, STDOUT_FILENO);
|
||||
close(fd[0]);
|
||||
close(fd[1]);
|
||||
ret = execlp("ipfs", "ipfs", "add", "-q", NULL);
|
||||
if (ret == -1) {
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
ret = write(info->fh, &index, sizeof index);
|
||||
if (ret == -1) {
|
||||
return -errno;
|
||||
}
|
||||
buf++;
|
||||
break;
|
||||
default:
|
||||
// parent
|
||||
close(fd[0]);
|
||||
ret = write(fd[1], buf, sizeof(buf));
|
||||
if (ret == -1) {
|
||||
return -errno;
|
||||
}
|
||||
close(fd[1]);
|
||||
}
|
||||
|
||||
return count;
|
||||
|
|
Loading…
Reference in New Issue