]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/core/inode.c
Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-omap-h63xx.git] / drivers / usb / core / inode.c
index cd4f11157280de78cd5e73e82f043bde7d247182..1d253dd4ea8143040b4175286331d349a95a1e9c 100644 (file)
 #include <linux/usbdevice_fs.h>
 #include <linux/parser.h>
 #include <linux/notifier.h>
+#include <linux/seq_file.h>
 #include <asm/byteorder.h>
 #include "usb.h"
 #include "hcd.h"
 
+#define USBFS_DEFAULT_DEVMODE (S_IWUSR | S_IRUGO)
+#define USBFS_DEFAULT_BUSMODE (S_IXUGO | S_IRUGO)
+#define USBFS_DEFAULT_LISTMODE S_IRUGO
+
 static struct super_operations usbfs_ops;
 static const struct file_operations default_file_operations;
 static struct vfsmount *usbfs_mount;
@@ -57,9 +62,33 @@ static uid_t listuid;        /* = 0 */
 static gid_t devgid;   /* = 0 */
 static gid_t busgid;   /* = 0 */
 static gid_t listgid;  /* = 0 */
-static umode_t devmode = S_IWUSR | S_IRUGO;
-static umode_t busmode = S_IXUGO | S_IRUGO;
-static umode_t listmode = S_IRUGO;
+static umode_t devmode = USBFS_DEFAULT_DEVMODE;
+static umode_t busmode = USBFS_DEFAULT_BUSMODE;
+static umode_t listmode = USBFS_DEFAULT_LISTMODE;
+
+static int usbfs_show_options(struct seq_file *seq, struct vfsmount *mnt)
+{
+       if (devuid != 0)
+               seq_printf(seq, ",devuid=%u", devuid);
+       if (devgid != 0)
+               seq_printf(seq, ",devgid=%u", devgid);
+       if (devmode != USBFS_DEFAULT_DEVMODE)
+               seq_printf(seq, ",devmode=%o", devmode);
+       if (busuid != 0)
+               seq_printf(seq, ",busuid=%u", busuid);
+       if (busgid != 0)
+               seq_printf(seq, ",busgid=%u", busgid);
+       if (busmode != USBFS_DEFAULT_BUSMODE)
+               seq_printf(seq, ",busmode=%o", busmode);
+       if (listuid != 0)
+               seq_printf(seq, ",listuid=%u", listuid);
+       if (listgid != 0)
+               seq_printf(seq, ",listgid=%u", listgid);
+       if (listmode != USBFS_DEFAULT_LISTMODE)
+               seq_printf(seq, ",listmode=%o", listmode);
+
+       return 0;
+}
 
 enum {
        Opt_devuid, Opt_devgid, Opt_devmode,
@@ -93,9 +122,9 @@ static int parse_options(struct super_block *s, char *data)
        devgid = 0;
        busgid = 0;
        listgid = 0;
-       devmode = S_IWUSR | S_IRUGO;
-       busmode = S_IXUGO | S_IRUGO;
-       listmode = S_IRUGO;
+       devmode = USBFS_DEFAULT_DEVMODE;
+       busmode = USBFS_DEFAULT_BUSMODE;
+       listmode = USBFS_DEFAULT_LISTMODE;
 
        while ((p = strsep(&data, ",")) != NULL) {
                substring_t args[MAX_OPT_ARGS];
@@ -418,6 +447,7 @@ static struct super_operations usbfs_ops = {
        .statfs =       simple_statfs,
        .drop_inode =   generic_delete_inode,
        .remount_fs =   remount,
+       .show_options = usbfs_show_options,
 };
 
 static int usbfs_fill_super(struct super_block *sb, void *data, int silent)
@@ -433,13 +463,13 @@ static int usbfs_fill_super(struct super_block *sb, void *data, int silent)
        inode = usbfs_get_inode(sb, S_IFDIR | 0755, 0);
 
        if (!inode) {
-               dbg("%s: could not get inode!",__FUNCTION__);
+               dbg("%s: could not get inode!",__func__);
                return -ENOMEM;
        }
 
        root = d_alloc_root(inode);
        if (!root) {
-               dbg("%s: could not get root dentry!",__FUNCTION__);
+               dbg("%s: could not get root dentry!",__func__);
                iput(inode);
                return -ENOMEM;
        }
@@ -743,7 +773,7 @@ int __init usbfs_init(void)
        usb_register_notify(&usbfs_nb);
 
        /* create mount point for usbfs */
-       usbdir = proc_mkdir("usb", proc_bus);
+       usbdir = proc_mkdir("bus/usb", NULL);
 
        return 0;
 }
@@ -753,6 +783,6 @@ void usbfs_cleanup(void)
        usb_unregister_notify(&usbfs_nb);
        unregister_filesystem(&usb_fs_type);
        if (usbdir)
-               remove_proc_entry("usb", proc_bus);
+               remove_proc_entry("bus/usb", NULL);
 }