Commit d0e46f88b2f73828faf00d559c7e5b3ce9e39a4b

Authored by Al Viro
1 parent f7e835710a

convert sysfs

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 1 changed file with 13 additions and 19 deletions Side-by-side Diff

... ... @@ -23,7 +23,7 @@
23 23 #include "sysfs.h"
24 24  
25 25  
26   -static struct vfsmount *sysfs_mount;
  26 +static struct vfsmount *sysfs_mnt;
27 27 struct kmem_cache *sysfs_dir_cachep;
28 28  
29 29 static const struct super_operations sysfs_ops = {
30 30  
31 31  
... ... @@ -95,18 +95,17 @@
95 95 return error;
96 96 }
97 97  
98   -static int sysfs_get_sb(struct file_system_type *fs_type,
99   - int flags, const char *dev_name, void *data, struct vfsmount *mnt)
  98 +static struct dentry *sysfs_mount(struct file_system_type *fs_type,
  99 + int flags, const char *dev_name, void *data)
100 100 {
101 101 struct sysfs_super_info *info;
102 102 enum kobj_ns_type type;
103 103 struct super_block *sb;
104 104 int error;
105 105  
106   - error = -ENOMEM;
107 106 info = kzalloc(sizeof(*info), GFP_KERNEL);
108 107 if (!info)
109   - goto out;
  108 + return ERR_PTR(-ENOMEM);
110 109  
111 110 for (type = KOBJ_NS_TYPE_NONE; type < KOBJ_NS_TYPES; type++)
112 111 info->ns[type] = kobj_ns_current(type);
113 112  
114 113  
... ... @@ -114,24 +113,19 @@
114 113 sb = sget(fs_type, sysfs_test_super, sysfs_set_super, info);
115 114 if (IS_ERR(sb) || sb->s_fs_info != info)
116 115 kfree(info);
117   - if (IS_ERR(sb)) {
118   - error = PTR_ERR(sb);
119   - goto out;
120   - }
  116 + if (IS_ERR(sb))
  117 + return ERR_CAST(sb);
121 118 if (!sb->s_root) {
122 119 sb->s_flags = flags;
123 120 error = sysfs_fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
124 121 if (error) {
125 122 deactivate_locked_super(sb);
126   - goto out;
  123 + return ERR_PTR(error);
127 124 }
128 125 sb->s_flags |= MS_ACTIVE;
129 126 }
130 127  
131   - simple_set_mnt(mnt, sb);
132   - error = 0;
133   -out:
134   - return error;
  128 + return dget(sb->s_root);
135 129 }
136 130  
137 131 static void sysfs_kill_sb(struct super_block *sb)
... ... @@ -147,7 +141,7 @@
147 141  
148 142 static struct file_system_type sysfs_fs_type = {
149 143 .name = "sysfs",
150   - .get_sb = sysfs_get_sb,
  144 + .mount = sysfs_mount,
151 145 .kill_sb = sysfs_kill_sb,
152 146 };
153 147  
154 148  
... ... @@ -189,11 +183,11 @@
189 183  
190 184 err = register_filesystem(&sysfs_fs_type);
191 185 if (!err) {
192   - sysfs_mount = kern_mount(&sysfs_fs_type);
193   - if (IS_ERR(sysfs_mount)) {
  186 + sysfs_mnt = kern_mount(&sysfs_fs_type);
  187 + if (IS_ERR(sysfs_mnt)) {
194 188 printk(KERN_ERR "sysfs: could not mount!\n");
195   - err = PTR_ERR(sysfs_mount);
196   - sysfs_mount = NULL;
  189 + err = PTR_ERR(sysfs_mnt);
  190 + sysfs_mnt = NULL;
197 191 unregister_filesystem(&sysfs_fs_type);
198 192 goto out_err;
199 193 }