向 ext2 文件系统添加挂载选项
我正在修改 ext2 文件系统以完成作业。我需要添加一个挂载选项,该选项将一直有效,直到卸载文件系统。我已经将该选项添加到选项枚举中,并正在处理指定它的情况。
该选项是一个键/值对,因此该值需要存储在某个地方,但我似乎不知道在哪里。其他 ext2 键/值对选项存储在 struct ext2_sb_info 中。
我无法修改 struct ext2_super_block
、struct ext2_sb_info
或 struct super_block
,因为它们未在 中的任何源文件中定义/usr/src/linux-source/fs/ext2
。
写入 struct ext2_super_block
的 s_reserved
成员是否安全?还有其他地方可以存储这个值吗?
I am modifying the ext2 filesystem for an assignment. I need to add a mount option which will remain in effect until the file system is unmounted. I've already added the option to the options enum and am handling the case where it is specified.
The option is a key/value pair so the value needs to be stored somewhere, but I can't seem to figure out where. Other ext2 key/value pair options are stored in struct ext2_sb_info
.
I can't modify struct ext2_super_block
, struct ext2_sb_info
or struct super_block
because they aren't defined in any of the source files in /usr/src/linux-source/fs/ext2
.
Is it safe to write to struct ext2_super_block
's s_reserved
member? Is there somewhere else I can store this value?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这取决于您的安装选项接受哪种数据。如果它像其他安装选项一样简单,那么有
->s_mount_opt
。但如果是更复杂的东西,则需要新字段。无论练习内容如何,ext2_sb_info
都是它的正确位置。It depends what kind of data your mount option accepts. If it's simple bit like other mount options, then there is
->s_mount_opt
. But if it is something more complex, new field is required. Andext2_sb_info
is the right place for it regardless of what exercise says.struct ext2_sb_info
可能是正确的位置 - 它在include/linux/ext2_fs_sb.h
中定义,您可以在那里修改它。struct ext2_sb_info
is probably the right place - it's defined ininclude/linux/ext2_fs_sb.h
, you can modify it there.