summaryrefslogtreecommitdiff
path: root/fs/fs_parser.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2019-09-07 07:23:15 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2020-02-07 14:48:37 -0500
commitd7167b149943e38ad610191ecbb0800c78bbced9 (patch)
tree46f4043165c3f0f2aa9aa823dc545d98ece2562b /fs/fs_parser.c
parent96cafb9ccb153f6a82ff2c9bde68916d9d65501e (diff)
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>
Diffstat (limited to 'fs/fs_parser.c')
-rw-r--r--fs/fs_parser.c53
1 files changed, 25 insertions, 28 deletions
diff --git a/fs/fs_parser.c b/fs/fs_parser.c
index 3ed1e49d8267..5f8c06a1fb93 100644
--- a/fs/fs_parser.c
+++ b/fs/fs_parser.c
@@ -47,15 +47,14 @@ int lookup_constant(const struct constant_table *tbl, const char *name, int not_
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;
@@ -81,7 +80,7 @@ static const struct fs_parameter_spec *fs_lookup_key(
* the parameter wasn't recognised and unknowns aren't okay.
*/
int __fs_parse(struct p_log *log,
- const struct fs_parameter_description *desc,
+ const struct fs_parameter_spec *desc,
struct fs_parameter *param,
struct fs_parse_result *result)
{
@@ -355,39 +354,37 @@ 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);
+ /* 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 constant_table *e = param->data;
+ if (!e || !e->name) {
+ pr_err("VALIDATE %s: PARAM[%s] enum with no values\n",
+ name, param->name);
good = false;
- } else if (t == fs_param_is_enum) {
- const struct constant_table *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;
}
}
}