]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - fs/sysfs/mount.c
Merge remote-tracking branch 'driver-core/driver-core-next'
[karo-tx-linux.git] / fs / sysfs / mount.c
index 834ec2cdb7a37e070b7e5ed04ec684ba46cb2093..8c24bce2f4ae514770302f53ca85f6bb00da7260 100644 (file)
@@ -36,7 +36,7 @@ static const struct super_operations sysfs_ops = {
 struct sysfs_dirent sysfs_root = {
        .s_name         = "",
        .s_count        = ATOMIC_INIT(1),
-       .s_flags        = SYSFS_DIR | (KOBJ_NS_TYPE_NONE << SYSFS_NS_TYPE_SHIFT),
+       .s_flags        = SYSFS_DIR,
        .s_mode         = S_IFDIR | S_IRUGO | S_IXUGO,
        .s_ino          = 1,
 };
@@ -77,14 +77,8 @@ static int sysfs_test_super(struct super_block *sb, void *data)
 {
        struct sysfs_super_info *sb_info = sysfs_info(sb);
        struct sysfs_super_info *info = data;
-       enum kobj_ns_type type;
-       int found = 1;
 
-       for (type = KOBJ_NS_TYPE_NONE; type < KOBJ_NS_TYPES; type++) {
-               if (sb_info->ns[type] != info->ns[type])
-                       found = 0;
-       }
-       return found;
+       return sb_info->ns == info->ns;
 }
 
 static int sysfs_set_super(struct super_block *sb, void *data)
@@ -98,9 +92,7 @@ static int sysfs_set_super(struct super_block *sb, void *data)
 
 static void free_sysfs_super_info(struct sysfs_super_info *info)
 {
-       int type;
-       for (type = KOBJ_NS_TYPE_NONE; type < KOBJ_NS_TYPES; type++)
-               kobj_ns_drop(type, info->ns[type]);
+       kobj_ns_drop(KOBJ_NS_TYPE_NET, info->ns);
        kfree(info);
 }
 
@@ -108,7 +100,6 @@ static struct dentry *sysfs_mount(struct file_system_type *fs_type,
        int flags, const char *dev_name, void *data)
 {
        struct sysfs_super_info *info;
-       enum kobj_ns_type type;
        struct super_block *sb;
        int error;
 
@@ -116,18 +107,15 @@ static struct dentry *sysfs_mount(struct file_system_type *fs_type,
                if (!capable(CAP_SYS_ADMIN) && !fs_fully_visible(fs_type))
                        return ERR_PTR(-EPERM);
 
-               for (type = KOBJ_NS_TYPE_NONE; type < KOBJ_NS_TYPES; type++) {
-                       if (!kobj_ns_current_may_mount(type))
-                               return ERR_PTR(-EPERM);
-               }
+               if (!kobj_ns_current_may_mount(KOBJ_NS_TYPE_NET))
+                       return ERR_PTR(-EPERM);
        }
 
        info = kzalloc(sizeof(*info), GFP_KERNEL);
        if (!info)
                return ERR_PTR(-ENOMEM);
 
-       for (type = KOBJ_NS_TYPE_NONE; type < KOBJ_NS_TYPES; type++)
-               info->ns[type] = kobj_ns_grab_current(type);
+       info->ns = kobj_ns_grab_current(KOBJ_NS_TYPE_NET);
 
        sb = sget(fs_type, sysfs_test_super, sysfs_set_super, flags, info);
        if (IS_ERR(sb) || sb->s_fs_info != info)