aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2011-08-30 02:49:34 -0400
committerEric Van Hensbergen <ericvh@gmail.com>2011-10-24 12:13:12 -0400
commit4d5077f1b2aa502a0ca98b450d1b16fbccfe9c63 (patch)
treedab8859206b0e198a2d0862a1228d8342073e659
parent5635fd0ccf4ce90a9ecf8fa48f5f031f5f73e6f5 (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>
-rw-r--r--fs/9p/v9fs.c33
-rw-r--r--net/9p/client.c12
2 files changed, 31 insertions, 14 deletions
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index ef966188611..2b78014a124 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:
diff --git a/net/9p/client.c b/net/9p/client.c
index 9eadadb0a69..0edee4de608 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -123,21 +123,19 @@ static int parse_opts(char *opts, struct p9_client *clnt)
123 options = tmp_options; 123 options = tmp_options;
124 124
125 while ((p = strsep(&options, ",")) != NULL) { 125 while ((p = strsep(&options, ",")) != NULL) {
126 int token; 126 int token, r;
127 if (!*p) 127 if (!*p)
128 continue; 128 continue;
129 token = match_token(p, tokens, args); 129 token = match_token(p, tokens, args);
130 if (token < Opt_trans) { 130 switch (token) {
131 int r = match_int(&args[0], &option); 131 case Opt_msize:
132 r = match_int(&args[0], &option);
132 if (r < 0) { 133 if (r < 0) {
133 P9_DPRINTK(P9_DEBUG_ERROR, 134 P9_DPRINTK(P9_DEBUG_ERROR,
134 "integer field, but no integer?\n"); 135 "integer field, but no integer?\n");
135 ret = r; 136 ret = r;
136 continue; 137 continue;
137 } 138 }
138 }
139 switch (token) {
140 case Opt_msize:
141 clnt->msize = option; 139 clnt->msize = option;
142 break; 140 break;
143 case Opt_trans: 141 case Opt_trans: