azat-linux / chunkfs

chunkfs ported to linux kernel 3.x (initial version http://valerieaurora.org/chunkfs/) [FOR TESTING PURPOSES ONLY, DO NOT USE IN PRODUCTION]
6 stars 0 forks source link

Does it work? #1

Open junghan0611 opened 6 years ago

junghan0611 commented 6 years ago

It does not work in kernel 4.x. How can I port to that?

root@ubuntu:~/chunkfs# make make -C /lib/modules/4.4.0-116-generic/build M=/root/chunkfs modules make[1]: Entering directory '/usr/src/linux-headers-4.4.0-116-generic' CC [M] /root/chunkfs/super.o In file included from /root/chunkfs/super.c:31:0: /root/chunkfs/chunkfs_i.h: In function ‘get_client_mnt’: /root/chunkfs/chunkfs_i.h:115:25: error: dereferencing pointer to incomplete type ‘struct nameidata’ return dp->dp_client_nd->path.mnt; ^ /root/chunkfs/super.c: In function ‘chunkfs_read_client_sb’: /root/chunkfs/super.c:81:19: error: storage size of ‘nd’ isn’t known struct nameidata nd; ^ /root/chunkfs/super.c:81:19: warning: unused variable ‘nd’ [-Wunused-variable] /root/chunkfs/super.c: In function ‘chunkfs_read_root’: /root/chunkfs/super.c:411:19: error: storage size of ‘nd’ isn’t known struct nameidata nd; ^ /root/chunkfs/super.c:411:19: warning: unused variable ‘nd’ [-Wunused-variable] scripts/Makefile.build:258: recipe for target '/root/chunkfs/super.o' failed make[2]: [/root/chunkfs/super.o] Error 1 Makefile:1423: recipe for target 'module/root/chunkfs' failed make[1]: [module/root/chunkfs] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-4.4.0-116-generic' Makefile:9: recipe for target 'ko' failed make: *** [ko] Error 2

azat commented 6 years ago

Since torvalds/linux@1f55a6ec940fb45e3edaa52b6e9fc40cf8e18dcb nameidata is completely opaque, instead getters/setters should be used. I think it is pretty easy to fix, if you will have problems - get back here.

azat commented 6 years ago

P.S. I ported it just for fun/learning, it worked for me (and even passes some tests) but nothing more, IOW it is definitely for playing only (not for production)

junghan0611 commented 6 years ago

Thanks for quick reply.

1) port to new kernel I want to port chunkfs to newer kernel for research. Where can I find some codes that use getters/setters using nameidata? I have little experience about kernel programming.

2) How to use I installed ubuntu 14.04 (kernel 3.x) on new virtual machine to only use chunkfs. It compile works but I didn't know where I start. There are some scripts in repository. (smart_uml.sh, test.sh ... ) Is there anything I need to set up on ubuntu before I run the scripts?

azat commented 6 years ago

Actually replacing/removing of the nameidata should be pretty straightforward, just like in regular sources (IOW I don't think that you need some special skills for this).

But if you insist, there are some books that you can start with, though almost all of them based on linux 2.6 (maybe some 3.x) but I don't think that there is a book that contains changes in vfs API for 3.19 (and maybe this is not the only bit you will need to fix).

Also there is Documentation/filesystems/vfs.txt in linux repo, but it doesn't contains all changes, not a word about nameidata

You will find getters/setters in the referenced commit:

As for testing, AFAIR just test.sh as an entry point is enough, if you are curious you can play with xfstests. And I would recommend you to run tests inside vm (kvm/virtualbox/...), to avoid breaking your host system every time.