github / libprojfs

Linux projected filesystem library
GNU Lesser General Public License v2.1
92 stars 14 forks source link

File projection #40

Closed kivikakk closed 5 years ago

kivikakk commented 5 years ago

Fixes #6. Or it will, because it's still WIP.

chrisd8088 commented 5 years ago

Hey @kivikakk -- I thought I should mention that I stuck the fd member into the projfs_event structure on the guess that we might be able to use it pass an open file descriptor up to the callback, which could then write to that descriptor to fill in its contents.

struct projfs_event {
        ...
    int fd;             /* file descriptor for projection */
};

This may not be viable in practice, of course -- it was a "Hail Mary pass" into the future! :-)

kivikakk commented 5 years ago

on the guess that we might be able to use it pass an open file descriptor up to the callback, which could then write to that descriptor to fill in its contents

Yes, thank you! I'm running with that direction, or running toward that direction anyway.

kivikakk commented 5 years ago

@chrisd8088 There's more work to be done, but basic file projection does work now. See following (MirrorProvider debug output interleaved with commands):

Mounting /home/kivikakk/TestRoot
Virtualization instance started successfully
Press Enter to end the instance
$
$ find TestRoot
TestRoot
TestRoot/.mirror
TestRoot/.mirror/lower
TestRoot/.mirror/config
OnEnumerateDirectory(0, '.', 45804, find)
TestRoot/src
TestRoot/src/hello
OnEnumerateDirectory(0, 'hello', 45804, find)
TestRoot/src/hello/extra
OnEnumerateDirectory(0, 'hello/extra', 45804, find)
TestRoot/src/xyz
$ cat TestRoot/src/xyz
OnGetFileStream(0, 'xyz', 128/91:0, 128/7:0, 45864, cat, 0x7FF41D13E9C0)
it is a good day

for mirroring

i guess
$ cat TestRoot/.mirror/lower/xyz
it is a good day

for mirroring

i guess
$

I need to do a lot more testing, and hopefully your projection tests might be able to find some bugs -- some strange things have come up while working on this -- but an initial review pass would be much appreciated to make sure I haven't missed anything obvious.

kivikakk commented 5 years ago

Summary so far of ops that need to actually project (hydrate) files:

chrisd8088 commented 5 years ago

This is great, thank you @kivikakk! I will test it out over the weekend and take a look through all the enhancements!

kivikakk commented 5 years ago