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>
This commit is contained in:
parent
e55e212c08
commit
b87a267eb7
1 changed files with 18 additions and 3 deletions
|
@ -20,9 +20,12 @@
|
||||||
#include <linux/devpts_fs.h>
|
#include <linux/devpts_fs.h>
|
||||||
#include <linux/parser.h>
|
#include <linux/parser.h>
|
||||||
#include <linux/fsnotify.h>
|
#include <linux/fsnotify.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
|
|
||||||
#define DEVPTS_SUPER_MAGIC 0x1cd1
|
#define DEVPTS_SUPER_MAGIC 0x1cd1
|
||||||
|
|
||||||
|
#define DEVPTS_DEFAULT_MODE 0600
|
||||||
|
|
||||||
static struct vfsmount *devpts_mnt;
|
static struct vfsmount *devpts_mnt;
|
||||||
static struct dentry *devpts_root;
|
static struct dentry *devpts_root;
|
||||||
|
|
||||||
|
@ -32,7 +35,7 @@ static struct {
|
||||||
uid_t uid;
|
uid_t uid;
|
||||||
gid_t gid;
|
gid_t gid;
|
||||||
umode_t mode;
|
umode_t mode;
|
||||||
} config = {.mode = 0600};
|
} config = {.mode = DEVPTS_DEFAULT_MODE};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
Opt_uid, Opt_gid, Opt_mode,
|
Opt_uid, Opt_gid, Opt_mode,
|
||||||
|
@ -54,7 +57,7 @@ static int devpts_remount(struct super_block *sb, int *flags, char *data)
|
||||||
config.setgid = 0;
|
config.setgid = 0;
|
||||||
config.uid = 0;
|
config.uid = 0;
|
||||||
config.gid = 0;
|
config.gid = 0;
|
||||||
config.mode = 0600;
|
config.mode = DEVPTS_DEFAULT_MODE;
|
||||||
|
|
||||||
while ((p = strsep(&data, ",")) != NULL) {
|
while ((p = strsep(&data, ",")) != NULL) {
|
||||||
substring_t args[MAX_OPT_ARGS];
|
substring_t args[MAX_OPT_ARGS];
|
||||||
|
@ -81,7 +84,7 @@ static int devpts_remount(struct super_block *sb, int *flags, char *data)
|
||||||
case Opt_mode:
|
case Opt_mode:
|
||||||
if (match_octal(&args[0], &option))
|
if (match_octal(&args[0], &option))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
config.mode = option & ~S_IFMT;
|
config.mode = option & S_IALLUGO;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printk(KERN_ERR "devpts: called with bogus options\n");
|
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)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int devpts_show_options(struct seq_file *seq, struct vfsmount *vfs)
|
||||||
|
{
|
||||||
|
if (config.setuid)
|
||||||
|
seq_printf(seq, ",uid=%u", config.uid);
|
||||||
|
if (config.setgid)
|
||||||
|
seq_printf(seq, ",gid=%u", config.gid);
|
||||||
|
seq_printf(seq, ",mode=%03o", config.mode);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct super_operations devpts_sops = {
|
static const struct super_operations devpts_sops = {
|
||||||
.statfs = simple_statfs,
|
.statfs = simple_statfs,
|
||||||
.remount_fs = devpts_remount,
|
.remount_fs = devpts_remount,
|
||||||
|
.show_options = devpts_show_options,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Reference in a new issue