[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20071102170123.GE16063@ionkov.net>
Date: Fri, 2 Nov 2007 11:01:23 -0600
From: Latchesar Ionkov <lucho@...kov.net>
To: v9fs-developer@...ts.sourceforge.net
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 4/10] 9p: tranport interface changes for in-kernel server
This patch adds in-kernel 9P server support to the transport interface.
Signed-off-by: Latchesar Ionkov <lucho@...kov.net>
---
fs/9p/v9fs.c | 2 +-
include/net/9p/transport.h | 31 ++++++++++++++++++++++++++++---
net/9p/mux.c | 6 +++---
3 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index eeca7c7..c8bc530 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -210,7 +210,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
goto error;
}
- trans = v9ses->trans->create(dev_name, v9ses->options);
+ trans = v9ses->trans->create_client(dev_name, v9ses->options);
if (IS_ERR(trans)) {
retval = PTR_ERR(trans);
trans = NULL;
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
index b8eecc9..785595a 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -47,23 +47,48 @@ struct p9_trans {
void *aux;
void *priv; /* transport specific */
- /* The function schedules sending the data from the 'tc'
+ /* If client, the function schedules sending the data from the 'tc'
over the transport. If the 'rc' is set, the response is
read in it and the 'cb' is called.
+
+ If server, when a request arrives p9_trans_req is allocated and
+ the request content is stored in 'tc'. The transport sets 'cb'
+ and 'cba' values. The server stores the response in the 'rc'
+ fcall (or allocates one if NULL) and calls 'cb'.
+ The server is responsible of freeing the req as well as req->tc
+ and req->rc once the response is sent.
+ The transport is allowed to call the request function with NULL
+ value for 'req' if it's status ('err') is changed.
*/
void (*request)(struct p9_trans *trans, struct p9_trans_req *req);
- /* If the request is not sent down the wire, don't send it. */
+ /* If client and the request is not sent down the wire, don't send it.
+ If server, inform the transport that the server won't respond to
+ that request. Returns error code, zero if successful.
+ */
int (*cancel)(struct p9_trans *trans, struct p9_trans_req *req);
void (*destroy)(struct p9_trans *trans);
};
+struct p9_trans_listener {
+ int err;
+ void *taux; /* transport specific */
+ void *aux; /* user set */
+
+ /* The newtrans callback is set by the user of the listener
+ When there is a new incoming connection, newcann is called
+ with p9_trans that represents it */
+ void (*newtrans)(struct p9_trans_listener *, struct p9_trans *);
+ void (*destroy)(struct p9_trans_listener *);
+};
+
struct p9_trans_module {
struct list_head list;
char *name; /* name of transport */
int maxsize; /* max message size of transport */
int def; /* this transport should be default */
- struct p9_trans * (*create)(const char *devname, char *options);
+ struct p9_trans *(*create_client)(const char *devname, char *options);
+ struct p9_trans_listener *(*create_listener)(char *options);
};
void v9fs_register_trans(struct p9_trans_module *m);
diff --git a/net/9p/mux.c b/net/9p/mux.c
index 8a40a2e..3b0ed2c 100644
--- a/net/9p/mux.c
+++ b/net/9p/mux.c
@@ -157,21 +157,21 @@ static struct p9_trans_module p9_tcp_trans = {
.name = "tcp",
.maxsize = MAX_SOCK_BUF,
.def = 1,
- .create = p9fd_create_tcp_client,
+ .create_client = p9fd_create_tcp_client,
};
static struct p9_trans_module p9_unix_trans = {
.name = "unix",
.maxsize = MAX_SOCK_BUF,
.def = 0,
- .create = p9fd_create_unix_client,
+ .create_client = p9fd_create_unix_client,
};
static struct p9_trans_module p9_fd_trans = {
.name = "fd",
.maxsize = MAX_SOCK_BUF,
.def = 0,
- .create = p9fd_create_fd_client,
+ .create_client = p9fd_create_fd_client,
};
/**
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists