diff options
author | Eric Van Hensbergen <ericvh@ericvh-desktop.(none)> | 2008-03-07 11:53:53 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@opteron.9grid.us> | 2008-05-14 20:23:26 -0400 |
commit | bb8ffdfc3e3b32ad9fcdb8da289088d3b22794e5 (patch) | |
tree | fbe3dc4e19b5ca63b0cb548476cbb02cbfc59ee9 /net/9p/client.c | |
parent | ab31267dfeddf80b2e483f077c8b03905993722b (diff) |
9p: propagate parse_option changes to client and transports
Propagate changes that were made to the parse_options code to the
other parse options pieces present in the other modules. Looks like
the client parse options was probably corrupting the parse string
and causing problems for others.
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net/9p/client.c')
-rw-r--r-- | net/9p/client.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/net/9p/client.c b/net/9p/client.c index 84e087e24146..553c34e9f296 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
@@ -64,21 +64,30 @@ static match_table_t tokens = { | |||
64 | * @options: options string passed from mount | 64 | * @options: options string passed from mount |
65 | * @v9ses: existing v9fs session information | 65 | * @v9ses: existing v9fs session information |
66 | * | 66 | * |
67 | * Return 0 upon success, -ERRNO upon failure | ||
67 | */ | 68 | */ |
68 | 69 | ||
69 | static void parse_opts(char *options, struct p9_client *clnt) | 70 | static int parse_opts(char *opts, struct p9_client *clnt) |
70 | { | 71 | { |
72 | char *options; | ||
71 | char *p; | 73 | char *p; |
72 | substring_t args[MAX_OPT_ARGS]; | 74 | substring_t args[MAX_OPT_ARGS]; |
73 | int option; | 75 | int option; |
74 | int ret; | 76 | int ret = 0; |
75 | 77 | ||
76 | clnt->trans_mod = v9fs_default_trans(); | 78 | clnt->trans_mod = v9fs_default_trans(); |
77 | clnt->dotu = 1; | 79 | clnt->dotu = 1; |
78 | clnt->msize = 8192; | 80 | clnt->msize = 8192; |
79 | 81 | ||
80 | if (!options) | 82 | if (!opts) |
81 | return; | 83 | return 0; |
84 | |||
85 | options = kstrdup(opts, GFP_KERNEL); | ||
86 | if (!options) { | ||
87 | P9_DPRINTK(P9_DEBUG_ERROR, | ||
88 | "failed to allocate copy of option string\n"); | ||
89 | return -ENOMEM; | ||
90 | } | ||
82 | 91 | ||
83 | while ((p = strsep(&options, ",")) != NULL) { | 92 | while ((p = strsep(&options, ",")) != NULL) { |
84 | int token; | 93 | int token; |
@@ -86,10 +95,11 @@ static void parse_opts(char *options, struct p9_client *clnt) | |||
86 | continue; | 95 | continue; |
87 | token = match_token(p, tokens, args); | 96 | token = match_token(p, tokens, args); |
88 | if (token < Opt_trans) { | 97 | if (token < Opt_trans) { |
89 | ret = match_int(&args[0], &option); | 98 | int r = match_int(&args[0], &option); |
90 | if (ret < 0) { | 99 | if (r < 0) { |
91 | P9_DPRINTK(P9_DEBUG_ERROR, | 100 | P9_DPRINTK(P9_DEBUG_ERROR, |
92 | "integer field, but no integer?\n"); | 101 | "integer field, but no integer?\n"); |
102 | ret = r; | ||
93 | continue; | 103 | continue; |
94 | } | 104 | } |
95 | } | 105 | } |
@@ -107,6 +117,8 @@ static void parse_opts(char *options, struct p9_client *clnt) | |||
107 | continue; | 117 | continue; |
108 | } | 118 | } |
109 | } | 119 | } |
120 | kfree(options); | ||
121 | return ret; | ||
110 | } | 122 | } |
111 | 123 | ||
112 | 124 | ||
@@ -138,6 +150,7 @@ struct p9_client *p9_client_create(const char *dev_name, char *options) | |||
138 | if (!clnt) | 150 | if (!clnt) |
139 | return ERR_PTR(-ENOMEM); | 151 | return ERR_PTR(-ENOMEM); |
140 | 152 | ||
153 | clnt->trans = NULL; | ||
141 | spin_lock_init(&clnt->lock); | 154 | spin_lock_init(&clnt->lock); |
142 | INIT_LIST_HEAD(&clnt->fidlist); | 155 | INIT_LIST_HEAD(&clnt->fidlist); |
143 | clnt->fidpool = p9_idpool_create(); | 156 | clnt->fidpool = p9_idpool_create(); |
@@ -147,7 +160,10 @@ struct p9_client *p9_client_create(const char *dev_name, char *options) | |||
147 | goto error; | 160 | goto error; |
148 | } | 161 | } |
149 | 162 | ||
150 | parse_opts(options, clnt); | 163 | err = parse_opts(options, clnt); |
164 | if (err < 0) | ||
165 | goto error; | ||
166 | |||
151 | if (clnt->trans_mod == NULL) { | 167 | if (clnt->trans_mod == NULL) { |
152 | err = -EPROTONOSUPPORT; | 168 | err = -EPROTONOSUPPORT; |
153 | P9_DPRINTK(P9_DEBUG_ERROR, | 169 | P9_DPRINTK(P9_DEBUG_ERROR, |