简体   繁体   English

使用FUSE时如何将所有现有目录挂载到挂载点?

[英]how does all the existing directories get mounted at the mount point when using FUSE?

I'm trying to build a new filesystem with deduplication using FUSE. 我正在尝试使用FUSE构建具有重复数据删除功能的新文件系统。

I tried running the fusexmp_fh.c provided in the example section of the FUSE. 我尝试运行FUSE示例部分中提供的fusexmp_fh.c However after mounting the filesystem at a mount point, I can see all the existing directories inside the mount point. 但是,在挂载点挂载文件系统后,我可以看到挂载点内的所有现有目录。 I dont need those directories. 我不需要那些目录。 I want the mounted filesystem to be empty. 我希望挂载的文件系统为空。

I tried searching through fusexmp_fh.c but could not find out where the existing directories get added. 我尝试通过fusexmp_fh.c搜索,但找不到现有目录的添加位置。

  • Can someone explain to me how this works? 有人可以向我解释这是如何工作的吗?

Also

  • can fusexmp_fh.c be taken as a base for building the filesystem? 可以将fusexmp_fh.c用作构建文件系统的基础?
  • Does it have all the basic functionalities? 它具有所有基本功能吗?

Are you saying that you mounted the file system over a non-empty directory, and you can see the previous contents of the directory? 您是说您在非空目录上挂载了文件系统,并且可以看到该目录的先前内容吗? (In which case, the answer is "don't mount to a non-empty mount point". Usually it throws an error to tell you not to do that.) (在这种情况下,答案是“不要安装到非空安装点”。通常会引发错误,告诉您不要这样做。)

If what you're seeing is the directories and files in the directory that you are using as your base directory, that's the normal behavior for a loopback file system, which is what fusexmp_fh.c is. 如果您看到的是用作基本目录的目录中的目录和文件,则这是回送文件系统的正常行为,即fusexmp_fh.c The example file system takes a mount point, and passes all commands on that mount point through to a backing directory. 示例文件系统使用一个安装点,并将该安装点上的所有命令传递到后备目录。 If you use a backing directory that has files in it, you will now see those files in two places, the original location and the mounted fuse directory. 如果使用的目录中包含文件,则现在可以在两个位置看到这些文件,即原始位置和已安装的保险丝目录。

If you want to understand how the directory filling works, start by taking a look at readdir , and see how the stat items that it returns are constructed. 如果您想了解目录填充的工作原理,请先看一下readdir ,然后看看它返回的stat项目是如何构造的。 Each of those is a single directory entry. 每个目录都是一个目录条目。

Yes, you can use fusexmp_fh.c as the basis for a basic file system, it's got all the necessary pieces, although extended metadata isn't supported. 是的,您可以使用fusexmp_fh.c作为基本文件系统的基础,尽管不支持扩展元数据,但它具有所有必要的功能。 (But adding it is fairly trivial for a loopback.) (但是添加它对于回送来说是微不足道的。)

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

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