@@ -519,7 +519,6 @@ Parameters are described using structures defined in linux/fs_parser.h.
There's a core description struct that links everything together:
struct fs_parameter_description {
- const char name[16];
const struct fs_parameter_spec *specs;
const struct fs_parameter_enum *enums;
};
@@ -535,19 +534,13 @@ For example:
};
static const struct fs_parameter_description afs_fs_parameters = {
- .name = "kAFS",
.specs = afs_param_specs,
.enums = afs_param_enums,
};
The members are as follows:
- (1) const char name[16];
-
- The name to be used in error messages generated by the parse helper
- functions.
-
- (2) const struct fs_parameter_specification *specs;
+ (1) const struct fs_parameter_specification *specs;
Table of parameter specifications, terminated with a null entry, where the
entries are of type:
@@ -626,7 +619,7 @@ The members are as follows:
of arguments to specify the type and the flags for anything that doesn't
match one of the above macros.
- (6) const struct fs_parameter_enum *enums;
+ (2) const struct fs_parameter_enum *enums;
Table of enum value names to integer mappings, terminated with a null
entry. This is of type:
@@ -592,7 +592,6 @@ enum {
};
static const struct fs_parameter_description spufs_fs_parameters = {
- .name = "spufs",
.specs = spufs_param_specs,
};
@@ -216,7 +216,6 @@ static int hypfs_release(struct inode *inode, struct file *filp)
};
static const struct fs_parameter_description hypfs_fs_parameters = {
- .name = "hypfs",
.specs = hypfs_param_specs,
};
@@ -2045,7 +2045,6 @@ enum rdt_param {
};
static const struct fs_parameter_description rdt_fs_parameters = {
- .name = "rdt",
.specs = rdt_param_specs,
};
@@ -864,7 +864,6 @@ enum {
};
static const struct fs_parameter_description rbd_parameters = {
- .name = "rbd",
.specs = rbd_param_specs,
};
@@ -1497,7 +1497,6 @@ enum {
};
static const struct fs_parameter_description ffs_fs_fs_parameters = {
- .name = "kAFS",
.specs = ffs_fs_param_specs,
};
@@ -90,7 +89,6 @@ enum afs_param {
};
static const struct fs_parameter_description afs_fs_parameters = {
- .name = "kAFS",
.specs = afs_param_specs,
.enums = afs_param_enums,
};
@@ -199,7 +199,6 @@ enum ceph_recover_session_mode {
};
static const struct fs_parameter_description ceph_mount_parameters = {
- .name = "ceph",
.specs = ceph_mount_param_specs,
.enums = ceph_mount_param_enums,
};
@@ -74,7 +74,8 @@ int register_filesystem(struct file_system_type * fs)
int res = 0;
struct file_system_type ** p;
- if (fs->parameters && !fs_validate_description(fs->parameters))
+ if (fs->parameters &&
+ !fs_validate_description(fs->name, fs->parameters))
return -EINVAL;
BUG_ON(strchr(fs->name, '.'));
@@ -111,7 +111,7 @@ int fs_parse(struct fs_context *fc,
if (p->flags & fs_param_deprecated)
warnf(fc, "%s: Deprecated parameter '%s'",
- desc->name, param->key);
+ fc->fs_type->name, param->key);
if (result->negated)
goto okay;
@@ -147,7 +147,7 @@ int fs_parse(struct fs_context *fc,
if (param->type != fs_value_is_flag &&
(param->type != fs_value_is_string || result->has_value))
return invalf(fc, "%s: Unexpected value for '%s'",
- desc->name, param->key);
+ fc->fs_type->name, param->key);
result->boolean = true;
goto okay;
@@ -237,7 +237,8 @@ int fs_parse(struct fs_context *fc,
return p->opt;
bad_value:
- return invalf(fc, "%s: Bad value for '%s'", desc->name, param->key);
+ return invalf(fc, "%s: Bad value for '%s'",
+ fc->fs_type->name, param->key);
unknown_parameter:
return -ENOPARAM;
}
@@ -357,22 +358,16 @@ bool validate_constant_table(const struct constant_table *tbl, size_t tbl_size,
* fs_validate_description - Validate a parameter description
* @desc: The parameter description to validate.
*/
-bool fs_validate_description(const struct fs_parameter_description *desc)
+bool fs_validate_description(const char *name,
+ const struct fs_parameter_description *desc)
{
const struct fs_parameter_spec *param, *p2;
const struct fs_parameter_enum *e;
- const char *name = desc->name;
unsigned int nr_params = 0;
bool good = true, enums = false;
pr_notice("*** VALIDATE %s ***\n", name);
- if (!name[0]) {
- pr_err("VALIDATE Parser: No name\n");
- name = "Unknown";
- good = false;
- }
-
if (desc->specs) {
for (param = desc->specs; param->name; param++) {
enum fs_parameter_type t = param->type;
@@ -463,7 +463,6 @@ enum {
};
static const struct fs_parameter_description fuse_fs_parameters = {
- .name = "fuse",
.specs = fuse_param_specs,
};
@@ -1328,7 +1328,6 @@ enum opt_errors {
};
static const struct fs_parameter_description gfs2_fs_parameters = {
- .name = "gfs2",
.specs = gfs2_param_specs,
.enums = gfs2_param_enums,
};
@@ -85,7 +85,6 @@ enum hugetlb_param {
};
static const struct fs_parameter_description hugetlb_fs_parameters = {
- .name = "hugetlbfs",
.specs = hugetlb_param_specs,
};
@@ -185,7 +185,6 @@ enum {
};
const struct fs_parameter_description jffs2_fs_parameters = {
- .name = "jffs2",
.specs = jffs2_param_specs,
.enums = jffs2_param_enums,
};
@@ -48,7 +48,6 @@ enum proc_param {
};
static const struct fs_parameter_description proc_fs_parameters = {
- .name = "proc",
.specs = proc_param_specs,
};
@@ -187,7 +187,6 @@ enum ramfs_param {
};
const struct fs_parameter_description ramfs_fs_parameters = {
- .name = "ramfs",
.specs = ramfs_param_specs,
};
@@ -107,7 +107,6 @@ enum {
};
static const struct fs_parameter_description xfs_fs_parameters = {
- .name = "xfs",
.specs = xfs_param_specs,
};
@@ -62,7 +62,6 @@ struct fs_parameter_enum {
};
struct fs_parameter_description {
- const char name[16]; /* Name for logging purposes */
const struct fs_parameter_spec *specs; /* List of param specifications */
const struct fs_parameter_enum *enums; /* Enum values */
};
@@ -97,12 +96,14 @@ extern int __lookup_constant(const struct constant_table tbl[], size_t tbl_size,
#ifdef CONFIG_VALIDATE_FS_PARSER
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 struct fs_parameter_description *desc);
+extern bool fs_validate_description(const char *name,
+ const struct fs_parameter_description *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 struct fs_parameter_description *desc)
+static inline bool fs_validate_description(const char *name,
+ const struct fs_parameter_description *desc)
{ return true; }
#endif
@@ -593,7 +593,6 @@ enum {
};
static const struct fs_parameter_description bpf_fs_parameters = {
- .name = "bpf",
.specs = bpf_param_specs,
};
@@ -900,7 +900,6 @@ enum cgroup1_param {
};
const struct fs_parameter_description cgroup1_fs_parameters = {
- .name = "cgroup1",
.specs = cgroup1_param_specs,
};
@@ -1823,7 +1823,6 @@ enum cgroup2_param {
};
static const struct fs_parameter_description cgroup2_fs_parameters = {
- .name = "cgroup2",
.specs = cgroup2_param_specs,
};
@@ -3401,7 +3401,6 @@ enum shmem_param {
};
const struct fs_parameter_description shmem_fs_parameters = {
- .name = "tmpfs",
.specs = shmem_param_specs,
.enums = shmem_param_enums,
};
@@ -291,7 +291,6 @@ enum {
};
static const struct fs_parameter_description ceph_parameters = {
- .name = "libceph",
.specs = ceph_param_specs,
};
@@ -2818,7 +2818,6 @@ static int selinux_fs_context_dup(struct fs_context *fc,
};
static const struct fs_parameter_description selinux_fs_parameters = {
- .name = "SELinux",
.specs = selinux_param_specs,
};
@@ -7145,7 +7144,7 @@ static __init int selinux_init(void)
else
pr_debug("SELinux: Starting in permissive mode\n");
- fs_validate_description(&selinux_fs_parameters);
+ fs_validate_description("selinux", &selinux_fs_parameters);
return 0;
}
@@ -689,7 +689,6 @@ static int smack_fs_context_dup(struct fs_context *fc,
};
static const struct fs_parameter_description smack_fs_parameters = {
- .name = "smack",
.specs = smack_param_specs,
};