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