简体   繁体   English

没有内核的Linux文件系统

[英]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. 现在,我想通过普通的c / c ++程序执行相同的操作。 Just overriding file and inode operations for a single folder would be even better. 仅覆盖单个文件夹的文件和inode操作会更好。 I know there are libraries like FUSE but i think all they do is add a kernel which somehow communicates with the normal program. 我知道有像FUSE这样的库,但是我认为它们所做的只是添加一个内核,以某种方式与常规程序进行通信。 Is there any way to do this? 有什么办法吗?

Yes, the code for the ext2/3/4 file system is also available as a library. 是的,ext2 / 3/4文件系统的代码也可以作为库提供。

Not that it's really necessary. 并不是真的有必要。 If you're just toying around, ext2 is simple enough to implement yourself. 如果您只是在玩弄,ext2很简单,足以实现您自己。 On Linux you can just unmount a filesystem and then access the partition as if it was one big file. 在Linux上,您可以卸装文件系统,然后像访问一个大文件一样访问该分区。 (Got to be root for this, of course). (当然要为此扎根)。 I'd recommend getting a USB stick for this, though. 不过,我建议为此使用USB记忆棒。

The idea of "overriding file and inode operations for one folder" suggests that you want to share access with the OS, though. 但是,“为一个文件夹覆盖文件和inode操作”的想法表明,您希望与OS共享访问权限。 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. 您可以通过将一个文件夹替换为指向您自己的文件系统的符号链接来稍微接近一点,但这必须是FUSE文件系统。 (Assuming you want to stick to user mode - FUSE is how the kernel talks to user mode file systems) (假设您要坚持用户模式-FUSE是内核与用户模式文件系统对话的方式)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从Linux内核读取文件系统事件而不使用Inotify - Reading File System Events from Linux Kernel without Inotify 没有外部内核文件的openCL - openCL without external kernel file linux / kernel.h:没有这样的文件或目录 - linux/kernel.h : No such file or directory 如何定义几个源文件访问的linux内核变量? - how to define linux kernel variable accessed by several source file? 是否可以在 C++ 中使用系统 C 数据类型而不使用整个系统 C kernel? - Is it possible to use System C data types in C++ without the entire System C kernel? 在没有fork / exec,popen()和system()的情况下获取Linux信息 - Getting linux information without fork/exec, popen(), and system() 如何在不调用“system()”的情况下使用 C++ 或 Qt 关闭 Linux? - How to shutdown Linux using C++ or Qt without call to “system()”? Linux:来自内存密集型进程的system()无需派生 - Linux: system() from a memory-intensive process without forking 没有root特权如何更改Linux系统时间? - How can I change Linux system time without root privileges? 有没有办法将整个文件从文件系统迷你过滤器驱动程序(内核模式)传递到用户模式应用程序? - Is there a way to pass an entire file from file system mini filter driver (kernel mode) up to a user mode application?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM