Skip to content

Commit 101f2bb

Browse files
brenns10brauner
authored andcommitted
fs: convert mount flags to enum
In prior kernel versions (5.8-6.8), commit 9f6c61f ("proc/mounts: add cursor") introduced MNT_CURSOR, a flag used by readers from /proc/mounts to keep their place while reading the file. Later, commit 2eea9ce ("mounts: keep list of mounts in an rbtree") removed this flag and its value has since been repurposed. For debuggers iterating over the list of mounts, cursors should be skipped as they are irrelevant. Detecting whether an element is a cursor can be difficult. Since the MNT_CURSOR flag is a preprocessor constant, it's not present in debuginfo, and since its value is repurposed, we cannot hard-code it. For this specific issue, cursors are possible to detect in other ways, but ideally, we would be able to read the mount flag definitions out of the debuginfo. For that reason, convert the mount flags to an enum. Link: osandov/drgn#496 Signed-off-by: Stephen Brennan <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent 7fc7117 commit 101f2bb

File tree

1 file changed

+45
-42
lines changed

1 file changed

+45
-42
lines changed

include/linux/mount.h

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -22,48 +22,51 @@ struct fs_context;
2222
struct file;
2323
struct path;
2424

25-
#define MNT_NOSUID 0x01
26-
#define MNT_NODEV 0x02
27-
#define MNT_NOEXEC 0x04
28-
#define MNT_NOATIME 0x08
29-
#define MNT_NODIRATIME 0x10
30-
#define MNT_RELATIME 0x20
31-
#define MNT_READONLY 0x40 /* does the user want this to be r/o? */
32-
#define MNT_NOSYMFOLLOW 0x80
33-
34-
#define MNT_SHRINKABLE 0x100
35-
#define MNT_WRITE_HOLD 0x200
36-
37-
#define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */
38-
#define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */
39-
/*
40-
* MNT_SHARED_MASK is the set of flags that should be cleared when a
41-
* mount becomes shared. Currently, this is only the flag that says a
42-
* mount cannot be bind mounted, since this is how we create a mount
43-
* that shares events with another mount. If you add a new MNT_*
44-
* flag, consider how it interacts with shared mounts.
45-
*/
46-
#define MNT_SHARED_MASK (MNT_UNBINDABLE)
47-
#define MNT_USER_SETTABLE_MASK (MNT_NOSUID | MNT_NODEV | MNT_NOEXEC \
48-
| MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME \
49-
| MNT_READONLY | MNT_NOSYMFOLLOW)
50-
#define MNT_ATIME_MASK (MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME )
51-
52-
#define MNT_INTERNAL_FLAGS (MNT_SHARED | MNT_WRITE_HOLD | MNT_INTERNAL | \
53-
MNT_DOOMED | MNT_SYNC_UMOUNT | MNT_MARKED)
54-
55-
#define MNT_INTERNAL 0x4000
56-
57-
#define MNT_LOCK_ATIME 0x040000
58-
#define MNT_LOCK_NOEXEC 0x080000
59-
#define MNT_LOCK_NOSUID 0x100000
60-
#define MNT_LOCK_NODEV 0x200000
61-
#define MNT_LOCK_READONLY 0x400000
62-
#define MNT_LOCKED 0x800000
63-
#define MNT_DOOMED 0x1000000
64-
#define MNT_SYNC_UMOUNT 0x2000000
65-
#define MNT_MARKED 0x4000000
66-
#define MNT_UMOUNT 0x8000000
25+
enum mount_flags {
26+
MNT_NOSUID = 0x01,
27+
MNT_NODEV = 0x02,
28+
MNT_NOEXEC = 0x04,
29+
MNT_NOATIME = 0x08,
30+
MNT_NODIRATIME = 0x10,
31+
MNT_RELATIME = 0x20,
32+
MNT_READONLY = 0x40, /* does the user want this to be r/o? */
33+
MNT_NOSYMFOLLOW = 0x80,
34+
35+
MNT_SHRINKABLE = 0x100,
36+
MNT_WRITE_HOLD = 0x200,
37+
38+
MNT_SHARED = 0x1000, /* if the vfsmount is a shared mount */
39+
MNT_UNBINDABLE = 0x2000, /* if the vfsmount is a unbindable mount */
40+
41+
MNT_INTERNAL = 0x4000,
42+
43+
MNT_LOCK_ATIME = 0x040000,
44+
MNT_LOCK_NOEXEC = 0x080000,
45+
MNT_LOCK_NOSUID = 0x100000,
46+
MNT_LOCK_NODEV = 0x200000,
47+
MNT_LOCK_READONLY = 0x400000,
48+
MNT_LOCKED = 0x800000,
49+
MNT_DOOMED = 0x1000000,
50+
MNT_SYNC_UMOUNT = 0x2000000,
51+
MNT_MARKED = 0x4000000,
52+
MNT_UMOUNT = 0x8000000,
53+
54+
/*
55+
* MNT_SHARED_MASK is the set of flags that should be cleared when a
56+
* mount becomes shared. Currently, this is only the flag that says a
57+
* mount cannot be bind mounted, since this is how we create a mount
58+
* that shares events with another mount. If you add a new MNT_*
59+
* flag, consider how it interacts with shared mounts.
60+
*/
61+
MNT_SHARED_MASK = MNT_UNBINDABLE,
62+
MNT_USER_SETTABLE_MASK = MNT_NOSUID | MNT_NODEV | MNT_NOEXEC
63+
| MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME
64+
| MNT_READONLY | MNT_NOSYMFOLLOW,
65+
MNT_ATIME_MASK = MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME,
66+
67+
MNT_INTERNAL_FLAGS = MNT_SHARED | MNT_WRITE_HOLD | MNT_INTERNAL |
68+
MNT_DOOMED | MNT_SYNC_UMOUNT | MNT_MARKED,
69+
};
6770

6871
struct vfsmount {
6972
struct dentry *mnt_root; /* root of the mounted tree */

0 commit comments

Comments
 (0)