fs/9p: Cleanup option parsing in 9p
Instead of saying all integer argument option should be listed in the beginning move integer parsing to each option type. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
This commit is contained in:
committed by
Eric Van Hensbergen
parent
5635fd0ccf
commit
4d5077f1b2
31
fs/9p/v9fs.c
31
fs/9p/v9fs.c
@@ -132,21 +132,19 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
|
|||||||
options = tmp_options;
|
options = tmp_options;
|
||||||
|
|
||||||
while ((p = strsep(&options, ",")) != NULL) {
|
while ((p = strsep(&options, ",")) != NULL) {
|
||||||
int token;
|
int token, r;
|
||||||
if (!*p)
|
if (!*p)
|
||||||
continue;
|
continue;
|
||||||
token = match_token(p, tokens, args);
|
token = match_token(p, tokens, args);
|
||||||
if (token < Opt_uname) {
|
switch (token) {
|
||||||
int r = match_int(&args[0], &option);
|
case Opt_debug:
|
||||||
|
r = match_int(&args[0], &option);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
P9_DPRINTK(P9_DEBUG_ERROR,
|
P9_DPRINTK(P9_DEBUG_ERROR,
|
||||||
"integer field, but no integer?\n");
|
"integer field, but no integer?\n");
|
||||||
ret = r;
|
ret = r;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
switch (token) {
|
|
||||||
case Opt_debug:
|
|
||||||
v9ses->debug = option;
|
v9ses->debug = option;
|
||||||
#ifdef CONFIG_NET_9P_DEBUG
|
#ifdef CONFIG_NET_9P_DEBUG
|
||||||
p9_debug_level = option;
|
p9_debug_level = option;
|
||||||
@@ -154,12 +152,33 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Opt_dfltuid:
|
case Opt_dfltuid:
|
||||||
|
r = match_int(&args[0], &option);
|
||||||
|
if (r < 0) {
|
||||||
|
P9_DPRINTK(P9_DEBUG_ERROR,
|
||||||
|
"integer field, but no integer?\n");
|
||||||
|
ret = r;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
v9ses->dfltuid = option;
|
v9ses->dfltuid = option;
|
||||||
break;
|
break;
|
||||||
case Opt_dfltgid:
|
case Opt_dfltgid:
|
||||||
|
r = match_int(&args[0], &option);
|
||||||
|
if (r < 0) {
|
||||||
|
P9_DPRINTK(P9_DEBUG_ERROR,
|
||||||
|
"integer field, but no integer?\n");
|
||||||
|
ret = r;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
v9ses->dfltgid = option;
|
v9ses->dfltgid = option;
|
||||||
break;
|
break;
|
||||||
case Opt_afid:
|
case Opt_afid:
|
||||||
|
r = match_int(&args[0], &option);
|
||||||
|
if (r < 0) {
|
||||||
|
P9_DPRINTK(P9_DEBUG_ERROR,
|
||||||
|
"integer field, but no integer?\n");
|
||||||
|
ret = r;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
v9ses->afid = option;
|
v9ses->afid = option;
|
||||||
break;
|
break;
|
||||||
case Opt_uname:
|
case Opt_uname:
|
||||||
|
@@ -123,21 +123,19 @@ static int parse_opts(char *opts, struct p9_client *clnt)
|
|||||||
options = tmp_options;
|
options = tmp_options;
|
||||||
|
|
||||||
while ((p = strsep(&options, ",")) != NULL) {
|
while ((p = strsep(&options, ",")) != NULL) {
|
||||||
int token;
|
int token, r;
|
||||||
if (!*p)
|
if (!*p)
|
||||||
continue;
|
continue;
|
||||||
token = match_token(p, tokens, args);
|
token = match_token(p, tokens, args);
|
||||||
if (token < Opt_trans) {
|
switch (token) {
|
||||||
int r = match_int(&args[0], &option);
|
case Opt_msize:
|
||||||
|
r = match_int(&args[0], &option);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
P9_DPRINTK(P9_DEBUG_ERROR,
|
P9_DPRINTK(P9_DEBUG_ERROR,
|
||||||
"integer field, but no integer?\n");
|
"integer field, but no integer?\n");
|
||||||
ret = r;
|
ret = r;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
switch (token) {
|
|
||||||
case Opt_msize:
|
|
||||||
clnt->msize = option;
|
clnt->msize = option;
|
||||||
break;
|
break;
|
||||||
case Opt_trans:
|
case Opt_trans:
|
||||||
|
Reference in New Issue
Block a user