summaryrefslogtreecommitdiffstats
path: root/net/9p/trans_virtio.c
diff options
context:
space:
mode:
authorEric Van Hensbergen <ericvh@opteron.homeip.net>2008-02-06 19:25:03 -0600
committerEric Van Hensbergen <ericvh@opteron.homeip.net>2008-02-06 19:25:03 -0600
commit8a0dc95fd976a052e5e799ef33e6c8e3141b5dff (patch)
tree3275903539244acd76c716662c324833aa419377 /net/9p/trans_virtio.c
parentf39335453fe79f4e12e263e7c6387dc9fb86bfff (diff)
9p: transport API reorganization
This merges the mux.c (including the connection interface) with trans_fd in preparation for transport API changes. Ultimately, trans_fd will need to be rewritten to clean it up and simplify the implementation, but this reorganization is viewed as the first step. Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net/9p/trans_virtio.c')
-rw-r--r--net/9p/trans_virtio.c44
1 files changed, 10 insertions, 34 deletions
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index c957080966b..0117b9fb848 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -130,29 +130,6 @@ static unsigned int rest_of_page(void *data)
return PAGE_SIZE - ((unsigned long)data % PAGE_SIZE);
}
-static int p9_virtio_write(struct p9_trans *trans, void *buf, int count)
-{
- /* Only use the rpc mechanism for now */
- return count;
-}
-
-static int p9_virtio_read(struct p9_trans *trans, void *buf, int count)
-{
- /* Only use the rpc mechanism for now */
- return 0;
-}
-
-/* The poll function is used by 9p transports to determine if there
- * is there is activity available on a particular channel. In our case
- * we use it to wait for a callback from the input routines.
- */
-static unsigned int
-p9_virtio_poll(struct p9_trans *trans, struct poll_table_struct *pt)
-{
- /* Only use the rpc mechanism for now */
- return 0;
-}
-
static void p9_virtio_close(struct p9_trans *trans)
{
struct virtio_chan *chan = trans->priv;
@@ -214,8 +191,7 @@ pack_sg_list(struct scatterlist *sg, int start, int limit, char *data,
}
static int
-p9_virtio_rpc(struct p9_trans *t, struct p9_fcall *tc, struct p9_fcall **rc,
- int msize, int dotu)
+p9_virtio_rpc(struct p9_trans *t, struct p9_fcall *tc, struct p9_fcall **rc)
{
int in, out;
int n, err, size;
@@ -225,7 +201,7 @@ p9_virtio_rpc(struct p9_trans *t, struct p9_fcall *tc, struct p9_fcall **rc,
unsigned long flags;
if (*rc == NULL) {
- *rc = kmalloc(sizeof(struct p9_fcall) + msize, GFP_KERNEL);
+ *rc = kmalloc(sizeof(struct p9_fcall) + t->msize, GFP_KERNEL);
if (!*rc)
return -ENOMEM;
}
@@ -248,7 +224,7 @@ p9_virtio_rpc(struct p9_trans *t, struct p9_fcall *tc, struct p9_fcall **rc,
P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio rpc tag %d\n", n);
out = pack_sg_list(chan->sg, 0, VIRTQUEUE_NUM, tc->sdata, tc->size);
- in = pack_sg_list(chan->sg, out, VIRTQUEUE_NUM-out, rdata, msize);
+ in = pack_sg_list(chan->sg, out, VIRTQUEUE_NUM-out, rdata, t->msize);
req->status = REQ_STATUS_SENT;
@@ -264,7 +240,7 @@ p9_virtio_rpc(struct p9_trans *t, struct p9_fcall *tc, struct p9_fcall **rc,
size = le32_to_cpu(*(__le32 *) rdata);
- err = p9_deserialize_fcall(rdata, size, *rc, dotu);
+ err = p9_deserialize_fcall(rdata, size, *rc, t->extended);
if (err < 0) {
P9_DPRINTK(P9_DEBUG_TRANS,
"9p debug: virtio rpc deserialize returned %d\n", err);
@@ -275,7 +251,7 @@ p9_virtio_rpc(struct p9_trans *t, struct p9_fcall *tc, struct p9_fcall **rc,
if ((p9_debug_level&P9_DEBUG_FCALL) == P9_DEBUG_FCALL) {
char buf[150];
- p9_printfcall(buf, sizeof(buf), *rc, dotu);
+ p9_printfcall(buf, sizeof(buf), *rc, t->extended);
printk(KERN_NOTICE ">>> %p %s\n", t, buf);
}
#endif
@@ -337,7 +313,9 @@ fail:
* alternate channels by matching devname versus a virtio_config entry.
* We use a simple reference count mechanism to ensure that only a single
* mount has a channel open at a time. */
-static struct p9_trans *p9_virtio_create(const char *devname, char *args)
+static struct p9_trans *
+p9_virtio_create(const char *devname, char *args, int msize,
+ unsigned char extended)
{
struct p9_trans *trans;
struct virtio_chan *chan = channels;
@@ -374,11 +352,9 @@ static struct p9_trans *p9_virtio_create(const char *devname, char *args)
printk(KERN_ERR "9p: couldn't allocate transport\n");
return ERR_PTR(-ENOMEM);
}
-
- trans->write = p9_virtio_write;
- trans->read = p9_virtio_read;
+ trans->extended = extended;
+ trans->msize = msize;
trans->close = p9_virtio_close;
- trans->poll = p9_virtio_poll;
trans->rpc = p9_virtio_rpc;
trans->priv = chan;