Commit 2e4f3c02239d4c7c454604715db619bc971b15eb
Committed by
Greg Kroah-Hartman
1 parent
8dd70705c4
Exists in
master
and in
7 other branches
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>
Showing 1 changed file with 36 additions and 6 deletions Side-by-side Diff
drivers/usb/core/inode.c
... | ... | @@ -38,10 +38,15 @@ |
38 | 38 | #include <linux/usbdevice_fs.h> |
39 | 39 | #include <linux/parser.h> |
40 | 40 | #include <linux/notifier.h> |
41 | +#include <linux/seq_file.h> | |
41 | 42 | #include <asm/byteorder.h> |
42 | 43 | #include "usb.h" |
43 | 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 | 50 | static struct super_operations usbfs_ops; |
46 | 51 | static const struct file_operations default_file_operations; |
47 | 52 | static struct vfsmount *usbfs_mount; |
48 | 53 | |
... | ... | @@ -57,10 +62,34 @@ |
57 | 62 | static gid_t devgid; /* = 0 */ |
58 | 63 | static gid_t busgid; /* = 0 */ |
59 | 64 | static gid_t listgid; /* = 0 */ |
60 | -static umode_t devmode = S_IWUSR | S_IRUGO; | |
61 | -static umode_t busmode = S_IXUGO | S_IRUGO; | |
62 | -static umode_t listmode = S_IRUGO; | |
65 | +static umode_t devmode = USBFS_DEFAULT_DEVMODE; | |
66 | +static umode_t busmode = USBFS_DEFAULT_BUSMODE; | |
67 | +static umode_t listmode = USBFS_DEFAULT_LISTMODE; | |
63 | 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 | +} | |
92 | + | |
64 | 93 | enum { |
65 | 94 | Opt_devuid, Opt_devgid, Opt_devmode, |
66 | 95 | Opt_busuid, Opt_busgid, Opt_busmode, |
... | ... | @@ -93,9 +122,9 @@ |
93 | 122 | devgid = 0; |
94 | 123 | busgid = 0; |
95 | 124 | listgid = 0; |
96 | - devmode = S_IWUSR | S_IRUGO; | |
97 | - busmode = S_IXUGO | S_IRUGO; | |
98 | - listmode = S_IRUGO; | |
125 | + devmode = USBFS_DEFAULT_DEVMODE; | |
126 | + busmode = USBFS_DEFAULT_BUSMODE; | |
127 | + listmode = USBFS_DEFAULT_LISTMODE; | |
99 | 128 | |
100 | 129 | while ((p = strsep(&data, ",")) != NULL) { |
101 | 130 | substring_t args[MAX_OPT_ARGS]; |
... | ... | @@ -418,6 +447,7 @@ |
418 | 447 | .statfs = simple_statfs, |
419 | 448 | .drop_inode = generic_delete_inode, |
420 | 449 | .remount_fs = remount, |
450 | + .show_options = usbfs_show_options, | |
421 | 451 | }; |
422 | 452 | |
423 | 453 | static int usbfs_fill_super(struct super_block *sb, void *data, int silent) |