diff --git a/README.md b/README.md index e43d808..9b2c1e2 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Usage * To mount, from the same directory: - ./catfs {list file} {mount point} + ./catfs -s {list file} {mount point} You will see `{mount point}/archive.cat` file. It should be identical to the one produced by this command: @@ -49,7 +49,7 @@ or: cd backup/ find . -type f -printf "%s %P\n" >cat.fs - mkdir mount && ~/catfs cat.fs mount + mkdir mount && ~/catfs -s cat.fs mount par2create -r1 -n1 par2 mount/archive.cat fusermount -u mount && rmdir mount @@ -74,7 +74,7 @@ In case of damage to any file (say, `important/data.txt`), you can recover it this way: cd backup/ - mkdir mount && ~/catfs cat.fs mount + mkdir mount && ~/catfs -s cat.fs mount cp mount/archive.cat archive.cat fusermount -u mount && rmdir mount par2recover par2 archive.cat diff --git a/catfs.c b/catfs.c index baee899..7d41b3d 100644 --- a/catfs.c +++ b/catfs.c @@ -10,6 +10,8 @@ #include #include +#include + struct entry { char *name; @@ -20,10 +22,12 @@ struct entry { struct entry *entries; int entries_len; // fd cache -int fd; +int fd=-1; int fd_i=-1; // fs block size-1 //off_t block_size_1=511; +//pwd where the catfs was started from +char *pwd; // properties of the file in fake FS char *filename; off_t filelen; @@ -98,15 +102,18 @@ static int do_read( const char *path, char *buffer, size_t size, off_t offset, s while(bytes_left>0 && i