如何在基于 Fuse 的自定义文件系统中捕获复制/移动文件操作?
我正在使用 Fuse 在 Ubuntu 上实现自定义文件系统,但我需要在发生复制或移动操作时捕获。现在我看到的是打开某些文件进行写入或读取时,但我需要在上下文中查看这些操作,以便我可以看到正在复制或移动哪些文件。
有什么提示吗?
I`m implementing a custom filesystem on Ubuntu using Fuse, but I need to trap when a copy or move operation occur. Right now all I see are when some file are opened for writing or reading, but I need to see these operations in context so I can see what file are being copied or moved.
Any hints?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
考虑到“复制”或“移动”程序可以做您所看到的事情 - 打开文件并写入文件,您想要做的事情可能不容易完成。这是复制文件的完美方法。
即使您可以看到实际的二进制文件正在执行什么操作,也无法为您提供足够的信息来了解这是副本、移动还是只是将数据写入文件的程序。
如果您告诉我们为什么需要这样做,那么也许有人可以建议另一种解决方案来满足您的需求。
What you want to do is probably not easily done, considering that a "copy" or "move" program could do just what you see - open a file and write to it. That's a perfectly good way of copying a file.
Even if you can see what actual binary is doing it, that wouldn't give you enough information to know if this was a copy, a move or simply a program writing data to a file.
If you tell us why you need to do this, then maybe someone can suggest another solution, that fulfills your needs.
复制正如 Weholt 所说:很难捕获,因为它基本上与创建一个新文件并写入它相同。
移动与重命名是相同的操作。
Copy is as Weholt said: difficult to trap because it is basically the same as creating a new file and writing to it.
Move is the same operation as a rename.
我发现使用 pyfilesystem 创建文件系统并使用 fs.expose.fuse 挂载它pyfilesystem 工作得很好。调查一下。我会。谢谢。
I found that using pyfilesystem to create a filesystem and mounting it using the fs.expose.fuse in pyfilesystem worked very well. Look into that. I will. Thank you.