17
17
#include <linux/slab.h>
18
18
#include <linux/stat.h>
19
19
#include <linux/vfs.h>
20
- #include <linux/mount .h>
20
+ #include <linux/fs_context .h>
21
21
22
22
#include "vxfs.h"
23
23
#include "vxfs_extern.h"
@@ -91,10 +91,10 @@ vxfs_statfs(struct dentry *dentry, struct kstatfs *bufp)
91
91
return 0 ;
92
92
}
93
93
94
- static int vxfs_remount (struct super_block * sb , int * flags , char * data )
94
+ static int vxfs_reconfigure (struct fs_context * fc )
95
95
{
96
- sync_filesystem (sb );
97
- * flags |= SB_RDONLY ;
96
+ sync_filesystem (fc -> root -> d_sb );
97
+ fc -> sb_flags |= SB_RDONLY ;
98
98
return 0 ;
99
99
}
100
100
@@ -120,24 +120,24 @@ static const struct super_operations vxfs_super_ops = {
120
120
.evict_inode = vxfs_evict_inode ,
121
121
.put_super = vxfs_put_super ,
122
122
.statfs = vxfs_statfs ,
123
- .remount_fs = vxfs_remount ,
124
123
};
125
124
126
- static int vxfs_try_sb_magic (struct super_block * sbp , int silent ,
125
+ static int vxfs_try_sb_magic (struct super_block * sbp , struct fs_context * fc ,
127
126
unsigned blk , __fs32 magic )
128
127
{
129
128
struct buffer_head * bp ;
130
129
struct vxfs_sb * rsbp ;
131
130
struct vxfs_sb_info * infp = VXFS_SBI (sbp );
131
+ int silent = fc -> sb_flags & SB_SILENT ;
132
132
int rc = - ENOMEM ;
133
133
134
134
bp = sb_bread (sbp , blk );
135
135
do {
136
136
if (!bp || !buffer_mapped (bp )) {
137
137
if (!silent ) {
138
- printk ( KERN_WARNING
139
- "vxfs: unable to read disk superblock at %u\n " ,
140
- blk );
138
+ warnf ( fc ,
139
+ "vxfs: unable to read disk superblock at %u" ,
140
+ blk );
141
141
}
142
142
break ;
143
143
}
@@ -146,9 +146,9 @@ static int vxfs_try_sb_magic(struct super_block *sbp, int silent,
146
146
rsbp = (struct vxfs_sb * )bp -> b_data ;
147
147
if (rsbp -> vs_magic != magic ) {
148
148
if (!silent )
149
- printk ( KERN_NOTICE
150
- "vxfs: WRONG superblock magic %08x at %u\n " ,
151
- rsbp -> vs_magic , blk );
149
+ infof ( fc ,
150
+ "vxfs: WRONG superblock magic %08x at %u" ,
151
+ rsbp -> vs_magic , blk );
152
152
break ;
153
153
}
154
154
@@ -169,8 +169,7 @@ static int vxfs_try_sb_magic(struct super_block *sbp, int silent,
169
169
/**
170
170
* vxfs_fill_super - read superblock into memory and initialize filesystem
171
171
* @sbp: VFS superblock (to fill)
172
- * @dp: fs private mount data
173
- * @silent: do not complain loudly when sth is wrong
172
+ * @fc: filesytem context
174
173
*
175
174
* Description:
176
175
* We are called on the first mount of a filesystem to read the
@@ -182,26 +181,27 @@ static int vxfs_try_sb_magic(struct super_block *sbp, int silent,
182
181
* Locking:
183
182
* We are under @sbp->s_lock.
184
183
*/
185
- static int vxfs_fill_super (struct super_block * sbp , void * dp , int silent )
184
+ static int vxfs_fill_super (struct super_block * sbp , struct fs_context * fc )
186
185
{
187
186
struct vxfs_sb_info * infp ;
188
187
struct vxfs_sb * rsbp ;
189
188
u_long bsize ;
190
189
struct inode * root ;
191
190
int ret = - EINVAL ;
191
+ int silent = fc -> sb_flags & SB_SILENT ;
192
192
u32 j ;
193
193
194
194
sbp -> s_flags |= SB_RDONLY ;
195
195
196
196
infp = kzalloc (sizeof (* infp ), GFP_KERNEL );
197
197
if (!infp ) {
198
- printk ( KERN_WARNING "vxfs: unable to allocate incore superblock\n " );
198
+ warnf ( fc , "vxfs: unable to allocate incore superblock" );
199
199
return - ENOMEM ;
200
200
}
201
201
202
202
bsize = sb_min_blocksize (sbp , BLOCK_SIZE );
203
203
if (!bsize ) {
204
- printk ( KERN_WARNING "vxfs: unable to set blocksize\n " );
204
+ warnf ( fc , "vxfs: unable to set blocksize" );
205
205
goto out ;
206
206
}
207
207
@@ -210,24 +210,24 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent)
210
210
sbp -> s_time_min = 0 ;
211
211
sbp -> s_time_max = U32_MAX ;
212
212
213
- if (!vxfs_try_sb_magic (sbp , silent , 1 ,
213
+ if (!vxfs_try_sb_magic (sbp , fc , 1 ,
214
214
(__force __fs32 )cpu_to_le32 (VXFS_SUPER_MAGIC ))) {
215
215
/* Unixware, x86 */
216
216
infp -> byte_order = VXFS_BO_LE ;
217
- } else if (!vxfs_try_sb_magic (sbp , silent , 8 ,
217
+ } else if (!vxfs_try_sb_magic (sbp , fc , 8 ,
218
218
(__force __fs32 )cpu_to_be32 (VXFS_SUPER_MAGIC ))) {
219
219
/* HP-UX, parisc */
220
220
infp -> byte_order = VXFS_BO_BE ;
221
221
} else {
222
222
if (!silent )
223
- printk ( KERN_NOTICE "vxfs: can't find superblock.\n " );
223
+ infof ( fc , "vxfs: can't find superblock." );
224
224
goto out ;
225
225
}
226
226
227
227
rsbp = infp -> vsi_raw ;
228
228
j = fs32_to_cpu (infp , rsbp -> vs_version );
229
229
if ((j < 2 || j > 4 ) && !silent ) {
230
- printk ( KERN_NOTICE "vxfs: unsupported VxFS version (%d)\n " , j );
230
+ infof ( fc , "vxfs: unsupported VxFS version (%d)" , j );
231
231
goto out ;
232
232
}
233
233
@@ -244,17 +244,17 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent)
244
244
245
245
j = fs32_to_cpu (infp , rsbp -> vs_bsize );
246
246
if (!sb_set_blocksize (sbp , j )) {
247
- printk ( KERN_WARNING "vxfs: unable to set final block size\n " );
247
+ warnf ( fc , "vxfs: unable to set final block size" );
248
248
goto out ;
249
249
}
250
250
251
251
if (vxfs_read_olt (sbp , bsize )) {
252
- printk ( KERN_WARNING "vxfs: unable to read olt\n " );
252
+ warnf ( fc , "vxfs: unable to read olt" );
253
253
goto out ;
254
254
}
255
255
256
256
if (vxfs_read_fshead (sbp )) {
257
- printk ( KERN_WARNING "vxfs: unable to read fshead\n " );
257
+ warnf ( fc , "vxfs: unable to read fshead" );
258
258
goto out ;
259
259
}
260
260
@@ -265,7 +265,7 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent)
265
265
}
266
266
sbp -> s_root = d_make_root (root );
267
267
if (!sbp -> s_root ) {
268
- printk ( KERN_WARNING "vxfs: unable to get root dentry.\n " );
268
+ warnf ( fc , "vxfs: unable to get root dentry." );
269
269
goto out_free_ilist ;
270
270
}
271
271
@@ -284,18 +284,29 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent)
284
284
/*
285
285
* The usual module blurb.
286
286
*/
287
- static struct dentry * vxfs_mount (struct file_system_type * fs_type ,
288
- int flags , const char * dev_name , void * data )
287
+ static int vxfs_get_tree (struct fs_context * fc )
289
288
{
290
- return mount_bdev (fs_type , flags , dev_name , data , vxfs_fill_super );
289
+ return get_tree_bdev (fc , vxfs_fill_super );
290
+ }
291
+
292
+ static const struct fs_context_operations vxfs_context_ops = {
293
+ .get_tree = vxfs_get_tree ,
294
+ .reconfigure = vxfs_reconfigure ,
295
+ };
296
+
297
+ static int vxfs_init_fs_context (struct fs_context * fc )
298
+ {
299
+ fc -> ops = & vxfs_context_ops ;
300
+
301
+ return 0 ;
291
302
}
292
303
293
304
static struct file_system_type vxfs_fs_type = {
294
305
.owner = THIS_MODULE ,
295
306
.name = "vxfs" ,
296
- .mount = vxfs_mount ,
297
307
.kill_sb = kill_block_super ,
298
308
.fs_flags = FS_REQUIRES_DEV ,
309
+ .init_fs_context = vxfs_init_fs_context ,
299
310
};
300
311
MODULE_ALIAS_FS ("vxfs" ); /* makes mount -t vxfs autoload the module */
301
312
MODULE_ALIAS ("vxfs" );
0 commit comments