diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2008-01-24 14:34:07 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-02-01 17:35:06 -0500 |
commit | 2e4f3c02239d4c7c454604715db619bc971b15eb (patch) | |
tree | 4523b42137cf84921aef5f810aa6aebe444365bc | |
parent | 8dd70705c4a7a3110076da412333c90d773bbb63 (diff) |
USB: mount options: fix usbfs
Add a .show_options super operation to usbfs.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/core/inode.c | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index cd4f11157280..83a373e9cc36 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c | |||
@@ -38,10 +38,15 @@ | |||
38 | #include <linux/usbdevice_fs.h> | 38 | #include <linux/usbdevice_fs.h> |
39 | #include <linux/parser.h> | 39 | #include <linux/parser.h> |
40 | #include <linux/notifier.h> | 40 | #include <linux/notifier.h> |
41 | #include <linux/seq_file.h> | ||
41 | #include <asm/byteorder.h> | 42 | #include <asm/byteorder.h> |
42 | #include "usb.h" | 43 | #include "usb.h" |
43 | #include "hcd.h" | 44 | #include "hcd.h" |
44 | 45 | ||
46 | #define USBFS_DEFAULT_DEVMODE (S_IWUSR | S_IRUGO) | ||
47 | #define USBFS_DEFAULT_BUSMODE (S_IXUGO | S_IRUGO) | ||
48 | #define USBFS_DEFAULT_LISTMODE S_IRUGO | ||
49 | |||
45 | static struct super_operations usbfs_ops; | 50 | static struct super_operations usbfs_ops; |
46 | static const struct file_operations default_file_operations; | 51 | static const struct file_operations default_file_operations; |
47 | static struct vfsmount *usbfs_mount; | 52 | static struct vfsmount *usbfs_mount; |
@@ -57,9 +62,33 @@ static uid_t listuid; /* = 0 */ | |||
57 | static gid_t devgid; /* = 0 */ | 62 | static gid_t devgid; /* = 0 */ |
58 | static gid_t busgid; /* = 0 */ | 63 | static gid_t busgid; /* = 0 */ |
59 | static gid_t listgid; /* = 0 */ | 64 | static gid_t listgid; /* = 0 */ |
60 | static umode_t devmode = S_IWUSR | S_IRUGO; | 65 | static umode_t devmode = USBFS_DEFAULT_DEVMODE; |
61 | static umode_t busmode = S_IXUGO | S_IRUGO; | 66 | static umode_t busmode = USBFS_DEFAULT_BUSMODE; |
62 | static umode_t listmode = S_IRUGO; | 67 | static umode_t listmode = USBFS_DEFAULT_LISTMODE; |
68 | |||
69 | static int usbfs_show_options(struct seq_file *seq, struct vfsmount *mnt) | ||
70 | { | ||
71 | if (devuid != 0) | ||
72 | seq_printf(seq, ",devuid=%u", devuid); | ||
73 | if (devgid != 0) | ||
74 | seq_printf(seq, ",devgid=%u", devgid); | ||
75 | if (devmode != USBFS_DEFAULT_DEVMODE) | ||
76 | seq_printf(seq, ",devmode=%o", devmode); | ||
77 | if (busuid != 0) | ||
78 | seq_printf(seq, ",busuid=%u", busuid); | ||
79 | if (busgid != 0) | ||
80 | seq_printf(seq, ",busgid=%u", busgid); | ||
81 | if (busmode != USBFS_DEFAULT_BUSMODE) | ||
82 | seq_printf(seq, ",busmode=%o", busmode); | ||
83 | if (listuid != 0) | ||
84 | seq_printf(seq, ",listuid=%u", listuid); | ||
85 | if (listgid != 0) | ||
86 | seq_printf(seq, ",listgid=%u", listgid); | ||
87 | if (listmode != USBFS_DEFAULT_LISTMODE) | ||
88 | seq_printf(seq, ",listmode=%o", listmode); | ||
89 | |||
90 | return 0; | ||
91 | } | ||
63 | 92 | ||
64 | enum { | 93 | enum { |
65 | Opt_devuid, Opt_devgid, Opt_devmode, | 94 | Opt_devuid, Opt_devgid, Opt_devmode, |
@@ -93,9 +122,9 @@ static int parse_options(struct super_block *s, char *data) | |||
93 | devgid = 0; | 122 | devgid = 0; |
94 | busgid = 0; | 123 | busgid = 0; |
95 | listgid = 0; | 124 | listgid = 0; |
96 | devmode = S_IWUSR | S_IRUGO; | 125 | devmode = USBFS_DEFAULT_DEVMODE; |
97 | busmode = S_IXUGO | S_IRUGO; | 126 | busmode = USBFS_DEFAULT_BUSMODE; |
98 | listmode = S_IRUGO; | 127 | listmode = USBFS_DEFAULT_LISTMODE; |
99 | 128 | ||
100 | while ((p = strsep(&data, ",")) != NULL) { | 129 | while ((p = strsep(&data, ",")) != NULL) { |
101 | substring_t args[MAX_OPT_ARGS]; | 130 | substring_t args[MAX_OPT_ARGS]; |
@@ -418,6 +447,7 @@ static struct super_operations usbfs_ops = { | |||
418 | .statfs = simple_statfs, | 447 | .statfs = simple_statfs, |
419 | .drop_inode = generic_delete_inode, | 448 | .drop_inode = generic_delete_inode, |
420 | .remount_fs = remount, | 449 | .remount_fs = remount, |
450 | .show_options = usbfs_show_options, | ||
421 | }; | 451 | }; |
422 | 452 | ||
423 | static int usbfs_fill_super(struct super_block *sb, void *data, int silent) | 453 | static int usbfs_fill_super(struct super_block *sb, void *data, int silent) |