|
@@ -72,23 +72,22 @@ inline int p9_is_proto_dotu(struct p9_client *clnt)
|
|
EXPORT_SYMBOL(p9_is_proto_dotu);
|
|
EXPORT_SYMBOL(p9_is_proto_dotu);
|
|
|
|
|
|
/* Interpret mount option for protocol version */
|
|
/* Interpret mount option for protocol version */
|
|
-static int get_protocol_version(const substring_t *name)
|
|
|
|
|
|
+static int get_protocol_version(char *s)
|
|
{
|
|
{
|
|
int version = -EINVAL;
|
|
int version = -EINVAL;
|
|
|
|
|
|
- if (!strncmp("9p2000", name->from, name->to-name->from)) {
|
|
|
|
|
|
+ if (!strcmp(s, "9p2000")) {
|
|
version = p9_proto_legacy;
|
|
version = p9_proto_legacy;
|
|
P9_DPRINTK(P9_DEBUG_9P, "Protocol version: Legacy\n");
|
|
P9_DPRINTK(P9_DEBUG_9P, "Protocol version: Legacy\n");
|
|
- } else if (!strncmp("9p2000.u", name->from, name->to-name->from)) {
|
|
|
|
|
|
+ } else if (!strcmp(s, "9p2000.u")) {
|
|
version = p9_proto_2000u;
|
|
version = p9_proto_2000u;
|
|
P9_DPRINTK(P9_DEBUG_9P, "Protocol version: 9P2000.u\n");
|
|
P9_DPRINTK(P9_DEBUG_9P, "Protocol version: 9P2000.u\n");
|
|
- } else if (!strncmp("9p2000.L", name->from, name->to-name->from)) {
|
|
|
|
|
|
+ } else if (!strcmp(s, "9p2000.L")) {
|
|
version = p9_proto_2000L;
|
|
version = p9_proto_2000L;
|
|
P9_DPRINTK(P9_DEBUG_9P, "Protocol version: 9P2000.L\n");
|
|
P9_DPRINTK(P9_DEBUG_9P, "Protocol version: 9P2000.L\n");
|
|
- } else {
|
|
|
|
- P9_DPRINTK(P9_DEBUG_ERROR, "Unknown protocol version %s. ",
|
|
|
|
- name->from);
|
|
|
|
- }
|
|
|
|
|
|
+ } else
|
|
|
|
+ printk(KERN_INFO "9p: Unknown protocol version %s.\n", s);
|
|
|
|
+
|
|
return version;
|
|
return version;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -106,6 +105,7 @@ static int parse_opts(char *opts, struct p9_client *clnt)
|
|
char *p;
|
|
char *p;
|
|
substring_t args[MAX_OPT_ARGS];
|
|
substring_t args[MAX_OPT_ARGS];
|
|
int option;
|
|
int option;
|
|
|
|
+ char *s;
|
|
int ret = 0;
|
|
int ret = 0;
|
|
|
|
|
|
clnt->proto_version = p9_proto_2000u;
|
|
clnt->proto_version = p9_proto_2000u;
|
|
@@ -141,22 +141,41 @@ static int parse_opts(char *opts, struct p9_client *clnt)
|
|
clnt->msize = option;
|
|
clnt->msize = option;
|
|
break;
|
|
break;
|
|
case Opt_trans:
|
|
case Opt_trans:
|
|
- clnt->trans_mod = v9fs_get_trans_by_name(&args[0]);
|
|
|
|
- if(clnt->trans_mod == NULL) {
|
|
|
|
|
|
+ s = match_strdup(&args[0]);
|
|
|
|
+ if (!s) {
|
|
|
|
+ ret = -ENOMEM;
|
|
P9_DPRINTK(P9_DEBUG_ERROR,
|
|
P9_DPRINTK(P9_DEBUG_ERROR,
|
|
- "Could not find request transport: %s\n",
|
|
|
|
- (char *) &args[0]);
|
|
|
|
|
|
+ "problem allocating copy of trans arg\n");
|
|
|
|
+ goto free_and_return;
|
|
|
|
+ }
|
|
|
|
+ clnt->trans_mod = v9fs_get_trans_by_name(s);
|
|
|
|
+ if (clnt->trans_mod == NULL) {
|
|
|
|
+ printk(KERN_INFO
|
|
|
|
+ "9p: Could not find "
|
|
|
|
+ "request transport: %s\n", s);
|
|
ret = -EINVAL;
|
|
ret = -EINVAL;
|
|
|
|
+ kfree(s);
|
|
goto free_and_return;
|
|
goto free_and_return;
|
|
}
|
|
}
|
|
|
|
+ kfree(s);
|
|
break;
|
|
break;
|
|
case Opt_legacy:
|
|
case Opt_legacy:
|
|
clnt->proto_version = p9_proto_legacy;
|
|
clnt->proto_version = p9_proto_legacy;
|
|
break;
|
|
break;
|
|
case Opt_version:
|
|
case Opt_version:
|
|
- ret = get_protocol_version(&args[0]);
|
|
|
|
- if (ret == -EINVAL)
|
|
|
|
|
|
+ s = match_strdup(&args[0]);
|
|
|
|
+ if (!s) {
|
|
|
|
+ ret = -ENOMEM;
|
|
|
|
+ P9_DPRINTK(P9_DEBUG_ERROR,
|
|
|
|
+ "problem allocating copy of version arg\n");
|
|
|
|
+ goto free_and_return;
|
|
|
|
+ }
|
|
|
|
+ ret = get_protocol_version(s);
|
|
|
|
+ if (ret == -EINVAL) {
|
|
|
|
+ kfree(s);
|
|
goto free_and_return;
|
|
goto free_and_return;
|
|
|
|
+ }
|
|
|
|
+ kfree(s);
|
|
clnt->proto_version = ret;
|
|
clnt->proto_version = ret;
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|