diff options
Diffstat (limited to 'net/9p/trans_virtio.c')
-rw-r--r-- | net/9p/trans_virtio.c | 44 |
1 files changed, 10 insertions, 34 deletions
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index c957080966b4..0117b9fb8480 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) | |||
130 | return PAGE_SIZE - ((unsigned long)data % PAGE_SIZE); | 130 | return PAGE_SIZE - ((unsigned long)data % PAGE_SIZE); |
131 | } | 131 | } |
132 | 132 | ||
133 | static int p9_virtio_write(struct p9_trans *trans, void *buf, int count) | ||
134 | { | ||
135 | /* Only use the rpc mechanism for now */ | ||
136 | return count; | ||
137 | } | ||
138 | |||
139 | static int p9_virtio_read(struct p9_trans *trans, void *buf, int count) | ||
140 | { | ||
141 | /* Only use the rpc mechanism for now */ | ||
142 | return 0; | ||
143 | } | ||
144 | |||
145 | /* The poll function is used by 9p transports to determine if there | ||
146 | * is there is activity available on a particular channel. In our case | ||
147 | * we use it to wait for a callback from the input routines. | ||
148 | */ | ||
149 | static unsigned int | ||
150 | p9_virtio_poll(struct p9_trans *trans, struct poll_table_struct *pt) | ||
151 | { | ||
152 | /* Only use the rpc mechanism for now */ | ||
153 | return 0; | ||
154 | } | ||
155 | |||
156 | static void p9_virtio_close(struct p9_trans *trans) | 133 | static void p9_virtio_close(struct p9_trans *trans) |
157 | { | 134 | { |
158 | struct virtio_chan *chan = trans->priv; | 135 | struct virtio_chan *chan = trans->priv; |
@@ -214,8 +191,7 @@ pack_sg_list(struct scatterlist *sg, int start, int limit, char *data, | |||
214 | } | 191 | } |
215 | 192 | ||
216 | static int | 193 | static int |
217 | p9_virtio_rpc(struct p9_trans *t, struct p9_fcall *tc, struct p9_fcall **rc, | 194 | p9_virtio_rpc(struct p9_trans *t, struct p9_fcall *tc, struct p9_fcall **rc) |
218 | int msize, int dotu) | ||
219 | { | 195 | { |
220 | int in, out; | 196 | int in, out; |
221 | int n, err, size; | 197 | int n, err, size; |
@@ -225,7 +201,7 @@ p9_virtio_rpc(struct p9_trans *t, struct p9_fcall *tc, struct p9_fcall **rc, | |||
225 | unsigned long flags; | 201 | unsigned long flags; |
226 | 202 | ||
227 | if (*rc == NULL) { | 203 | if (*rc == NULL) { |
228 | *rc = kmalloc(sizeof(struct p9_fcall) + msize, GFP_KERNEL); | 204 | *rc = kmalloc(sizeof(struct p9_fcall) + t->msize, GFP_KERNEL); |
229 | if (!*rc) | 205 | if (!*rc) |
230 | return -ENOMEM; | 206 | return -ENOMEM; |
231 | } | 207 | } |
@@ -248,7 +224,7 @@ p9_virtio_rpc(struct p9_trans *t, struct p9_fcall *tc, struct p9_fcall **rc, | |||
248 | P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio rpc tag %d\n", n); | 224 | P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio rpc tag %d\n", n); |
249 | 225 | ||
250 | out = pack_sg_list(chan->sg, 0, VIRTQUEUE_NUM, tc->sdata, tc->size); | 226 | out = pack_sg_list(chan->sg, 0, VIRTQUEUE_NUM, tc->sdata, tc->size); |
251 | in = pack_sg_list(chan->sg, out, VIRTQUEUE_NUM-out, rdata, msize); | 227 | in = pack_sg_list(chan->sg, out, VIRTQUEUE_NUM-out, rdata, t->msize); |
252 | 228 | ||
253 | req->status = REQ_STATUS_SENT; | 229 | req->status = REQ_STATUS_SENT; |
254 | 230 | ||
@@ -264,7 +240,7 @@ p9_virtio_rpc(struct p9_trans *t, struct p9_fcall *tc, struct p9_fcall **rc, | |||
264 | 240 | ||
265 | size = le32_to_cpu(*(__le32 *) rdata); | 241 | size = le32_to_cpu(*(__le32 *) rdata); |
266 | 242 | ||
267 | err = p9_deserialize_fcall(rdata, size, *rc, dotu); | 243 | err = p9_deserialize_fcall(rdata, size, *rc, t->extended); |
268 | if (err < 0) { | 244 | if (err < 0) { |
269 | P9_DPRINTK(P9_DEBUG_TRANS, | 245 | P9_DPRINTK(P9_DEBUG_TRANS, |
270 | "9p debug: virtio rpc deserialize returned %d\n", err); | 246 | "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, | |||
275 | if ((p9_debug_level&P9_DEBUG_FCALL) == P9_DEBUG_FCALL) { | 251 | if ((p9_debug_level&P9_DEBUG_FCALL) == P9_DEBUG_FCALL) { |
276 | char buf[150]; | 252 | char buf[150]; |
277 | 253 | ||
278 | p9_printfcall(buf, sizeof(buf), *rc, dotu); | 254 | p9_printfcall(buf, sizeof(buf), *rc, t->extended); |
279 | printk(KERN_NOTICE ">>> %p %s\n", t, buf); | 255 | printk(KERN_NOTICE ">>> %p %s\n", t, buf); |
280 | } | 256 | } |
281 | #endif | 257 | #endif |
@@ -337,7 +313,9 @@ fail: | |||
337 | * alternate channels by matching devname versus a virtio_config entry. | 313 | * alternate channels by matching devname versus a virtio_config entry. |
338 | * We use a simple reference count mechanism to ensure that only a single | 314 | * We use a simple reference count mechanism to ensure that only a single |
339 | * mount has a channel open at a time. */ | 315 | * mount has a channel open at a time. */ |
340 | static struct p9_trans *p9_virtio_create(const char *devname, char *args) | 316 | static struct p9_trans * |
317 | p9_virtio_create(const char *devname, char *args, int msize, | ||
318 | unsigned char extended) | ||
341 | { | 319 | { |
342 | struct p9_trans *trans; | 320 | struct p9_trans *trans; |
343 | struct virtio_chan *chan = channels; | 321 | struct virtio_chan *chan = channels; |
@@ -374,11 +352,9 @@ static struct p9_trans *p9_virtio_create(const char *devname, char *args) | |||
374 | printk(KERN_ERR "9p: couldn't allocate transport\n"); | 352 | printk(KERN_ERR "9p: couldn't allocate transport\n"); |
375 | return ERR_PTR(-ENOMEM); | 353 | return ERR_PTR(-ENOMEM); |
376 | } | 354 | } |
377 | 355 | trans->extended = extended; | |
378 | trans->write = p9_virtio_write; | 356 | trans->msize = msize; |
379 | trans->read = p9_virtio_read; | ||
380 | trans->close = p9_virtio_close; | 357 | trans->close = p9_virtio_close; |
381 | trans->poll = p9_virtio_poll; | ||
382 | trans->rpc = p9_virtio_rpc; | 358 | trans->rpc = p9_virtio_rpc; |
383 | trans->priv = chan; | 359 | trans->priv = chan; |
384 | 360 | ||