diff options
author | Sripathi Kodi <sripathik@in.ibm.com> | 2010-03-05 18:49:11 +0000 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2010-03-05 15:04:42 -0600 |
commit | 0fb80abd911a7cb1e6548b5279568dc1e8949702 (patch) | |
tree | 0c179f49f2f0d0bf2c979ee1b1f1cfd864122029 /net | |
parent | dd6102fbd917889384d89bc427e98e85e8fda000 (diff) | |
download | kernel_samsung_crespo-0fb80abd911a7cb1e6548b5279568dc1e8949702.tar.gz kernel_samsung_crespo-0fb80abd911a7cb1e6548b5279568dc1e8949702.tar.bz2 kernel_samsung_crespo-0fb80abd911a7cb1e6548b5279568dc1e8949702.zip |
9P2010.L handshake: Add mount option
Add new mount V9FS mount option to specify protocol version
This patch adds a new mount option to specify protocol version.
With this option it is possible to use "-o version=" switch to
specify 9P protocol version to use. Valid options for version
are:
9p2000
9p2000.u
9p2010.L
Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/9p/client.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/net/9p/client.c b/net/9p/client.c index 09d4f1e2e4a..3b5f3c94a6e 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -46,6 +46,7 @@ enum { Opt_msize, Opt_trans, Opt_legacy, + Opt_version, Opt_err, }; @@ -53,9 +54,30 @@ static const match_table_t tokens = { {Opt_msize, "msize=%u"}, {Opt_legacy, "noextend"}, {Opt_trans, "trans=%s"}, + {Opt_version, "version=%s"}, {Opt_err, NULL}, }; +/* Interpret mount option for protocol version */ +static unsigned char get_protocol_version(const substring_t *name) +{ + unsigned char version = -EINVAL; + if (!strncmp("9p2000", name->from, name->to-name->from)) { + version = p9_proto_legacy; + P9_DPRINTK(P9_DEBUG_9P, "Protocol version: Legacy\n"); + } else if (!strncmp("9p2000.u", name->from, name->to-name->from)) { + version = p9_proto_2000u; + P9_DPRINTK(P9_DEBUG_9P, "Protocol version: 9P2000.u\n"); + } else if (!strncmp("9p2010.L", name->from, name->to-name->from)) { + version = p9_proto_2010L; + P9_DPRINTK(P9_DEBUG_9P, "Protocol version: 9P2010.L\n"); + } else { + P9_DPRINTK(P9_DEBUG_ERROR, "Unknown protocol version %s. ", + name->from); + } + return version; +} + static struct p9_req_t * p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...); @@ -120,6 +142,12 @@ static int parse_opts(char *opts, struct p9_client *clnt) case Opt_legacy: clnt->dotu = 0; break; + case Opt_version: + ret = get_protocol_version(&args[0]); + if (ret == -EINVAL) + goto free_and_return; + clnt->proto_version = ret; + break; default: continue; } |