statmount() can export arbitrary strings, so utilize the __spare1 slot for a mnt_opts string pointer, and then support asking for and setting the mount options during statmount(). This calls into the helper for showing mount options, which already uses a seq_file, so fits in nicely with our existing mechanism for exporting strings via statmount().
Showing the changes to include/uapi (1 of 2 files). Show all
Unified · Split
| @@ -154,7 +154,7 @@ struct mount_attr { · 153 unmodified lines | ||
| 154 | 154 | */ |
| 155 | 155 | struct statmount { |
| 156 | 156 | __u32 size; /* Total size, including strings */ |
| 157 | − __u32 __spare1; | |
| 157 | + __u32 mnt_opts; /* [str] Mount options of the mount */ | |
| 158 | 158 | __u64 mask; /* What results were written */ |
| 159 | 159 | __u32 sb_dev_major; /* Device ID */ |
| 160 | 160 | __u32 sb_dev_minor; |
| @@ -206,6 +206,7 @@ struct mnt_id_req { · 45 unmodified lines | ||
| 206 | 206 | #define STATMOUNT_MNT_POINT 0x00000010U /* Want/got mnt_point */ |
| 207 | 207 | #define STATMOUNT_FS_TYPE 0x00000020U /* Want/got fs_type */ |
| 208 | 208 | #define STATMOUNT_MNT_NS_ID 0x00000040U /* Want/got mnt_ns_id */ |
| 209 | +#define STATMOUNT_MNT_OPTS 0x00000080U /* Want/got mnt_opts */ | |
| 209 | 210 | |
| 210 | 211 | /* |
| 211 | 212 | * Special @mnt_id values that can be passed to listmount |