Skip to content

Commit d7167b1

Browse files
author
Al Viro
committed
fs_parse: fold fs_parameter_desc/fs_parameter_spec
The former contains nothing but a pointer to an array of the latter... Signed-off-by: Al Viro <[email protected]>
1 parent 96cafb9 commit d7167b1

File tree

29 files changed

+106
-198
lines changed

29 files changed

+106
-198
lines changed

arch/powerpc/platforms/cell/spufs/inode.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -583,18 +583,14 @@ enum {
583583
Opt_uid, Opt_gid, Opt_mode, Opt_debug,
584584
};
585585

586-
static const struct fs_parameter_spec spufs_param_specs[] = {
586+
static const struct fs_parameter_spec spufs_fs_parameters[] = {
587587
fsparam_u32 ("gid", Opt_gid),
588588
fsparam_u32oct ("mode", Opt_mode),
589589
fsparam_u32 ("uid", Opt_uid),
590590
fsparam_flag ("debug", Opt_debug),
591591
{}
592592
};
593593

594-
static const struct fs_parameter_description spufs_fs_parameters = {
595-
.specs = spufs_param_specs,
596-
};
597-
598594
static int spufs_show_options(struct seq_file *m, struct dentry *root)
599595
{
600596
struct spufs_sb_info *sbi = spufs_get_sb_info(root->d_sb);
@@ -622,7 +618,7 @@ static int spufs_parse_param(struct fs_context *fc, struct fs_parameter *param)
622618
kgid_t gid;
623619
int opt;
624620

625-
opt = fs_parse(fc, &spufs_fs_parameters, param, &result);
621+
opt = fs_parse(fc, spufs_fs_parameters, param, &result);
626622
if (opt < 0)
627623
return opt;
628624

@@ -773,7 +769,7 @@ static struct file_system_type spufs_type = {
773769
.owner = THIS_MODULE,
774770
.name = "spufs",
775771
.init_fs_context = spufs_init_fs_context,
776-
.parameters = &spufs_fs_parameters,
772+
.parameters = spufs_fs_parameters,
777773
.kill_sb = kill_litter_super,
778774
};
779775
MODULE_ALIAS_FS("spufs");

arch/s390/hypfs/inode.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,12 @@ static int hypfs_release(struct inode *inode, struct file *filp)
209209

210210
enum { Opt_uid, Opt_gid, };
211211

212-
static const struct fs_parameter_spec hypfs_param_specs[] = {
212+
static const struct fs_parameter_spec hypfs_fs_parameters[] = {
213213
fsparam_u32("gid", Opt_gid),
214214
fsparam_u32("uid", Opt_uid),
215215
{}
216216
};
217217

218-
static const struct fs_parameter_description hypfs_fs_parameters = {
219-
.specs = hypfs_param_specs,
220-
};
221-
222218
static int hypfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
223219
{
224220
struct hypfs_sb_info *hypfs_info = fc->s_fs_info;
@@ -227,7 +223,7 @@ static int hypfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
227223
kgid_t gid;
228224
int opt;
229225

230-
opt = fs_parse(fc, &hypfs_fs_parameters, param, &result);
226+
opt = fs_parse(fc, hypfs_fs_parameters, param, &result);
231227
if (opt < 0)
232228
return opt;
233229

@@ -454,7 +450,7 @@ static struct file_system_type hypfs_type = {
454450
.owner = THIS_MODULE,
455451
.name = "s390_hypfs",
456452
.init_fs_context = hypfs_init_fs_context,
457-
.parameters = &hypfs_fs_parameters,
453+
.parameters = hypfs_fs_parameters,
458454
.kill_sb = hypfs_kill_super
459455
};
460456

arch/x86/kernel/cpu/resctrl/rdtgroup.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,24 +2037,20 @@ enum rdt_param {
20372037
nr__rdt_params
20382038
};
20392039

2040-
static const struct fs_parameter_spec rdt_param_specs[] = {
2040+
static const struct fs_parameter_spec rdt_fs_parameters[] = {
20412041
fsparam_flag("cdp", Opt_cdp),
20422042
fsparam_flag("cdpl2", Opt_cdpl2),
20432043
fsparam_flag("mba_MBps", Opt_mba_mbps),
20442044
{}
20452045
};
20462046

2047-
static const struct fs_parameter_description rdt_fs_parameters = {
2048-
.specs = rdt_param_specs,
2049-
};
2050-
20512047
static int rdt_parse_param(struct fs_context *fc, struct fs_parameter *param)
20522048
{
20532049
struct rdt_fs_context *ctx = rdt_fc2context(fc);
20542050
struct fs_parse_result result;
20552051
int opt;
20562052

2057-
opt = fs_parse(fc, &rdt_fs_parameters, param, &result);
2053+
opt = fs_parse(fc, rdt_fs_parameters, param, &result);
20582054
if (opt < 0)
20592055
return opt;
20602056

@@ -2279,7 +2275,7 @@ static void rdt_kill_sb(struct super_block *sb)
22792275
static struct file_system_type rdt_fs_type = {
22802276
.name = "resctrl",
22812277
.init_fs_context = rdt_init_fs_context,
2282-
.parameters = &rdt_fs_parameters,
2278+
.parameters = rdt_fs_parameters,
22832279
.kill_sb = rdt_kill_sb,
22842280
};
22852281

drivers/base/devtmpfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ static struct file_system_type internal_fs_type = {
7171
.name = "devtmpfs",
7272
#ifdef CONFIG_TMPFS
7373
.init_fs_context = shmem_init_fs_context,
74-
.parameters = &shmem_fs_parameters,
74+
.parameters = shmem_fs_parameters,
7575
#else
7676
.init_fs_context = ramfs_init_fs_context,
77-
.parameters = &ramfs_fs_parameters,
77+
.parameters = ramfs_fs_parameters,
7878
#endif
7979
.kill_sb = kill_litter_super,
8080
};

drivers/block/rbd.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ enum {
848848
Opt_notrim,
849849
};
850850

851-
static const struct fs_parameter_spec rbd_param_specs[] = {
851+
static const struct fs_parameter_spec rbd_parameters[] = {
852852
fsparam_u32 ("alloc_size", Opt_alloc_size),
853853
fsparam_flag ("exclusive", Opt_exclusive),
854854
fsparam_flag ("lock_on_read", Opt_lock_on_read),
@@ -863,10 +863,6 @@ static const struct fs_parameter_spec rbd_param_specs[] = {
863863
{}
864864
};
865865

866-
static const struct fs_parameter_description rbd_parameters = {
867-
.specs = rbd_param_specs,
868-
};
869-
870866
struct rbd_options {
871867
int queue_depth;
872868
int alloc_size;
@@ -6359,7 +6355,7 @@ static int rbd_parse_param(struct fs_parameter *param,
63596355
if (ret != -ENOPARAM)
63606356
return ret;
63616357

6362-
token = __fs_parse(&log, &rbd_parameters, param, &result);
6358+
token = __fs_parse(&log, rbd_parameters, param, &result);
63636359
dout("%s fs_parse '%s' token %d\n", __func__, param->key, token);
63646360
if (token < 0) {
63656361
if (token == -ENOPARAM)

drivers/usb/gadget/function/f_fs.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,7 +1486,7 @@ enum {
14861486
Opt_gid,
14871487
};
14881488

1489-
static const struct fs_parameter_spec ffs_fs_param_specs[] = {
1489+
static const struct fs_parameter_spec ffs_fs_fs_parameters[] = {
14901490
fsparam_bool ("no_disconnect", Opt_no_disconnect),
14911491
fsparam_u32 ("rmode", Opt_rmode),
14921492
fsparam_u32 ("fmode", Opt_fmode),
@@ -1496,10 +1496,6 @@ static const struct fs_parameter_spec ffs_fs_param_specs[] = {
14961496
{}
14971497
};
14981498

1499-
static const struct fs_parameter_description ffs_fs_fs_parameters = {
1500-
.specs = ffs_fs_param_specs,
1501-
};
1502-
15031499
static int ffs_fs_parse_param(struct fs_context *fc, struct fs_parameter *param)
15041500
{
15051501
struct ffs_sb_fill_data *data = fc->fs_private;
@@ -1508,7 +1504,7 @@ static int ffs_fs_parse_param(struct fs_context *fc, struct fs_parameter *param)
15081504

15091505
ENTER();
15101506

1511-
opt = fs_parse(fc, &ffs_fs_fs_parameters, param, &result);
1507+
opt = fs_parse(fc, ffs_fs_fs_parameters, param, &result);
15121508
if (opt < 0)
15131509
return opt;
15141510

@@ -1640,7 +1636,7 @@ static struct file_system_type ffs_fs_type = {
16401636
.owner = THIS_MODULE,
16411637
.name = "functionfs",
16421638
.init_fs_context = ffs_fs_init_fs_context,
1643-
.parameters = &ffs_fs_fs_parameters,
1639+
.parameters = ffs_fs_fs_parameters,
16441640
.kill_sb = ffs_fs_kill_sb,
16451641
};
16461642
MODULE_ALIAS_FS("functionfs");

fs/afs/super.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ static int afs_statfs(struct dentry *dentry, struct kstatfs *buf);
3838
static int afs_show_devname(struct seq_file *m, struct dentry *root);
3939
static int afs_show_options(struct seq_file *m, struct dentry *root);
4040
static int afs_init_fs_context(struct fs_context *fc);
41-
static const struct fs_parameter_description afs_fs_parameters;
41+
static const struct fs_parameter_spec afs_fs_parameters[];
4242

4343
struct file_system_type afs_fs_type = {
4444
.owner = THIS_MODULE,
4545
.name = "afs",
4646
.init_fs_context = afs_init_fs_context,
47-
.parameters = &afs_fs_parameters,
47+
.parameters = afs_fs_parameters,
4848
.kill_sb = afs_kill_super,
4949
.fs_flags = FS_RENAME_DOES_D_MOVE,
5050
};
@@ -81,18 +81,14 @@ static const struct constant_table afs_param_flock[] = {
8181
{}
8282
};
8383

84-
static const struct fs_parameter_spec afs_param_specs[] = {
84+
static const struct fs_parameter_spec afs_fs_parameters[] = {
8585
fsparam_flag ("autocell", Opt_autocell),
8686
fsparam_flag ("dyn", Opt_dyn),
8787
fsparam_enum ("flock", Opt_flock, afs_param_flock),
8888
fsparam_string("source", Opt_source),
8989
{}
9090
};
9191

92-
static const struct fs_parameter_description afs_fs_parameters = {
93-
.specs = afs_param_specs,
94-
};
95-
9692
/*
9793
* initialise the filesystem
9894
*/
@@ -321,7 +317,7 @@ static int afs_parse_param(struct fs_context *fc, struct fs_parameter *param)
321317
struct afs_fs_context *ctx = fc->fs_private;
322318
int opt;
323319

324-
opt = fs_parse(fc, &afs_fs_parameters, param, &result);
320+
opt = fs_parse(fc, afs_fs_parameters, param, &result);
325321
if (opt < 0)
326322
return opt;
327323

fs/ceph/super.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static const struct constant_table ceph_param_recover[] = {
169169
{}
170170
};
171171

172-
static const struct fs_parameter_spec ceph_mount_param_specs[] = {
172+
static const struct fs_parameter_spec ceph_mount_parameters[] = {
173173
fsparam_flag_no ("acl", Opt_acl),
174174
fsparam_flag_no ("asyncreaddir", Opt_asyncreaddir),
175175
fsparam_s32 ("caps_max", Opt_caps_max),
@@ -198,10 +198,6 @@ static const struct fs_parameter_spec ceph_mount_param_specs[] = {
198198
{}
199199
};
200200

201-
static const struct fs_parameter_description ceph_mount_parameters = {
202-
.specs = ceph_mount_param_specs,
203-
};
204-
205201
struct ceph_parse_opts_ctx {
206202
struct ceph_options *copts;
207203
struct ceph_mount_options *opts;
@@ -271,7 +267,7 @@ static int ceph_parse_mount_param(struct fs_context *fc,
271267
if (ret != -ENOPARAM)
272268
return ret;
273269

274-
token = fs_parse(fc, &ceph_mount_parameters, param, &result);
270+
token = fs_parse(fc, ceph_mount_parameters, param, &result);
275271
dout("%s fs_parse '%s' token %d\n", __func__, param->key, token);
276272
if (token < 0)
277273
return token;

fs/fs_parser.c

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,14 @@ int lookup_constant(const struct constant_table *tbl, const char *name, int not_
4747
EXPORT_SYMBOL(lookup_constant);
4848

4949
static const struct fs_parameter_spec *fs_lookup_key(
50-
const struct fs_parameter_description *desc,
50+
const struct fs_parameter_spec *desc,
5151
const char *name)
5252
{
5353
const struct fs_parameter_spec *p;
54-
55-
if (!desc->specs)
54+
if (!desc)
5655
return NULL;
5756

58-
for (p = desc->specs; p->name; p++)
57+
for (p = desc; p->name; p++)
5958
if (strcmp(p->name, name) == 0)
6059
return p;
6160

@@ -81,7 +80,7 @@ static const struct fs_parameter_spec *fs_lookup_key(
8180
* the parameter wasn't recognised and unknowns aren't okay.
8281
*/
8382
int __fs_parse(struct p_log *log,
84-
const struct fs_parameter_description *desc,
83+
const struct fs_parameter_spec *desc,
8584
struct fs_parameter *param,
8685
struct fs_parse_result *result)
8786
{
@@ -355,39 +354,37 @@ bool validate_constant_table(const struct constant_table *tbl, size_t tbl_size,
355354
* @desc: The parameter description to validate.
356355
*/
357356
bool fs_validate_description(const char *name,
358-
const struct fs_parameter_description *desc)
357+
const struct fs_parameter_spec *desc)
359358
{
360359
const struct fs_parameter_spec *param, *p2;
361360
bool good = true;
362361

363362
pr_notice("*** VALIDATE %s ***\n", name);
364363

365-
if (desc->specs) {
366-
for (param = desc->specs; param->name; param++) {
367-
enum fs_parameter_type t = param->type;
364+
for (param = desc; param->name; param++) {
365+
enum fs_parameter_type t = param->type;
368366

369-
/* Check that the type is in range */
370-
if (t == __fs_param_wasnt_defined ||
371-
t >= nr__fs_parameter_type) {
372-
pr_err("VALIDATE %s: PARAM[%s] Bad type %u\n",
373-
name, param->name, t);
367+
/* Check that the type is in range */
368+
if (t == __fs_param_wasnt_defined ||
369+
t >= nr__fs_parameter_type) {
370+
pr_err("VALIDATE %s: PARAM[%s] Bad type %u\n",
371+
name, param->name, t);
372+
good = false;
373+
} else if (t == fs_param_is_enum) {
374+
const struct constant_table *e = param->data;
375+
if (!e || !e->name) {
376+
pr_err("VALIDATE %s: PARAM[%s] enum with no values\n",
377+
name, param->name);
374378
good = false;
375-
} else if (t == fs_param_is_enum) {
376-
const struct constant_table *e = param->data;
377-
if (!e || !e->name) {
378-
pr_err("VALIDATE %s: PARAM[%s] enum with no values\n",
379-
name, param->name);
380-
good = false;
381-
}
382379
}
380+
}
383381

384-
/* Check for duplicate parameter names */
385-
for (p2 = desc->specs; p2 < param; p2++) {
386-
if (strcmp(param->name, p2->name) == 0) {
387-
pr_err("VALIDATE %s: PARAM[%s]: Duplicate\n",
388-
name, param->name);
389-
good = false;
390-
}
382+
/* Check for duplicate parameter names */
383+
for (p2 = desc; p2 < param; p2++) {
384+
if (strcmp(param->name, p2->name) == 0) {
385+
pr_err("VALIDATE %s: PARAM[%s]: Duplicate\n",
386+
name, param->name);
387+
good = false;
391388
}
392389
}
393390
}

fs/fuse/inode.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ enum {
448448
OPT_ERR
449449
};
450450

451-
static const struct fs_parameter_spec fuse_param_specs[] = {
451+
static const struct fs_parameter_spec fuse_fs_parameters[] = {
452452
fsparam_string ("source", OPT_SOURCE),
453453
fsparam_u32 ("fd", OPT_FD),
454454
fsparam_u32oct ("rootmode", OPT_ROOTMODE),
@@ -462,17 +462,13 @@ static const struct fs_parameter_spec fuse_param_specs[] = {
462462
{}
463463
};
464464

465-
static const struct fs_parameter_description fuse_fs_parameters = {
466-
.specs = fuse_param_specs,
467-
};
468-
469465
static int fuse_parse_param(struct fs_context *fc, struct fs_parameter *param)
470466
{
471467
struct fs_parse_result result;
472468
struct fuse_fs_context *ctx = fc->fs_private;
473469
int opt;
474470

475-
opt = fs_parse(fc, &fuse_fs_parameters, param, &result);
471+
opt = fs_parse(fc, fuse_fs_parameters, param, &result);
476472
if (opt < 0)
477473
return opt;
478474

@@ -1346,7 +1342,7 @@ static struct file_system_type fuse_fs_type = {
13461342
.name = "fuse",
13471343
.fs_flags = FS_HAS_SUBTYPE | FS_USERNS_MOUNT,
13481344
.init_fs_context = fuse_init_fs_context,
1349-
.parameters = &fuse_fs_parameters,
1345+
.parameters = fuse_fs_parameters,
13501346
.kill_sb = fuse_kill_sb_anon,
13511347
};
13521348
MODULE_ALIAS_FS("fuse");
@@ -1362,7 +1358,7 @@ static struct file_system_type fuseblk_fs_type = {
13621358
.owner = THIS_MODULE,
13631359
.name = "fuseblk",
13641360
.init_fs_context = fuse_init_fs_context,
1365-
.parameters = &fuse_fs_parameters,
1361+
.parameters = fuse_fs_parameters,
13661362
.kill_sb = fuse_kill_sb_blk,
13671363
.fs_flags = FS_REQUIRES_DEV | FS_HAS_SUBTYPE,
13681364
};

0 commit comments

Comments
 (0)