Question

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?

Was it helpful?

Solution

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. And ext2_sb_info is the right place for it regardless of what exercise says.

OTHER TIPS

struct ext2_sb_info is probably the right place - it's defined in include/linux/ext2_fs_sb.h, you can modify it there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top