@@ -2047,7 +2047,6 @@ static const struct fs_parameter_spec rdt_param_specs[] = {
};
static const struct fs_parameter_description rdt_fs_parameters = {
- .name = "rdt",
.specs = rdt_param_specs,
};
@@ -90,7 +90,6 @@ static const struct fs_parameter_enum afs_param_enums[] = {
};
static const struct fs_parameter_description afs_fs_parameters = {
- .name = "kAFS",
.specs = afs_param_specs,
.enums = afs_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;
@@ -223,7 +223,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;
}
@@ -343,22 +344,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;
@@ -85,7 +85,6 @@ static const struct fs_parameter_spec hugetlb_param_specs[] = {
};
static const struct fs_parameter_description hugetlb_fs_parameters = {
- .name = "hugetlbfs",
.specs = hugetlb_param_specs,
};
@@ -48,7 +48,6 @@ static const struct fs_parameter_spec proc_param_specs[] = {
};
static const struct fs_parameter_description proc_fs_parameters = {
- .name = "proc",
.specs = proc_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
@@ -918,7 +918,6 @@ static const struct fs_parameter_spec cgroup1_param_specs[] = {
};
const struct fs_parameter_description cgroup1_fs_parameters = {
- .name = "cgroup1",
.specs = cgroup1_param_specs,
};
@@ -1826,7 +1826,6 @@ static const struct fs_parameter_spec cgroup2_param_specs[] = {
};
static const struct fs_parameter_description cgroup2_fs_parameters = {
- .name = "cgroup2",
.specs = cgroup2_param_specs,
};
@@ -2820,7 +2820,6 @@ static const struct fs_parameter_spec selinux_param_specs[] = {
};
static const struct fs_parameter_description selinux_fs_parameters = {
- .name = "SELinux",
.specs = selinux_param_specs,
};
@@ -7021,7 +7020,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;
}
@@ -690,7 +690,6 @@ static const struct fs_parameter_spec smack_param_specs[] = {
};
static const struct fs_parameter_description smack_fs_parameters = {
- .name = "smack",
.specs = smack_param_specs,
};
There doesn't seem to be a strong reason to have another copy of the filesystem name string in the fs_parameter_description structure; it's easy enough to get the name from the fs_type, and using it instead ensures consistency across messages (for example, vfs_parse_fs_param() already uses fc->fs_type->name for the error messages, because it doesn't have the fs_parameter_description). Signed-off-by: Eric Sandeen <sandeen@redhat.com> --- If I'm missing a reason for the separate copy of the string, feel free to nak...