简体   繁体   中英

Linux file system without kernel

I know how to register and mount a file system using a kernel module. Now I want to do the same from a normal c/c++ program. Just overriding file and inode operations for a single folder would be even better. I know there are libraries like FUSE but i think all they do is add a kernel which somehow communicates with the normal program. Is there any way to do this?

Yes, the code for the ext2/3/4 file system is also available as a library.

Not that it's really necessary. If you're just toying around, ext2 is simple enough to implement yourself. On Linux you can just unmount a filesystem and then access the partition as if it was one big file. (Got to be root for this, of course). I'd recommend getting a USB stick for this, though.

The idea of "overriding file and inode operations for one folder" suggests that you want to share access with the OS, though. That does not work. There is one party in control, and that's either your program or the OS, not both.

You can get somewhat close by replacing that one folder with a symlink to your own filesystem, though, but that would have to be a FUSE filesystem. (Assuming you want to stick to user mode - FUSE is how the kernel talks to user mode file systems)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM