Commit b87a267eb7291d075df76ebabd43c7f961b12f67
Committed by
Linus Torvalds
1 parent
e55e212c08
Exists in
master
and in
4 other branches
mount options: fix devpts
Add a .show_options super operation to devpts. Small cleanup: when parsing the "mode" option, mask with S_IALLUGO instead of ~S_IFMT. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Acked-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 18 additions and 3 deletions Side-by-side Diff
fs/devpts/inode.c
... | ... | @@ -20,9 +20,12 @@ |
20 | 20 | #include <linux/devpts_fs.h> |
21 | 21 | #include <linux/parser.h> |
22 | 22 | #include <linux/fsnotify.h> |
23 | +#include <linux/seq_file.h> | |
23 | 24 | |
24 | 25 | #define DEVPTS_SUPER_MAGIC 0x1cd1 |
25 | 26 | |
27 | +#define DEVPTS_DEFAULT_MODE 0600 | |
28 | + | |
26 | 29 | static struct vfsmount *devpts_mnt; |
27 | 30 | static struct dentry *devpts_root; |
28 | 31 | |
... | ... | @@ -32,7 +35,7 @@ |
32 | 35 | uid_t uid; |
33 | 36 | gid_t gid; |
34 | 37 | umode_t mode; |
35 | -} config = {.mode = 0600}; | |
38 | +} config = {.mode = DEVPTS_DEFAULT_MODE}; | |
36 | 39 | |
37 | 40 | enum { |
38 | 41 | Opt_uid, Opt_gid, Opt_mode, |
... | ... | @@ -54,7 +57,7 @@ |
54 | 57 | config.setgid = 0; |
55 | 58 | config.uid = 0; |
56 | 59 | config.gid = 0; |
57 | - config.mode = 0600; | |
60 | + config.mode = DEVPTS_DEFAULT_MODE; | |
58 | 61 | |
59 | 62 | while ((p = strsep(&data, ",")) != NULL) { |
60 | 63 | substring_t args[MAX_OPT_ARGS]; |
... | ... | @@ -81,7 +84,7 @@ |
81 | 84 | case Opt_mode: |
82 | 85 | if (match_octal(&args[0], &option)) |
83 | 86 | return -EINVAL; |
84 | - config.mode = option & ~S_IFMT; | |
87 | + config.mode = option & S_IALLUGO; | |
85 | 88 | break; |
86 | 89 | default: |
87 | 90 | printk(KERN_ERR "devpts: called with bogus options\n"); |
88 | 91 | |
... | ... | @@ -92,9 +95,21 @@ |
92 | 95 | return 0; |
93 | 96 | } |
94 | 97 | |
98 | +static int devpts_show_options(struct seq_file *seq, struct vfsmount *vfs) | |
99 | +{ | |
100 | + if (config.setuid) | |
101 | + seq_printf(seq, ",uid=%u", config.uid); | |
102 | + if (config.setgid) | |
103 | + seq_printf(seq, ",gid=%u", config.gid); | |
104 | + seq_printf(seq, ",mode=%03o", config.mode); | |
105 | + | |
106 | + return 0; | |
107 | +} | |
108 | + | |
95 | 109 | static const struct super_operations devpts_sops = { |
96 | 110 | .statfs = simple_statfs, |
97 | 111 | .remount_fs = devpts_remount, |
112 | + .show_options = devpts_show_options, | |
98 | 113 | }; |
99 | 114 | |
100 | 115 | static int |