Commit 848b83a59b772b8f102bc5e3f1187c2fa5676959
1 parent
152a083666
Exists in
master
and in
4 other branches
convert get_sb_mtd() users to ->mount()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 4 changed files with 36 additions and 49 deletions Side-by-side Diff
drivers/mtd/mtdsuper.c
... | ... | @@ -54,11 +54,10 @@ |
54 | 54 | /* |
55 | 55 | * get a superblock on an MTD-backed filesystem |
56 | 56 | */ |
57 | -static int get_sb_mtd_aux(struct file_system_type *fs_type, int flags, | |
57 | +static struct dentry *mount_mtd_aux(struct file_system_type *fs_type, int flags, | |
58 | 58 | const char *dev_name, void *data, |
59 | 59 | struct mtd_info *mtd, |
60 | - int (*fill_super)(struct super_block *, void *, int), | |
61 | - struct vfsmount *mnt) | |
60 | + int (*fill_super)(struct super_block *, void *, int)) | |
62 | 61 | { |
63 | 62 | struct super_block *sb; |
64 | 63 | int ret; |
65 | 64 | |
66 | 65 | |
67 | 66 | |
68 | 67 | |
69 | 68 | |
70 | 69 | |
71 | 70 | |
72 | 71 | |
73 | 72 | |
74 | 73 | |
75 | 74 | |
... | ... | @@ -79,57 +78,49 @@ |
79 | 78 | ret = fill_super(sb, data, flags & MS_SILENT ? 1 : 0); |
80 | 79 | if (ret < 0) { |
81 | 80 | deactivate_locked_super(sb); |
82 | - return ret; | |
81 | + return ERR_PTR(ret); | |
83 | 82 | } |
84 | 83 | |
85 | 84 | /* go */ |
86 | 85 | sb->s_flags |= MS_ACTIVE; |
87 | - simple_set_mnt(mnt, sb); | |
86 | + return dget(sb->s_root); | |
88 | 87 | |
89 | - return 0; | |
90 | - | |
91 | 88 | /* new mountpoint for an already mounted superblock */ |
92 | 89 | already_mounted: |
93 | 90 | DEBUG(1, "MTDSB: Device %d (\"%s\") is already mounted\n", |
94 | 91 | mtd->index, mtd->name); |
95 | - simple_set_mnt(mnt, sb); | |
96 | - ret = 0; | |
97 | - goto out_put; | |
92 | + put_mtd_device(mtd); | |
93 | + return dget(sb->s_root); | |
98 | 94 | |
99 | 95 | out_error: |
100 | - ret = PTR_ERR(sb); | |
101 | -out_put: | |
102 | 96 | put_mtd_device(mtd); |
103 | - return ret; | |
97 | + return ERR_CAST(sb); | |
104 | 98 | } |
105 | 99 | |
106 | 100 | /* |
107 | 101 | * get a superblock on an MTD-backed filesystem by MTD device number |
108 | 102 | */ |
109 | -static int get_sb_mtd_nr(struct file_system_type *fs_type, int flags, | |
103 | +static struct dentry *mount_mtd_nr(struct file_system_type *fs_type, int flags, | |
110 | 104 | const char *dev_name, void *data, int mtdnr, |
111 | - int (*fill_super)(struct super_block *, void *, int), | |
112 | - struct vfsmount *mnt) | |
105 | + int (*fill_super)(struct super_block *, void *, int)) | |
113 | 106 | { |
114 | 107 | struct mtd_info *mtd; |
115 | 108 | |
116 | 109 | mtd = get_mtd_device(NULL, mtdnr); |
117 | 110 | if (IS_ERR(mtd)) { |
118 | 111 | DEBUG(0, "MTDSB: Device #%u doesn't appear to exist\n", mtdnr); |
119 | - return PTR_ERR(mtd); | |
112 | + return ERR_CAST(mtd); | |
120 | 113 | } |
121 | 114 | |
122 | - return get_sb_mtd_aux(fs_type, flags, dev_name, data, mtd, fill_super, | |
123 | - mnt); | |
115 | + return mount_mtd_aux(fs_type, flags, dev_name, data, mtd, fill_super); | |
124 | 116 | } |
125 | 117 | |
126 | 118 | /* |
127 | 119 | * set up an MTD-based superblock |
128 | 120 | */ |
129 | -int get_sb_mtd(struct file_system_type *fs_type, int flags, | |
121 | +struct dentry *mount_mtd(struct file_system_type *fs_type, int flags, | |
130 | 122 | const char *dev_name, void *data, |
131 | - int (*fill_super)(struct super_block *, void *, int), | |
132 | - struct vfsmount *mnt) | |
123 | + int (*fill_super)(struct super_block *, void *, int)) | |
133 | 124 | { |
134 | 125 | #ifdef CONFIG_BLOCK |
135 | 126 | struct block_device *bdev; |
... | ... | @@ -138,7 +129,7 @@ |
138 | 129 | int mtdnr; |
139 | 130 | |
140 | 131 | if (!dev_name) |
141 | - return -EINVAL; | |
132 | + return ERR_PTR(-EINVAL); | |
142 | 133 | |
143 | 134 | DEBUG(2, "MTDSB: dev_name \"%s\"\n", dev_name); |
144 | 135 | |
145 | 136 | |
... | ... | @@ -156,10 +147,10 @@ |
156 | 147 | |
157 | 148 | mtd = get_mtd_device_nm(dev_name + 4); |
158 | 149 | if (!IS_ERR(mtd)) |
159 | - return get_sb_mtd_aux( | |
150 | + return mount_mtd_aux( | |
160 | 151 | fs_type, flags, |
161 | 152 | dev_name, data, mtd, |
162 | - fill_super, mnt); | |
153 | + fill_super); | |
163 | 154 | |
164 | 155 | printk(KERN_NOTICE "MTD:" |
165 | 156 | " MTD device with name \"%s\" not found.\n", |
166 | 157 | |
... | ... | @@ -174,9 +165,9 @@ |
174 | 165 | /* It was a valid number */ |
175 | 166 | DEBUG(1, "MTDSB: mtd%%d, mtdnr %d\n", |
176 | 167 | mtdnr); |
177 | - return get_sb_mtd_nr(fs_type, flags, | |
168 | + return mount_mtd_nr(fs_type, flags, | |
178 | 169 | dev_name, data, |
179 | - mtdnr, fill_super, mnt); | |
170 | + mtdnr, fill_super); | |
180 | 171 | } |
181 | 172 | } |
182 | 173 | } |
... | ... | @@ -189,7 +180,7 @@ |
189 | 180 | if (IS_ERR(bdev)) { |
190 | 181 | ret = PTR_ERR(bdev); |
191 | 182 | DEBUG(1, "MTDSB: lookup_bdev() returned %d\n", ret); |
192 | - return ret; | |
183 | + return ERR_PTR(ret); | |
193 | 184 | } |
194 | 185 | DEBUG(1, "MTDSB: lookup_bdev() returned 0\n"); |
195 | 186 | |
... | ... | @@ -202,8 +193,7 @@ |
202 | 193 | if (major != MTD_BLOCK_MAJOR) |
203 | 194 | goto not_an_MTD_device; |
204 | 195 | |
205 | - return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super, | |
206 | - mnt); | |
196 | + return mount_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super); | |
207 | 197 | |
208 | 198 | not_an_MTD_device: |
209 | 199 | #endif /* CONFIG_BLOCK */ |
210 | 200 | |
... | ... | @@ -212,10 +202,10 @@ |
212 | 202 | printk(KERN_NOTICE |
213 | 203 | "MTD: Attempt to mount non-MTD device \"%s\"\n", |
214 | 204 | dev_name); |
215 | - return -EINVAL; | |
205 | + return ERR_PTR(-EINVAL); | |
216 | 206 | } |
217 | 207 | |
218 | -EXPORT_SYMBOL_GPL(get_sb_mtd); | |
208 | +EXPORT_SYMBOL_GPL(mount_mtd); | |
219 | 209 | |
220 | 210 | /* |
221 | 211 | * destroy an MTD-based superblock |
fs/jffs2/super.c
... | ... | @@ -179,12 +179,11 @@ |
179 | 179 | return ret; |
180 | 180 | } |
181 | 181 | |
182 | -static int jffs2_get_sb(struct file_system_type *fs_type, | |
182 | +static struct dentry *jffs2_mount(struct file_system_type *fs_type, | |
183 | 183 | int flags, const char *dev_name, |
184 | - void *data, struct vfsmount *mnt) | |
184 | + void *data) | |
185 | 185 | { |
186 | - return get_sb_mtd(fs_type, flags, dev_name, data, jffs2_fill_super, | |
187 | - mnt); | |
186 | + return mount_mtd(fs_type, flags, dev_name, data, jffs2_fill_super); | |
188 | 187 | } |
189 | 188 | |
190 | 189 | static void jffs2_put_super (struct super_block *sb) |
... | ... | @@ -229,7 +228,7 @@ |
229 | 228 | static struct file_system_type jffs2_fs_type = { |
230 | 229 | .owner = THIS_MODULE, |
231 | 230 | .name = "jffs2", |
232 | - .get_sb = jffs2_get_sb, | |
231 | + .mount = jffs2_mount, | |
233 | 232 | .kill_sb = jffs2_kill_sb, |
234 | 233 | }; |
235 | 234 |
fs/romfs/super.c
... | ... | @@ -552,20 +552,19 @@ |
552 | 552 | /* |
553 | 553 | * get a superblock for mounting |
554 | 554 | */ |
555 | -static int romfs_get_sb(struct file_system_type *fs_type, | |
555 | +static struct dentry *romfs_mount(struct file_system_type *fs_type, | |
556 | 556 | int flags, const char *dev_name, |
557 | - void *data, struct vfsmount *mnt) | |
557 | + void *data) | |
558 | 558 | { |
559 | - int ret = -EINVAL; | |
559 | + struct dentry *ret = ERR_PTR(-EINVAL); | |
560 | 560 | |
561 | 561 | #ifdef CONFIG_ROMFS_ON_MTD |
562 | - ret = get_sb_mtd(fs_type, flags, dev_name, data, romfs_fill_super, | |
563 | - mnt); | |
562 | + ret = mount_mtd(fs_type, flags, dev_name, data, romfs_fill_super); | |
564 | 563 | #endif |
565 | 564 | #ifdef CONFIG_ROMFS_ON_BLOCK |
566 | - if (ret == -EINVAL) | |
567 | - ret = get_sb_bdev(fs_type, flags, dev_name, data, | |
568 | - romfs_fill_super, mnt); | |
565 | + if (ret == ERR_PTR(-EINVAL)) | |
566 | + ret = mount_bdev(fs_type, flags, dev_name, data, | |
567 | + romfs_fill_super); | |
569 | 568 | #endif |
570 | 569 | return ret; |
571 | 570 | } |
... | ... | @@ -592,7 +591,7 @@ |
592 | 591 | static struct file_system_type romfs_fs_type = { |
593 | 592 | .owner = THIS_MODULE, |
594 | 593 | .name = "romfs", |
595 | - .get_sb = romfs_get_sb, | |
594 | + .mount = romfs_mount, | |
596 | 595 | .kill_sb = romfs_kill_sb, |
597 | 596 | .fs_flags = FS_REQUIRES_DEV, |
598 | 597 | }; |
include/linux/mtd/super.h
... | ... | @@ -18,10 +18,9 @@ |
18 | 18 | #include <linux/fs.h> |
19 | 19 | #include <linux/mount.h> |
20 | 20 | |
21 | -extern int get_sb_mtd(struct file_system_type *fs_type, int flags, | |
21 | +extern struct dentry *mount_mtd(struct file_system_type *fs_type, int flags, | |
22 | 22 | const char *dev_name, void *data, |
23 | - int (*fill_super)(struct super_block *, void *, int), | |
24 | - struct vfsmount *mnt); | |
23 | + int (*fill_super)(struct super_block *, void *, int)); | |
25 | 24 | extern void kill_mtd_super(struct super_block *sb); |
26 | 25 | |
27 | 26 |