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 <viro@zeniv.linux.org.uk>
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index 6e17bca..b8febf0 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -585,7 +585,7 @@ enum { Opt_uid, Opt_gid, Opt_mode, Opt_debug, }; -static const struct fs_parameter_spec spufs_param_specs[] = { +static const struct fs_parameter_spec spufs_fs_parameters[] = { fsparam_u32 ("gid", Opt_gid), fsparam_u32oct ("mode", Opt_mode), fsparam_u32 ("uid", Opt_uid), @@ -593,10 +593,6 @@ static const struct fs_parameter_spec spufs_param_specs[] = { {} }; -static const struct fs_parameter_description spufs_fs_parameters = { - .specs = spufs_param_specs, -}; - static int spufs_show_options(struct seq_file *m, struct dentry *root) { struct spufs_sb_info *sbi = spufs_get_sb_info(root->d_sb); @@ -624,7 +620,7 @@ static int spufs_parse_param(struct fs_context *fc, struct fs_parameter *param) kgid_t gid; int opt; - opt = fs_parse(fc, &spufs_fs_parameters, param, &result); + opt = fs_parse(fc, spufs_fs_parameters, param, &result); if (opt < 0) return opt; @@ -774,7 +770,7 @@ static struct file_system_type spufs_type = { .owner = THIS_MODULE, .name = "spufs", .init_fs_context = spufs_init_fs_context, - .parameters = &spufs_fs_parameters, + .parameters = spufs_fs_parameters, .kill_sb = kill_litter_super, }; MODULE_ALIAS_FS("spufs");
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c index 0784fc4..acab341a 100644 --- a/arch/s390/hypfs/inode.c +++ b/arch/s390/hypfs/inode.c
@@ -209,16 +209,12 @@ static int hypfs_release(struct inode *inode, struct file *filp) enum { Opt_uid, Opt_gid, }; -static const struct fs_parameter_spec hypfs_param_specs[] = { +static const struct fs_parameter_spec hypfs_fs_parameters[] = { fsparam_u32("gid", Opt_gid), fsparam_u32("uid", Opt_uid), {} }; -static const struct fs_parameter_description hypfs_fs_parameters = { - .specs = hypfs_param_specs, -}; - static int hypfs_parse_param(struct fs_context *fc, struct fs_parameter *param) { 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) kgid_t gid; int opt; - opt = fs_parse(fc, &hypfs_fs_parameters, param, &result); + opt = fs_parse(fc, hypfs_fs_parameters, param, &result); if (opt < 0) return opt; @@ -454,7 +450,7 @@ static struct file_system_type hypfs_type = { .owner = THIS_MODULE, .name = "s390_hypfs", .init_fs_context = hypfs_init_fs_context, - .parameters = &hypfs_fs_parameters, + .parameters = hypfs_fs_parameters, .kill_sb = hypfs_kill_super };
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 5999eae23..8210d50 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -2039,24 +2039,20 @@ enum rdt_param { nr__rdt_params }; -static const struct fs_parameter_spec rdt_param_specs[] = { +static const struct fs_parameter_spec rdt_fs_parameters[] = { fsparam_flag("cdp", Opt_cdp), fsparam_flag("cdpl2", Opt_cdpl2), fsparam_flag("mba_MBps", Opt_mba_mbps), {} }; -static const struct fs_parameter_description rdt_fs_parameters = { - .specs = rdt_param_specs, -}; - static int rdt_parse_param(struct fs_context *fc, struct fs_parameter *param) { struct rdt_fs_context *ctx = rdt_fc2context(fc); struct fs_parse_result result; int opt; - opt = fs_parse(fc, &rdt_fs_parameters, param, &result); + opt = fs_parse(fc, rdt_fs_parameters, param, &result); if (opt < 0) return opt; @@ -2281,7 +2277,7 @@ static void rdt_kill_sb(struct super_block *sb) static struct file_system_type rdt_fs_type = { .name = "resctrl", .init_fs_context = rdt_init_fs_context, - .parameters = &rdt_fs_parameters, + .parameters = rdt_fs_parameters, .kill_sb = rdt_kill_sb, };
diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c index b8a5d1e..4c5cc01 100644 --- a/drivers/android/binderfs.c +++ b/drivers/android/binderfs.c
@@ -53,15 +53,11 @@ enum { Opt_max, }; -static const struct fs_parameter_spec binderfs_param_specs[] = { +static const struct fs_parameter_spec binderfs_fs_parameters[] = { fsparam_s32 ("max", Opt_max), {} }; -static const struct fs_parameter_description binderfs_fs_parameters = { - .specs = binderfs_param_specs, -}; - /** * binderfs_info - information about a binderfs mount * @ipc_ns: The ipc namespace the binderfs mount belongs to. @@ -291,7 +287,7 @@ static int binderfs_parse_param(struct fs_context *fc, struct fs_parameter *para struct binderfs_info *info = fc->s_fs_info; int opt; - opt = fs_parse(fc, &binderfs_fs_parameters, param, &result); + opt = fs_parse(fc, binderfs_fs_parameters, param, &result); if (opt < 0) return opt; @@ -550,7 +546,7 @@ static void binderfs_kill_super(struct super_block *sb) static struct file_system_type binder_fs_type = { .name = "binder", .init_fs_context = binderfs_init_fs_context, - .parameters = &binderfs_fs_parameters, + .parameters = binderfs_fs_parameters, .kill_sb = binderfs_kill_super, .fs_flags = FS_USERNS_MOUNT, };
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c index 30d0523..4381f4b 100644 --- a/drivers/base/devtmpfs.c +++ b/drivers/base/devtmpfs.c
@@ -71,10 +71,10 @@ static struct file_system_type internal_fs_type = { .name = "devtmpfs", #ifdef CONFIG_TMPFS .init_fs_context = shmem_init_fs_context, - .parameters = &shmem_fs_parameters, + .parameters = shmem_fs_parameters, #else .init_fs_context = ramfs_init_fs_context, - .parameters = &ramfs_fs_parameters, + .parameters = ramfs_fs_parameters, #endif .kill_sb = kill_litter_super, };
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index d6e118c..6e8f7b2 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c
@@ -1496,7 +1496,7 @@ enum { Opt_gid, }; -static const struct fs_parameter_spec ffs_fs_param_specs[] = { +static const struct fs_parameter_spec ffs_fs_fs_parameters[] = { fsparam_bool ("no_disconnect", Opt_no_disconnect), fsparam_u32 ("rmode", Opt_rmode), fsparam_u32 ("fmode", Opt_fmode), @@ -1506,10 +1506,6 @@ static const struct fs_parameter_spec ffs_fs_param_specs[] = { {} }; -static const struct fs_parameter_description ffs_fs_fs_parameters = { - .specs = ffs_fs_param_specs, -}; - static int ffs_fs_parse_param(struct fs_context *fc, struct fs_parameter *param) { struct ffs_sb_fill_data *data = fc->fs_private; @@ -1518,7 +1514,7 @@ static int ffs_fs_parse_param(struct fs_context *fc, struct fs_parameter *param) ENTER(); - opt = fs_parse(fc, &ffs_fs_fs_parameters, param, &result); + opt = fs_parse(fc, ffs_fs_fs_parameters, param, &result); if (opt < 0) return opt; @@ -1650,7 +1646,7 @@ static struct file_system_type ffs_fs_type = { .owner = THIS_MODULE, .name = "functionfs", .init_fs_context = ffs_fs_init_fs_context, - .parameters = &ffs_fs_fs_parameters, + .parameters = ffs_fs_fs_parameters, .kill_sb = ffs_fs_kill_sb, }; MODULE_ALIAS_FS("functionfs");
diff --git a/fs/afs/super.c b/fs/afs/super.c index 1c21f45..068f1488 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c
@@ -38,13 +38,13 @@ static int afs_statfs(struct dentry *dentry, struct kstatfs *buf); static int afs_show_devname(struct seq_file *m, struct dentry *root); static int afs_show_options(struct seq_file *m, struct dentry *root); static int afs_init_fs_context(struct fs_context *fc); -static const struct fs_parameter_description afs_fs_parameters; +static const struct fs_parameter_spec afs_fs_parameters[]; struct file_system_type afs_fs_type = { .owner = THIS_MODULE, .name = "afs", .init_fs_context = afs_init_fs_context, - .parameters = &afs_fs_parameters, + .parameters = afs_fs_parameters, .kill_sb = afs_kill_super, .fs_flags = FS_RENAME_DOES_D_MOVE, }; @@ -81,7 +81,7 @@ static const struct fs_parameter_enum afs_param_flock[] = { {} }; -static const struct fs_parameter_spec afs_param_specs[] = { +static const struct fs_parameter_spec afs_fs_parameters[] = { fsparam_flag ("autocell", Opt_autocell), fsparam_flag ("dyn", Opt_dyn), fsparam_enum ("flock", Opt_flock, afs_param_flock), @@ -89,10 +89,6 @@ static const struct fs_parameter_spec afs_param_specs[] = { {} }; -static const struct fs_parameter_description afs_fs_parameters = { - .specs = afs_param_specs, -}; - /* * initialise the filesystem */ @@ -321,7 +317,7 @@ static int afs_parse_param(struct fs_context *fc, struct fs_parameter *param) struct afs_fs_context *ctx = fc->fs_private; int opt; - opt = fs_parse(fc, &afs_fs_parameters, param, &result); + opt = fs_parse(fc, afs_fs_parameters, param, &result); if (opt < 0) return opt;
diff --git a/fs/autofs/autofs_i.h b/fs/autofs/autofs_i.h index fce0d6f..dbe3730 100644 --- a/fs/autofs/autofs_i.h +++ b/fs/autofs/autofs_i.h
@@ -25,6 +25,7 @@ #include <linux/completion.h> #include <linux/file.h> #include <linux/magic.h> +#include <linux/fs_parser.h> /* This is the range of ioctl() numbers we claim as ours */ #define AUTOFS_IOC_FIRST AUTOFS_IOC_READY @@ -202,7 +203,7 @@ static inline void managed_dentry_clear_managed(struct dentry *dentry) /* Initializing function */ -extern const struct fs_parameter_description autofs_fs_parameters; +extern const struct fs_parameter_spec autofs_fs_parameters[]; int autofs_init_fs_context(struct fs_context *fc); struct autofs_info *autofs_new_ino(struct autofs_sb_info *); void autofs_clean_ino(struct autofs_info *);
diff --git a/fs/autofs/init.c b/fs/autofs/init.c index 5d9e889..e50692a 100644 --- a/fs/autofs/init.c +++ b/fs/autofs/init.c
@@ -11,7 +11,7 @@ struct file_system_type autofs_fs_type = { .owner = THIS_MODULE, .name = "autofs", .init_fs_context = autofs_init_fs_context, - .parameters = &autofs_fs_parameters, + .parameters = autofs_fs_parameters, .kill_sb = autofs_kill_sb, }; MODULE_ALIAS_FS("autofs");
diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c index 1fdb0c0..96a0279 100644 --- a/fs/autofs/inode.c +++ b/fs/autofs/inode.c
@@ -129,7 +129,7 @@ enum { Opt_uid, }; -static const struct fs_parameter_spec autofs_param_specs[] = { +const struct fs_parameter_spec autofs_fs_parameters[] = { fsparam_flag ("direct", Opt_direct), fsparam_fd ("fd", Opt_fd), fsparam_u32 ("gid", Opt_gid), @@ -144,10 +144,6 @@ static const struct fs_parameter_spec autofs_param_specs[] = { {} }; -const struct fs_parameter_description autofs_fs_parameters = { - .specs = autofs_param_specs, -}; - /* * Open the fd. We do it here rather than in get_tree so that it's done in the * context of the system call that passed the data and not the one that @@ -187,7 +183,7 @@ static int autofs_parse_param(struct fs_context *fc, struct fs_parameter *param) kgid_t gid; int opt; - opt = fs_parse(fc, &autofs_fs_parameters, param, &result); + opt = fs_parse(fc, autofs_fs_parameters, param, &result); if (opt < 0) return opt;
diff --git a/fs/coda/inode.c b/fs/coda/inode.c index ec09e1d..ed0e5fd 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c
@@ -114,15 +114,11 @@ enum { Opt_fd, }; -static const struct fs_parameter_spec coda_param_specs[] = { +static const struct fs_parameter_spec coda_fs_parameters[] = { fsparam_fd ("fd", Opt_fd), {} }; -static const struct fs_parameter_description coda_fs_parameters = { - .specs = coda_param_specs, -}; - static int coda_parse_fd(struct fs_context *fc, int fd) { struct coda_fs_context *ctx = fc->fs_private; @@ -154,7 +150,7 @@ static int coda_parse_param(struct fs_context *fc, struct fs_parameter *param) struct fs_parse_result result; int opt; - opt = fs_parse(fc, &coda_fs_parameters, param, &result); + opt = fs_parse(fc, coda_fs_parameters, param, &result); if (opt < 0) return opt; @@ -380,7 +376,7 @@ struct file_system_type coda_fs_type = { .owner = THIS_MODULE, .name = "coda", .init_fs_context = coda_init_fs_context, - .parameters = &coda_fs_parameters, + .parameters = coda_fs_parameters, .kill_sb = kill_anon_super, .fs_flags = FS_BINARY_MOUNTDATA, };
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 43a44a5..05668bb 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c
@@ -53,17 +53,13 @@ enum { Opt_uid, }; -static const struct fs_parameter_spec debugfs_param_specs[] = { +static const struct fs_parameter_spec debugfs_fs_parameters[] = { fsparam_u32 ("gid", Opt_gid), fsparam_u32oct ("mode", Opt_mode), fsparam_u32 ("uid", Opt_uid), {} }; -static const struct fs_parameter_description debugfs_fs_parameters = { - .specs = debugfs_param_specs, -}; - struct debugfs_fs_info { kuid_t uid; kgid_t gid; @@ -78,7 +74,7 @@ static int debugfs_parse_param(struct fs_context *fc, struct fs_parameter *param kgid_t gid; int opt; - opt = fs_parse(fc, &debugfs_fs_parameters, param, &result); + opt = fs_parse(fc, debugfs_fs_parameters, param, &result); if (opt < 0) return opt; @@ -228,7 +224,7 @@ static struct file_system_type debug_fs_type = { .owner = THIS_MODULE, .name = "debugfs", .init_fs_context = debugfs_init_fs_context, - .parameters = &debugfs_fs_parameters, + .parameters = debugfs_fs_parameters, .kill_sb = kill_litter_super, }; MODULE_ALIAS_FS("debugfs");
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 7b86272..ad21a61 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c
@@ -107,7 +107,7 @@ enum { Opt_err }; -static const struct fs_parameter_spec devpts_param_specs[] = { +static const struct fs_parameter_spec devpts_fs_parameters[] = { fsparam_u32 ("gid", Opt_gid), fsparam_s32 ("max", Opt_max), fsparam_u32oct ("mode", Opt_mode), @@ -117,10 +117,6 @@ static const struct fs_parameter_spec devpts_param_specs[] = { {} }; -static const struct fs_parameter_description devpts_fs_parameters = { - .specs = devpts_param_specs, -}; - struct pts_fs_info { struct ida allocated_ptys; struct pts_mount_opts mount_opts; @@ -250,7 +246,7 @@ static int devpts_parse_param(struct fs_context *fc, struct fs_parameter *param) kgid_t gid; int opt; - opt = fs_parse(fc, &devpts_fs_parameters, param, &result); + opt = fs_parse(fc, devpts_fs_parameters, param, &result); if (opt < 0) return opt; @@ -499,7 +495,7 @@ static void devpts_kill_sb(struct super_block *sb) static struct file_system_type devpts_fs_type = { .name = "devpts", .init_fs_context = devpts_init_fs_context, - .parameters = &devpts_fs_parameters, + .parameters = devpts_fs_parameters, .kill_sb = devpts_kill_sb, .fs_flags = FS_USERNS_MOUNT, };
diff --git a/fs/fs_parser.c b/fs/fs_parser.c index 59e2653..d3e51904 100644 --- a/fs/fs_parser.c +++ b/fs/fs_parser.c
@@ -43,15 +43,14 @@ int __lookup_constant(const struct constant_table *tbl, size_t tbl_size, EXPORT_SYMBOL(__lookup_constant); static const struct fs_parameter_spec *fs_lookup_key( - const struct fs_parameter_description *desc, + const struct fs_parameter_spec *desc, const char *name) { const struct fs_parameter_spec *p; - - if (!desc->specs) + if (!desc) return NULL; - for (p = desc->specs; p->name; p++) + for (p = desc; p->name; p++) if (strcmp(p->name, name) == 0) return p; @@ -77,7 +76,7 @@ static const struct fs_parameter_spec *fs_lookup_key( * the parameter wasn't recognised and unknowns aren't okay. */ int fs_parse(struct fs_context *fc, - const struct fs_parameter_description *desc, + const struct fs_parameter_spec *desc, struct fs_parameter *param, struct fs_parse_result *result) { @@ -358,38 +357,36 @@ bool validate_constant_table(const struct constant_table *tbl, size_t tbl_size, * @desc: The parameter description to validate. */ bool fs_validate_description(const char *name, - const struct fs_parameter_description *desc) + const struct fs_parameter_spec *desc) { const struct fs_parameter_spec *param, *p2; bool good = true; pr_notice("*** VALIDATE %s ***\n", name); - if (desc->specs) { - for (param = desc->specs; param->name; param++) { - enum fs_parameter_type t = param->type; + for (param = desc; param->name; param++) { + enum fs_parameter_type t = param->type; - /* Check that the type is in range */ - if (t == __fs_param_wasnt_defined || - t >= nr__fs_parameter_type) { - pr_err("VALIDATE %s: PARAM[%s] Bad type %u\n", - name, param->name, t); - good = false; - } else if (t == fs_param_is_enum) { - const struct fs_parameter_enum *e = param->data; - if (!e || !e->name) - pr_err("VALIDATE %s: PARAM[%s] enum with no values\n", - name, param->name); - good = false; - } + /* Check that the type is in range */ + if (t == __fs_param_wasnt_defined || + t >= nr__fs_parameter_type) { + pr_err("VALIDATE %s: PARAM[%s] Bad type %u\n", + name, param->name, t); + good = false; + } else if (t == fs_param_is_enum) { + const struct fs_parameter_enum *e = param->data; + if (!e || !e->name) + pr_err("VALIDATE %s: PARAM[%s] enum with no values\n", + name, param->name); + good = false; + } - /* Check for duplicate parameter names */ - for (p2 = desc->specs; p2 < param; p2++) { - if (strcmp(param->name, p2->name) == 0) { - pr_err("VALIDATE %s: PARAM[%s]: Duplicate\n", - name, param->name); - good = false; - } + /* Check for duplicate parameter names */ + for (p2 = desc; p2 < param; p2++) { + if (strcmp(param->name, p2->name) == 0) { + pr_err("VALIDATE %s: PARAM[%s]: Duplicate\n", + name, param->name); + good = false; } } }
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 05dff78..e22c532 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c
@@ -1306,7 +1306,7 @@ static const struct fs_parameter_enum gfs2_param_errors[] = { {} }; -static const struct fs_parameter_spec gfs2_param_specs[] = { +static const struct fs_parameter_spec gfs2_fs_parameters[] = { fsparam_string ("lockproto", Opt_lockproto), fsparam_string ("locktable", Opt_locktable), fsparam_string ("hostdata", Opt_hostdata), @@ -1336,10 +1336,6 @@ static const struct fs_parameter_spec gfs2_param_specs[] = { {} }; -const struct fs_parameter_description gfs2_fs_parameters = { - .specs = gfs2_param_specs, -}; - /* Parse a single mount parameter */ static int gfs2_parse_param(struct fs_context *fc, struct fs_parameter *param) { @@ -1347,7 +1343,7 @@ static int gfs2_parse_param(struct fs_context *fc, struct fs_parameter *param) struct fs_parse_result result; int o; - o = fs_parse(fc, &gfs2_fs_parameters, param, &result); + o = fs_parse(fc, gfs2_fs_parameters, param, &result); if (o < 0) return o; @@ -1642,7 +1638,7 @@ struct file_system_type gfs2_fs_type = { .name = "gfs2", .fs_flags = FS_REQUIRES_DEV, .init_fs_context = gfs2_init_fs_context, - .parameters = &gfs2_fs_parameters, + .parameters = gfs2_fs_parameters, .kill_sb = gfs2_kill_sb, .owner = THIS_MODULE, };
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 67b76e0..2810637 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c
@@ -73,7 +73,7 @@ enum hugetlb_param { Opt_uid, }; -static const struct fs_parameter_spec hugetlb_param_specs[] = { +static const struct fs_parameter_spec hugetlb_fs_parameters[] = { fsparam_u32 ("gid", Opt_gid), fsparam_string("min_size", Opt_min_size), fsparam_u32 ("mode", Opt_mode), @@ -84,10 +84,6 @@ static const struct fs_parameter_spec hugetlb_param_specs[] = { {} }; -static const struct fs_parameter_description hugetlb_fs_parameters = { - .specs = hugetlb_param_specs, -}; - #ifdef CONFIG_NUMA static inline void hugetlb_set_vma_policy(struct vm_area_struct *vma, struct inode *inode, pgoff_t index) @@ -1150,7 +1146,7 @@ static int hugetlbfs_parse_param(struct fs_context *fc, struct fs_parameter *par unsigned long ps; int opt; - opt = fs_parse(fc, &hugetlb_fs_parameters, param, &result); + opt = fs_parse(fc, hugetlb_fs_parameters, param, &result); if (opt < 0) return opt; @@ -1337,7 +1333,7 @@ static int hugetlbfs_init_fs_context(struct fs_context *fc) static struct file_system_type hugetlbfs_fs_type = { .name = "hugetlbfs", .init_fs_context = hugetlbfs_init_fs_context, - .parameters = &hugetlb_fs_parameters, + .parameters = hugetlb_fs_parameters, .kill_sb = kill_litter_super, };
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 939aa36..c95dce1 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c
@@ -179,24 +179,20 @@ static const struct fs_parameter_enum jffs2_param_compr[] = { {} }; -static const struct fs_parameter_spec jffs2_param_specs[] = { +static const struct fs_parameter_spec jffs2_fs_parameters[] = { fsparam_string ("source", Opt_source), fsparam_enum ("compr", Opt_override_compr, jffs2_param_compr), fsparam_u32 ("rp_size", Opt_rp_size), {} }; -const struct fs_parameter_description jffs2_fs_parameters = { - .specs = jffs2_param_specs, -}; - static int jffs2_parse_param(struct fs_context *fc, struct fs_parameter *param) { struct fs_parse_result result; struct jffs2_sb_info *c = fc->s_fs_info; int opt; - opt = fs_parse(fc, &jffs2_fs_parameters, param, &result); + opt = fs_parse(fc, jffs2_fs_parameters, param, &result); if (opt < 0) return opt; @@ -339,7 +335,7 @@ static struct file_system_type jffs2_fs_type = { .owner = THIS_MODULE, .name = "jffs2", .init_fs_context = jffs2_init_fs_context, - .parameters = &jffs2_fs_parameters, + .parameters = jffs2_fs_parameters, .kill_sb = jffs2_kill_sb, }; MODULE_ALIAS_FS("jffs2");
diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h index 58158d2..570f5b1 100644 --- a/fs/orangefs/orangefs-kernel.h +++ b/fs/orangefs/orangefs-kernel.h
@@ -342,7 +342,7 @@ void purge_waiting_ops(void); * defined in super.c */ extern uint64_t orangefs_features; -extern const struct fs_parameter_description orangefs_fs_parameters; +extern const struct fs_parameter_spec orangefs_fs_parameters[]; int orangefs_init_fs_context(struct fs_context *fc);
diff --git a/fs/orangefs/orangefs-mod.c b/fs/orangefs/orangefs-mod.c index e48d74f..db11505 100644 --- a/fs/orangefs/orangefs-mod.c +++ b/fs/orangefs/orangefs-mod.c
@@ -47,7 +47,7 @@ MODULE_PARM_DESC(hash_table_size, static struct file_system_type orangefs_fs_type = { .name = "pvfs2", .init_fs_context = orangefs_init_fs_context, - .parameters = &orangefs_fs_parameters, + .parameters = orangefs_fs_parameters, .kill_sb = orangefs_kill_sb, .owner = THIS_MODULE, };
diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c index 4ddfd6f..3f068f9 100644 --- a/fs/orangefs/super.c +++ b/fs/orangefs/super.c
@@ -25,17 +25,13 @@ enum orangefs_param { Opt_local_lock, }; -static const struct fs_parameter_spec orangefs_param_specs[] = { +const struct fs_parameter_spec orangefs_fs_parameters[] = { fsparam_flag ("acl", Opt_acl), fsparam_flag ("intr", Opt_intr), fsparam_flag ("local_lock", Opt_local_lock), {} }; -const struct fs_parameter_description orangefs_fs_parameters = { - .specs = orangefs_param_specs, -}; - uint64_t orangefs_features; static int orangefs_show_options(struct seq_file *m, struct dentry *root) @@ -57,7 +53,7 @@ static int orangefs_parse_param(struct fs_context *fc, struct fs_parameter *para struct fs_parse_result result; int opt; - opt = fs_parse(fc, &orangefs_fs_parameters, param, &result); + opt = fs_parse(fc, orangefs_fs_parameters, param, &result); if (opt < 0) return opt;
diff --git a/fs/proc/root.c b/fs/proc/root.c index c447654..6a5825e 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c
@@ -41,23 +41,19 @@ enum proc_param { Opt_hidepid, }; -static const struct fs_parameter_spec proc_param_specs[] = { +static const struct fs_parameter_spec proc_fs_parameters[] = { fsparam_u32("gid", Opt_gid), fsparam_u32("hidepid", Opt_hidepid), {} }; -static const struct fs_parameter_description proc_fs_parameters = { - .specs = proc_param_specs, -}; - static int proc_parse_param(struct fs_context *fc, struct fs_parameter *param) { struct proc_fs_context *ctx = fc->fs_private; struct fs_parse_result result; int opt; - opt = fs_parse(fc, &proc_fs_parameters, param, &result); + opt = fs_parse(fc, proc_fs_parameters, param, &result); if (opt < 0) return opt; @@ -206,7 +202,7 @@ static void proc_kill_sb(struct super_block *sb) static struct file_system_type proc_fs_type = { .name = "proc", .init_fs_context = proc_init_fs_context, - .parameters = &proc_fs_parameters, + .parameters = proc_fs_parameters, .kill_sb = proc_kill_sb, .fs_flags = FS_USERNS_MOUNT | FS_DISALLOW_NOTIFY_PERM, };
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index e1274ca..a6f7b7c 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c
@@ -223,22 +223,18 @@ enum { Opt_kmsg_bytes, }; -static const struct fs_parameter_spec pstore_param_specs[] = { +static const struct fs_parameter_spec pstore_fs_parameters[] = { fsparam_u32 ("kmsg_bytes", Opt_kmsg_bytes), {} }; -static const struct fs_parameter_description pstore_fs_parameters = { - .specs = pstore_param_specs, -}; - static int pstore_parse_param(struct fs_context *fc, struct fs_parameter *param) { struct pstore_fs_context *ctx = fc->fs_private; struct fs_parse_result result; int opt; - opt = fs_parse(fc, &pstore_fs_parameters, param, &result); + opt = fs_parse(fc, pstore_fs_parameters, param, &result); if (opt < 0) return opt; @@ -453,7 +449,7 @@ static struct file_system_type pstore_fs_type = { .owner = THIS_MODULE, .name = "pstore", .init_fs_context = pstore_init_fs_context, - .parameters = &pstore_fs_parameters, + .parameters = pstore_fs_parameters, .kill_sb = pstore_kill_sb, };
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c index bb7ab56..ee179a8 100644 --- a/fs/ramfs/inode.c +++ b/fs/ramfs/inode.c
@@ -181,22 +181,18 @@ enum ramfs_param { Opt_mode, }; -static const struct fs_parameter_spec ramfs_param_specs[] = { +const struct fs_parameter_spec ramfs_fs_parameters[] = { fsparam_u32oct("mode", Opt_mode), {} }; -const struct fs_parameter_description ramfs_fs_parameters = { - .specs = ramfs_param_specs, -}; - static int ramfs_parse_param(struct fs_context *fc, struct fs_parameter *param) { struct fs_parse_result result; struct ramfs_fs_info *fsi = fc->s_fs_info; int opt; - opt = fs_parse(fc, &ramfs_fs_parameters, param, &result); + opt = fs_parse(fc, ramfs_fs_parameters, param, &result); if (opt < 0) { /* * We might like to report bad mount options here; @@ -277,7 +273,7 @@ static void ramfs_kill_sb(struct super_block *sb) static struct file_system_type ramfs_fs_type = { .name = "ramfs", .init_fs_context = ramfs_init_fs_context, - .parameters = &ramfs_fs_parameters, + .parameters = ramfs_fs_parameters, .kill_sb = ramfs_kill_sb, .fs_flags = FS_USERNS_MOUNT, };
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index 073b691..bc29cf5 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c
@@ -147,17 +147,13 @@ enum { Opt_uid, }; -static const struct fs_parameter_spec tracefs_param_specs[] = { +static const struct fs_parameter_spec tracefs_fs_parameters[] = { fsparam_u32 ("gid", Opt_gid), fsparam_u32oct ("mode", Opt_mode), fsparam_u32 ("uid", Opt_uid), {} }; -static const struct fs_parameter_description tracefs_fs_parameters = { - .specs = tracefs_param_specs, -}; - static int tracefs_parse_param(struct fs_context *fc, struct fs_parameter *param) { struct tracefs_fs_info *opts = fc->s_fs_info; @@ -166,7 +162,7 @@ static int tracefs_parse_param(struct fs_context *fc, struct fs_parameter *param kgid_t gid; int opt; - opt = fs_parse(fc, &tracefs_fs_parameters, param, &result); + opt = fs_parse(fc, tracefs_fs_parameters, param, &result); if (opt < 0) return opt; @@ -287,7 +283,7 @@ static struct file_system_type trace_fs_type = { .owner = THIS_MODULE, .name = "tracefs", .init_fs_context = tracefs_init_fs_context, - .parameters = &tracefs_fs_parameters, + .parameters = tracefs_fs_parameters, .kill_sb = kill_litter_super, }; MODULE_ALIAS_FS("tracefs");
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index a4f704f..14813cc 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c
@@ -955,7 +955,7 @@ static const struct fs_parameter_enum ubifs_param_assert[] = { {} }; -static const struct fs_parameter_spec ubifs_param_specs[] = { +static const struct fs_parameter_spec ubifs_fs_parameters[] = { fsparam_flag ("fast_unmount", Opt_fast_unmount), fsparam_flag ("norm_unmount", Opt_norm_unmount), fsparam_flag ("bulk_read", Opt_bulk_read), @@ -971,10 +971,6 @@ static const struct fs_parameter_spec ubifs_param_specs[] = { {} }; -static const struct fs_parameter_description ubifs_fs_parameters = { - .specs = ubifs_param_specs, -}; - /** * ubifs_parse_param - parse a parameter. * @c: UBIFS file-system description object @@ -990,7 +986,7 @@ static int ubifs_parse_param(struct fs_context *fc, struct fs_parameter *param) struct fs_parse_result result; int opt; - opt = fs_parse(fc, &ubifs_fs_parameters, param, &result); + opt = fs_parse(fc, ubifs_fs_parameters, param, &result); if (opt < 0) return opt; @@ -2237,7 +2233,7 @@ static struct file_system_type ubifs_fs_type = { .name = "ubifs", .owner = THIS_MODULE, .init_fs_context = ubifs_init_fs_context, - .parameters = &ubifs_fs_parameters, + .parameters = ubifs_fs_parameters, .kill_sb = kill_ubifs_super, }; MODULE_ALIAS_FS("ubifs");
diff --git a/include/linux/fs.h b/include/linux/fs.h index d66d359..ee59ff7 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h
@@ -65,7 +65,7 @@ struct iov_iter; struct fscrypt_info; struct fscrypt_operations; struct fs_context; -struct fs_parameter_description; +struct fs_parameter_spec; extern void __init inode_init(void); extern void __init inode_init_early(void); @@ -2190,7 +2190,7 @@ struct file_system_type { #define FS_DISALLOW_NOTIFY_PERM 16 /* Disable fanotify permission events */ #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ int (*init_fs_context)(struct fs_context *); - const struct fs_parameter_description *parameters; + const struct fs_parameter_spec *parameters; struct dentry *(*mount) (struct file_system_type *, int, const char *, void *); void (*kill_sb) (struct super_block *);
diff --git a/include/linux/fs_parser.h b/include/linux/fs_parser.h index 10be3672..7d11da7 100644 --- a/include/linux/fs_parser.h +++ b/include/linux/fs_parser.h
@@ -61,10 +61,6 @@ struct fs_parameter_enum { u8 value; }; -struct fs_parameter_description { - const struct fs_parameter_spec *specs; /* List of param specifications */ -}; - /* * Result of parse. */ @@ -80,7 +76,7 @@ struct fs_parse_result { }; extern int fs_parse(struct fs_context *fc, - const struct fs_parameter_description *desc, + const struct fs_parameter_spec *desc, struct fs_parameter *value, struct fs_parse_result *result); extern int fs_lookup_param(struct fs_context *fc, @@ -96,13 +92,13 @@ extern int __lookup_constant(const struct constant_table tbl[], size_t tbl_size, extern bool validate_constant_table(const struct constant_table *tbl, size_t tbl_size, int low, int high, int special); extern bool fs_validate_description(const char *name, - const struct fs_parameter_description *desc); + const struct fs_parameter_spec *desc); #else static inline bool validate_constant_table(const struct constant_table *tbl, size_t tbl_size, int low, int high, int special) { return true; } static inline bool fs_validate_description(const char *name, - const struct fs_parameter_description *desc) + const struct fs_parameter_spec *desc) { return true; } #endif
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h index b806a0f..917528d 100644 --- a/include/linux/ramfs.h +++ b/include/linux/ramfs.h
@@ -2,6 +2,8 @@ #ifndef _LINUX_RAMFS_H #define _LINUX_RAMFS_H +#include <linux/fs_parser.h> // bleh... + struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir, umode_t mode, dev_t dev); extern int ramfs_init_fs_context(struct fs_context *fc); @@ -16,7 +18,7 @@ ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize) extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize); #endif -extern const struct fs_parameter_description ramfs_fs_parameters; +extern const struct fs_parameter_spec ramfs_fs_parameters[]; extern const struct file_operations ramfs_file_operations; extern const struct vm_operations_struct generic_file_vm_ops;
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index de8e4b7..d56fefe 100644 --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h
@@ -8,6 +8,7 @@ #include <linux/pagemap.h> #include <linux/percpu_counter.h> #include <linux/xattr.h> +#include <linux/fs_parser.h> /* inode in-kernel data */ @@ -49,7 +50,7 @@ static inline struct shmem_inode_info *SHMEM_I(struct inode *inode) /* * Functions in mm/shmem.c called directly from elsewhere: */ -extern const struct fs_parameter_description shmem_fs_parameters; +extern const struct fs_parameter_spec shmem_fs_parameters[]; extern int shmem_init(void); extern int shmem_init_fs_context(struct fs_context *fc); extern struct file *shmem_file_setup(const char *name,
diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c index fedebfb..2e1327b 100644 --- a/kernel/bpf/inode.c +++ b/kernel/bpf/inode.c
@@ -586,15 +586,11 @@ enum { OPT_MODE, }; -static const struct fs_parameter_spec bpf_param_specs[] = { +static const struct fs_parameter_spec bpf_fs_parameters[] = { fsparam_u32oct ("mode", OPT_MODE), {} }; -static const struct fs_parameter_description bpf_fs_parameters = { - .specs = bpf_param_specs, -}; - struct bpf_mount_opts { umode_t mode; }; @@ -605,7 +601,7 @@ static int bpf_parse_param(struct fs_context *fc, struct fs_parameter *param) struct fs_parse_result result; int opt; - opt = fs_parse(fc, &bpf_fs_parameters, param, &result); + opt = fs_parse(fc, bpf_fs_parameters, param, &result); if (opt < 0) /* We might like to report bad mount options here, but * traditionally we've ignored all mount options, so we'd @@ -681,7 +677,7 @@ static struct file_system_type bpf_fs_type = { .owner = THIS_MODULE, .name = "bpf", .init_fs_context = bpf_init_fs_context, - .parameters = &bpf_fs_parameters, + .parameters = bpf_fs_parameters, .kill_sb = kill_litter_super, };
diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h index 809e34a3..34821b3 100644 --- a/kernel/cgroup/cgroup-internal.h +++ b/kernel/cgroup/cgroup-internal.h
@@ -7,7 +7,7 @@ #include <linux/workqueue.h> #include <linux/list.h> #include <linux/refcount.h> -#include <linux/fs_context.h> +#include <linux/fs_parser.h> #define TRACE_CGROUP_PATH_LEN 1024 extern spinlock_t trace_cgroup_path_lock; @@ -264,7 +264,7 @@ extern const struct proc_ns_operations cgroupns_operations; */ extern struct cftype cgroup1_base_files[]; extern struct kernfs_syscall_ops cgroup1_kf_syscall_ops; -extern const struct fs_parameter_description cgroup1_fs_parameters; +extern const struct fs_parameter_spec cgroup1_fs_parameters[]; int proc_cgroupstats_show(struct seq_file *m, void *v); bool cgroup1_ssid_disabled(int ssid);
diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index 9a317f0..2904dd5 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c
@@ -905,7 +905,7 @@ enum cgroup1_param { Opt_xattr, }; -static const struct fs_parameter_spec cgroup1_param_specs[] = { +const struct fs_parameter_spec cgroup1_fs_parameters[] = { fsparam_flag ("all", Opt_all), fsparam_flag ("clone_children", Opt_clone_children), fsparam_flag ("cpuset_v2_mode", Opt_cpuset_v2_mode), @@ -917,10 +917,6 @@ static const struct fs_parameter_spec cgroup1_param_specs[] = { {} }; -const struct fs_parameter_description cgroup1_fs_parameters = { - .specs = cgroup1_param_specs, -}; - int cgroup1_parse_param(struct fs_context *fc, struct fs_parameter *param) { struct cgroup_fs_context *ctx = cgroup_fc2context(fc); @@ -928,7 +924,7 @@ int cgroup1_parse_param(struct fs_context *fc, struct fs_parameter *param) struct fs_parse_result result; int opt, i; - opt = fs_parse(fc, &cgroup1_fs_parameters, param, &result); + opt = fs_parse(fc, cgroup1_fs_parameters, param, &result); if (opt == -ENOPARAM) { if (strcmp(param->key, "source") == 0) { fc->source = param->string;
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index ee3a84a..d00dc17 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c
@@ -1819,23 +1819,19 @@ enum cgroup2_param { nr__cgroup2_params }; -static const struct fs_parameter_spec cgroup2_param_specs[] = { +static const struct fs_parameter_spec cgroup2_fs_parameters[] = { fsparam_flag("nsdelegate", Opt_nsdelegate), fsparam_flag("memory_localevents", Opt_memory_localevents), {} }; -static const struct fs_parameter_description cgroup2_fs_parameters = { - .specs = cgroup2_param_specs, -}; - static int cgroup2_parse_param(struct fs_context *fc, struct fs_parameter *param) { struct cgroup_fs_context *ctx = cgroup_fc2context(fc); struct fs_parse_result result; int opt; - opt = fs_parse(fc, &cgroup2_fs_parameters, param, &result); + opt = fs_parse(fc, cgroup2_fs_parameters, param, &result); if (opt < 0) return opt; @@ -2228,7 +2224,7 @@ static void cgroup_kill_sb(struct super_block *sb) struct file_system_type cgroup_fs_type = { .name = "cgroup", .init_fs_context = cgroup_init_fs_context, - .parameters = &cgroup1_fs_parameters, + .parameters = cgroup1_fs_parameters, .kill_sb = cgroup_kill_sb, .fs_flags = FS_USERNS_MOUNT, }; @@ -2236,7 +2232,7 @@ struct file_system_type cgroup_fs_type = { static struct file_system_type cgroup2_fs_type = { .name = "cgroup2", .init_fs_context = cgroup_init_fs_context, - .parameters = &cgroup2_fs_parameters, + .parameters = cgroup2_fs_parameters, .kill_sb = cgroup_kill_sb, .fs_flags = FS_USERNS_MOUNT, };
diff --git a/mm/shmem.c b/mm/shmem.c index 666f16f..5727cbf 100644 --- a/mm/shmem.c +++ b/mm/shmem.c
@@ -3425,7 +3425,7 @@ static const struct fs_parameter_enum shmem_param_enums_huge[] = { {} }; -static const struct fs_parameter_spec shmem_param_specs[] = { +const struct fs_parameter_spec shmem_fs_parameters[] = { fsparam_u32 ("gid", Opt_gid), fsparam_enum ("huge", Opt_huge, shmem_param_enums_huge), fsparam_u32oct("mode", Opt_mode), @@ -3437,10 +3437,6 @@ static const struct fs_parameter_spec shmem_param_specs[] = { {} }; -const struct fs_parameter_description shmem_fs_parameters = { - .specs = shmem_param_specs, -}; - static void shmem_apply_options(struct shmem_sb_info *sbinfo, struct fs_context *fc, unsigned long inodes_in_use) @@ -3481,7 +3477,7 @@ static int shmem_parse_param(struct fs_context *fc, struct fs_parameter *param) char *rest; int opt; - opt = fs_parse(fc, &shmem_fs_parameters, param, &result); + opt = fs_parse(fc, shmem_fs_parameters, param, &result); if (opt < 0) return opt; @@ -3887,7 +3883,7 @@ static struct file_system_type shmem_fs_type = { .name = "tmpfs", .init_fs_context = shmem_init_fs_context, #ifdef CONFIG_TMPFS - .parameters = &shmem_fs_parameters, + .parameters = shmem_fs_parameters, #endif .kill_sb = kill_litter_super, .fs_flags = FS_USERNS_MOUNT, @@ -4033,7 +4029,7 @@ bool shmem_huge_enabled(struct vm_area_struct *vma) static struct file_system_type shmem_fs_type = { .name = "tmpfs", .init_fs_context = ramfs_init_fs_context, - .parameters = &ramfs_fs_parameters, + .parameters = ramfs_fs_parameters, .kill_sb = kill_litter_super, .fs_flags = FS_USERNS_MOUNT, };
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 9e45cf9..6381aff 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c
@@ -2810,7 +2810,7 @@ static int selinux_fs_context_dup(struct fs_context *fc, return 0; } -static const struct fs_parameter_spec selinux_param_specs[] = { +static const struct fs_parameter_spec selinux_fs_parameters[] = { fsparam_string(CONTEXT_STR, Opt_context), fsparam_string(DEFCONTEXT_STR, Opt_defcontext), fsparam_string(FSCONTEXT_STR, Opt_fscontext), @@ -2819,17 +2819,13 @@ static const struct fs_parameter_spec selinux_param_specs[] = { {} }; -static const struct fs_parameter_description selinux_fs_parameters = { - .specs = selinux_param_specs, -}; - static int selinux_fs_context_parse_param(struct fs_context *fc, struct fs_parameter *param) { struct fs_parse_result result; int opt, rc; - opt = fs_parse(fc, &selinux_fs_parameters, param, &result); + opt = fs_parse(fc, selinux_fs_parameters, param, &result); if (opt < 0) return opt; @@ -7020,7 +7016,7 @@ static __init int selinux_init(void) else pr_debug("SELinux: Starting in permissive mode\n"); - fs_validate_description("selinux", &selinux_fs_parameters); + fs_validate_description("selinux", selinux_fs_parameters); return 0; }
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 87d9e4a..546c311 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c
@@ -679,7 +679,7 @@ static int smack_fs_context_dup(struct fs_context *fc, return 0; } -static const struct fs_parameter_spec smack_param_specs[] = { +static const struct fs_parameter_spec smack_fs_parameters[] = { fsparam_string("smackfsdef", Opt_fsdefault), fsparam_string("smackfsdefault", Opt_fsdefault), fsparam_string("smackfsfloor", Opt_fsfloor), @@ -689,10 +689,6 @@ static const struct fs_parameter_spec smack_param_specs[] = { {} }; -static const struct fs_parameter_description smack_fs_parameters = { - .specs = smack_param_specs, -}; - /** * smack_fs_context_parse_param - Parse a single mount parameter * @fc: The new filesystem context being constructed. @@ -707,7 +703,7 @@ static int smack_fs_context_parse_param(struct fs_context *fc, struct fs_parse_result result; int opt, rc; - opt = fs_parse(fc, &smack_fs_parameters, param, &result); + opt = fs_parse(fc, smack_fs_parameters, param, &result); if (opt < 0) return opt;