重新使用 inode 字段
我在一个项目中,我需要做一些簿记,即指示程序 A 是否已访问特定文件。我计划将此信息存储在 inode 中,因为使用其他附加数据结构效率很低。 我计划重用 inode 数据结构中的 i_mode 字段。任何建议。此外,我不知道如何从用户空间写入索引节点数据结构。我该怎么做?谢谢...
I am in a project where I need to do some book-keeping i.e to indicate whether a particular file has been accessed by a program A. I plan to store this information in the inode as using other additional datastructure would be inefficient.
I plan to reuse the field i_mode in the inode datastructure. Any suggestions. Moreover I don't know how to write to the inode data structure from user space. How do I do that? thanks...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
文件系统负责 inode;它甚至不允许超级用户直接修改 inode(尽管 root 始终可以访问未安装的(块或字符)设备来更改它)。
除非您编写代码来修改文件系统(内核模块),否则您将无法按照您的意愿进行操作。寻找另一种方法来做到这一点。
The file system looks after the inode; it won't even let super-user modify the inode directly (though root can always access the unmounted (block or character) device to change it).
Unless you write code to modify the file system - a kernel module - you will not be able to do as you wish. Find another way to do it.
文件系统并不是为了解决用户问题而设计的。您想要簿记更改的文件,其他人想要簿记新的/删除的文件。
我只看到以下选项:
只是为了好玩你可以考虑:
File system is not designed to solve users problem. You want bookkeeping changed files, other want bookkeeping of new/deleted files.
I see only the following options:
Just for fun you can consider:
经过一番谷歌搜索后发现“粘性位”现在用得不多,我们可以使用它并从用户空间修改它。
After a bit of googling around saw that the "sticky bit" is not much in use today and we can use it as well as modify it from user space.