diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2011-08-30 02:49:34 -0400 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2011-10-24 12:13:12 -0400 |
commit | 4d5077f1b2aa502a0ca98b450d1b16fbccfe9c63 (patch) | |
tree | dab8859206b0e198a2d0862a1228d8342073e659 /fs | |
parent | 5635fd0ccf4ce90a9ecf8fa48f5f031f5f73e6f5 (diff) |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/9p/v9fs.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index ef9661886112..2b78014a124a 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c | |||
@@ -132,21 +132,19 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) | |||
132 | options = tmp_options; | 132 | options = tmp_options; |
133 | 133 | ||
134 | while ((p = strsep(&options, ",")) != NULL) { | 134 | while ((p = strsep(&options, ",")) != NULL) { |
135 | int token; | 135 | int token, r; |
136 | if (!*p) | 136 | if (!*p) |
137 | continue; | 137 | continue; |
138 | token = match_token(p, tokens, args); | 138 | token = match_token(p, tokens, args); |
139 | if (token < Opt_uname) { | 139 | switch (token) { |
140 | int r = match_int(&args[0], &option); | 140 | case Opt_debug: |
141 | r = match_int(&args[0], &option); | ||
141 | if (r < 0) { | 142 | if (r < 0) { |
142 | P9_DPRINTK(P9_DEBUG_ERROR, | 143 | P9_DPRINTK(P9_DEBUG_ERROR, |
143 | "integer field, but no integer?\n"); | 144 | "integer field, but no integer?\n"); |
144 | ret = r; | 145 | ret = r; |
145 | continue; | 146 | continue; |
146 | } | 147 | } |
147 | } | ||
148 | switch (token) { | ||
149 | case Opt_debug: | ||
150 | v9ses->debug = option; | 148 | v9ses->debug = option; |
151 | #ifdef CONFIG_NET_9P_DEBUG | 149 | #ifdef CONFIG_NET_9P_DEBUG |
152 | p9_debug_level = option; | 150 | p9_debug_level = option; |
@@ -154,12 +152,33 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) | |||
154 | break; | 152 | break; |
155 | 153 | ||
156 | case Opt_dfltuid: | 154 | case Opt_dfltuid: |
155 | r = match_int(&args[0], &option); | ||
156 | if (r < 0) { | ||
157 | P9_DPRINTK(P9_DEBUG_ERROR, | ||
158 | "integer field, but no integer?\n"); | ||
159 | ret = r; | ||
160 | continue; | ||
161 | } | ||
157 | v9ses->dfltuid = option; | 162 | v9ses->dfltuid = option; |
158 | break; | 163 | break; |
159 | case Opt_dfltgid: | 164 | case Opt_dfltgid: |
165 | r = match_int(&args[0], &option); | ||
166 | if (r < 0) { | ||
167 | P9_DPRINTK(P9_DEBUG_ERROR, | ||
168 | "integer field, but no integer?\n"); | ||
169 | ret = r; | ||
170 | continue; | ||
171 | } | ||
160 | v9ses->dfltgid = option; | 172 | v9ses->dfltgid = option; |
161 | break; | 173 | break; |
162 | case Opt_afid: | 174 | case Opt_afid: |
175 | r = match_int(&args[0], &option); | ||
176 | if (r < 0) { | ||
177 | P9_DPRINTK(P9_DEBUG_ERROR, | ||
178 | "integer field, but no integer?\n"); | ||
179 | ret = r; | ||
180 | continue; | ||
181 | } | ||
163 | v9ses->afid = option; | 182 | v9ses->afid = option; |
164 | break; | 183 | break; |
165 | case Opt_uname: | 184 | case Opt_uname: |