From: Eric Van Hensbergen <ericvh@gmail.com>

Add fd transport support to the mount options.

Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 fs/9p/v9fs.c |   27 ++++++++++++++++++++++++++-
 fs/9p/v9fs.h |    4 ++++
 2 files changed, 30 insertions(+), 1 deletion(-)

diff -puN fs/9p/v9fs.c~v9fs-vfs-superblock-operations-and-glue-add-fd-based-transport-to-mount-options fs/9p/v9fs.c
--- devel/fs/9p/v9fs.c~v9fs-vfs-superblock-operations-and-glue-add-fd-based-transport-to-mount-options	2005-07-28 11:52:49.000000000 -0700
+++ devel-akpm/fs/9p/v9fs.c	2005-07-28 11:52:49.000000000 -0700
@@ -50,10 +50,11 @@ int v9fs_debug_level = 0;	/* feature-rif
 enum {
 	/* Options that take integer arguments */
 	Opt_port, Opt_msize, Opt_uid, Opt_gid, Opt_afid, Opt_debug,
+	Opt_rfdno, Opt_wfdno,
 	/* String options */
 	Opt_name, Opt_remotename,
 	/* Options that take no arguments */
-	Opt_legacy, Opt_nodevmap, Opt_unix, Opt_tcp,
+	Opt_legacy, Opt_nodevmap, Opt_unix, Opt_tcp, Opt_fd,
 	/* Error token */
 	Opt_err
 };
@@ -64,13 +65,17 @@ static match_table_t tokens = {
 	{Opt_uid, "uid=%u"},
 	{Opt_gid, "gid=%u"},
 	{Opt_afid, "afid=%u"},
+	{Opt_rfdno, "rfdno=%u"},
+	{Opt_wfdno, "wfdno=%u"},
 	{Opt_debug, "debug=%u"},
 	{Opt_name, "name=%s"},
 	{Opt_remotename, "aname=%s"},
 	{Opt_unix, "proto=unix"},
 	{Opt_tcp, "proto=tcp"},
+	{Opt_fd, "proto=fd"},
 	{Opt_tcp, "tcp"},
 	{Opt_unix, "unix"},
+	{Opt_fd, "fd"},
 	{Opt_legacy, "noextend"},
 	{Opt_nodevmap, "nodevmap"},
 	{Opt_err, NULL}
@@ -101,6 +106,8 @@ static void v9fs_parse_options(char *opt
 	v9ses->extended = 1;
 	v9ses->afid = ~0;
 	v9ses->debug = 0;
+	v9ses->rfdno = ~0;
+	v9ses->wfdno = ~0;
 
 	if (!options)
 		return;
@@ -134,6 +141,12 @@ static void v9fs_parse_options(char *opt
 		case Opt_afid:
 			v9ses->afid = option;
 			break;
+		case Opt_rfdno:
+			v9ses->rfdno = option;
+			break;
+		case Opt_wfdno:
+			v9ses->wfdno = option;
+			break;
 		case Opt_debug:
 			v9ses->debug = option;
 			break;
@@ -143,6 +156,9 @@ static void v9fs_parse_options(char *opt
 		case Opt_unix:
 			v9ses->proto = PROTO_UNIX;
 			break;
+		case Opt_fd:
+			v9ses->proto = PROTO_FD;
+			break;
 		case Opt_name:
 			match_strcpy(v9ses->name, &args[0]);
 			break;
@@ -277,6 +293,15 @@ v9fs_session_init(struct v9fs_session_in
 		trans_proto = &v9fs_trans_unix;
 		*v9ses->remotename = 0;
 		break;
+	case PROTO_FD:
+		trans_proto = &v9fs_trans_fd;
+		*v9ses->remotename = 0;
+		if((v9ses->wfdno == ~0) || (v9ses->rfdno == ~0)) {
+			printk(KERN_ERR "v9fs: Insufficient options for proto=fd\n");
+			retval = -ENOPROTOOPT;
+			goto SessCleanUp;
+		}
+		break;
 	default:
 		printk(KERN_ERR "v9fs: Bad mount protocol %d\n", v9ses->proto);
 		retval = -ENOPROTOOPT;
diff -puN fs/9p/v9fs.h~v9fs-vfs-superblock-operations-and-glue-add-fd-based-transport-to-mount-options fs/9p/v9fs.h
--- devel/fs/9p/v9fs.h~v9fs-vfs-superblock-operations-and-glue-add-fd-based-transport-to-mount-options	2005-07-28 11:52:49.000000000 -0700
+++ devel-akpm/fs/9p/v9fs.h	2005-07-28 11:52:49.000000000 -0700
@@ -46,6 +46,9 @@ struct v9fs_session_info {
 	unsigned short debug;	/* debug level */
 	unsigned short proto;	/* protocol to use */
 	unsigned int afid;	/* authentication fid */
+	unsigned int rfdno;	/* read file descriptor number */
+	unsigned int wfdno;	/* write file descriptor number */
+
 
 	char *name;		/* user name to mount as */
 	char *remotename;	/* name of remote hierarchy being mounted */
@@ -78,6 +81,7 @@ struct v9fs_session_info {
 enum {
 	PROTO_TCP,
 	PROTO_UNIX,
+	PROTO_FD,
 };
 
 int v9fs_session_init(struct v9fs_session_info *, const char *, char *);
_