aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2008-02-08 07:21:41 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:40 -0500
commitb87a267eb7291d075df76ebabd43c7f961b12f67 (patch)
tree5dae609dd0e1163c74ea179e5e84cc5ce61f3e36
parente55e212c083f0c51a7d4eccd1746b6dca40ffc41 (diff)
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>
-rw-r--r--fs/devpts/inode.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 06ef9a255c76..f120e1207874 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -20,9 +20,12 @@
20#include <linux/devpts_fs.h> 20#include <linux/devpts_fs.h>
21#include <linux/parser.h> 21#include <linux/parser.h>
22#include <linux/fsnotify.h> 22#include <linux/fsnotify.h>
23#include <linux/seq_file.h>
23 24
24#define DEVPTS_SUPER_MAGIC 0x1cd1 25#define DEVPTS_SUPER_MAGIC 0x1cd1
25 26
27#define DEVPTS_DEFAULT_MODE 0600
28
26static struct vfsmount *devpts_mnt; 29static struct vfsmount *devpts_mnt;
27static struct dentry *devpts_root; 30static struct dentry *devpts_root;
28 31
@@ -32,7 +35,7 @@ static struct {
32 uid_t uid; 35 uid_t uid;
33 gid_t gid; 36 gid_t gid;
34 umode_t mode; 37 umode_t mode;
35} config = {.mode = 0600}; 38} config = {.mode = DEVPTS_DEFAULT_MODE};
36 39
37enum { 40enum {
38 Opt_uid, Opt_gid, Opt_mode, 41 Opt_uid, Opt_gid, Opt_mode,
@@ -54,7 +57,7 @@ static int devpts_remount(struct super_block *sb, int *flags, char *data)
54 config.setgid = 0; 57 config.setgid = 0;
55 config.uid = 0; 58 config.uid = 0;
56 config.gid = 0; 59 config.gid = 0;
57 config.mode = 0600; 60 config.mode = DEVPTS_DEFAULT_MODE;
58 61
59 while ((p = strsep(&data, ",")) != NULL) { 62 while ((p = strsep(&data, ",")) != NULL) {
60 substring_t args[MAX_OPT_ARGS]; 63 substring_t args[MAX_OPT_ARGS];
@@ -81,7 +84,7 @@ static int devpts_remount(struct super_block *sb, int *flags, char *data)
81 case Opt_mode: 84 case Opt_mode:
82 if (match_octal(&args[0], &option)) 85 if (match_octal(&args[0], &option))
83 return -EINVAL; 86 return -EINVAL;
84 config.mode = option & ~S_IFMT; 87 config.mode = option & S_IALLUGO;
85 break; 88 break;
86 default: 89 default:
87 printk(KERN_ERR "devpts: called with bogus options\n"); 90 printk(KERN_ERR "devpts: called with bogus options\n");
@@ -92,9 +95,21 @@ static int devpts_remount(struct super_block *sb, int *flags, char *data)
92 return 0; 95 return 0;
93} 96}
94 97
98static 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
95static const struct super_operations devpts_sops = { 109static const struct super_operations devpts_sops = {
96 .statfs = simple_statfs, 110 .statfs = simple_statfs,
97 .remount_fs = devpts_remount, 111 .remount_fs = devpts_remount,
112 .show_options = devpts_show_options,
98}; 113};
99 114
100static int 115static int