Commit 210c104c authored by Ilya Dryomov's avatar Ilya Dryomov

rbd: terminate rbd_opts_tokens with Opt_err

Also nuke useless Opt_last_bool and don't break lines unnecessarily.
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
Reviewed-by: default avatarAlex Elder <elder@linaro.org>
parent e1966b49
...@@ -724,7 +724,7 @@ static struct rbd_client *rbd_client_find(struct ceph_options *ceph_opts) ...@@ -724,7 +724,7 @@ static struct rbd_client *rbd_client_find(struct ceph_options *ceph_opts)
} }
/* /*
* mount options * (Per device) rbd map options
*/ */
enum { enum {
Opt_last_int, Opt_last_int,
...@@ -733,8 +733,7 @@ enum { ...@@ -733,8 +733,7 @@ enum {
/* string args above */ /* string args above */
Opt_read_only, Opt_read_only,
Opt_read_write, Opt_read_write,
/* Boolean args above */ Opt_err
Opt_last_bool,
}; };
static match_table_t rbd_opts_tokens = { static match_table_t rbd_opts_tokens = {
...@@ -744,8 +743,7 @@ static match_table_t rbd_opts_tokens = { ...@@ -744,8 +743,7 @@ static match_table_t rbd_opts_tokens = {
{Opt_read_only, "ro"}, /* Alternate spelling */ {Opt_read_only, "ro"}, /* Alternate spelling */
{Opt_read_write, "read_write"}, {Opt_read_write, "read_write"},
{Opt_read_write, "rw"}, /* Alternate spelling */ {Opt_read_write, "rw"}, /* Alternate spelling */
/* Boolean args above */ {Opt_err, NULL}
{-1, NULL}
}; };
struct rbd_options { struct rbd_options {
...@@ -761,22 +759,15 @@ static int parse_rbd_opts_token(char *c, void *private) ...@@ -761,22 +759,15 @@ static int parse_rbd_opts_token(char *c, void *private)
int token, intval, ret; int token, intval, ret;
token = match_token(c, rbd_opts_tokens, argstr); token = match_token(c, rbd_opts_tokens, argstr);
if (token < 0)
return -EINVAL;
if (token < Opt_last_int) { if (token < Opt_last_int) {
ret = match_int(&argstr[0], &intval); ret = match_int(&argstr[0], &intval);
if (ret < 0) { if (ret < 0) {
pr_err("bad mount option arg (not int) " pr_err("bad mount option arg (not int) at '%s'\n", c);
"at '%s'\n", c);
return ret; return ret;
} }
dout("got int token %d val %d\n", token, intval); dout("got int token %d val %d\n", token, intval);
} else if (token > Opt_last_int && token < Opt_last_string) { } else if (token > Opt_last_int && token < Opt_last_string) {
dout("got string token %d val %s\n", token, dout("got string token %d val %s\n", token, argstr[0].from);
argstr[0].from);
} else if (token > Opt_last_string && token < Opt_last_bool) {
dout("got Boolean token %d\n", token);
} else { } else {
dout("got token %d\n", token); dout("got token %d\n", token);
} }
...@@ -789,9 +780,10 @@ static int parse_rbd_opts_token(char *c, void *private) ...@@ -789,9 +780,10 @@ static int parse_rbd_opts_token(char *c, void *private)
rbd_opts->read_only = false; rbd_opts->read_only = false;
break; break;
default: default:
rbd_assert(false); /* libceph prints "bad option" msg */
break; return -EINVAL;
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment