diff options
author | Wei Liu <wei.liu2@citrix.com> | 2016-01-07 18:37:25 +0000 |
---|---|---|
committer | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2016-01-08 15:31:25 +0530 |
commit | 0192cc5d796a0bdf679b786c7244ec5211be6791 (patch) | |
tree | a9b87f4c3425de22b1d30b65b63a8459ecf77974 /hw/9pfs | |
parent | 4b311c5f0b298bef6880656f00c628526a827081 (diff) |
9pfs: move handle_9p_output and make it static function
It's only used in virtio device.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Diffstat (limited to 'hw/9pfs')
-rw-r--r-- | hw/9pfs/virtio-9p-device.c | 34 | ||||
-rw-r--r-- | hw/9pfs/virtio-9p.c | 33 | ||||
-rw-r--r-- | hw/9pfs/virtio-9p.h | 1 |
3 files changed, 34 insertions, 34 deletions
diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c index cfad13afe7..bc103b7fa7 100644 --- a/hw/9pfs/virtio-9p-device.c +++ b/hw/9pfs/virtio-9p-device.c @@ -19,6 +19,7 @@ #include "9p-xattr.h" #include "coth.h" #include "hw/virtio/virtio-access.h" +#include "qemu/iov.h" void virtio_9p_push_and_notify(V9fsPDU *pdu) { @@ -31,6 +32,39 @@ void virtio_9p_push_and_notify(V9fsPDU *pdu) virtio_notify(VIRTIO_DEVICE(s), s->vq); } +static void handle_9p_output(VirtIODevice *vdev, VirtQueue *vq) +{ + V9fsState *s = (V9fsState *)vdev; + V9fsPDU *pdu; + ssize_t len; + + while ((pdu = pdu_alloc(s)) && + (len = virtqueue_pop(vq, &pdu->elem)) != 0) { + struct { + uint32_t size_le; + uint8_t id; + uint16_t tag_le; + } QEMU_PACKED out; + int len; + + BUG_ON(pdu->elem.out_num == 0 || pdu->elem.in_num == 0); + QEMU_BUILD_BUG_ON(sizeof out != 7); + + len = iov_to_buf(pdu->elem.out_sg, pdu->elem.out_num, 0, + &out, sizeof out); + BUG_ON(len != sizeof out); + + pdu->size = le32_to_cpu(out.size_le); + + pdu->id = out.id; + pdu->tag = le16_to_cpu(out.tag_le); + + qemu_co_queue_init(&pdu->complete); + pdu_submit(pdu); + } + pdu_free(pdu); +} + static uint64_t virtio_9p_get_features(VirtIODevice *vdev, uint64_t features, Error **errp) { diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c index 3d5140d1e3..7fb0524098 100644 --- a/hw/9pfs/virtio-9p.c +++ b/hw/9pfs/virtio-9p.c @@ -3266,39 +3266,6 @@ void pdu_submit(V9fsPDU *pdu) qemu_coroutine_enter(co, pdu); } -void handle_9p_output(VirtIODevice *vdev, VirtQueue *vq) -{ - V9fsState *s = (V9fsState *)vdev; - V9fsPDU *pdu; - ssize_t len; - - while ((pdu = pdu_alloc(s)) && - (len = virtqueue_pop(vq, &pdu->elem)) != 0) { - struct { - uint32_t size_le; - uint8_t id; - uint16_t tag_le; - } QEMU_PACKED out; - int len; - - BUG_ON(pdu->elem.out_num == 0 || pdu->elem.in_num == 0); - QEMU_BUILD_BUG_ON(sizeof out != 7); - - len = iov_to_buf(pdu->elem.out_sg, pdu->elem.out_num, 0, - &out, sizeof out); - BUG_ON(len != sizeof out); - - pdu->size = le32_to_cpu(out.size_le); - - pdu->id = out.id; - pdu->tag = le16_to_cpu(out.tag_le); - - qemu_co_queue_init(&pdu->complete); - pdu_submit(pdu); - } - pdu_free(pdu); -} - static void __attribute__((__constructor__)) virtio_9p_set_fd_limit(void) { struct rlimit rlim; diff --git a/hw/9pfs/virtio-9p.h b/hw/9pfs/virtio-9p.h index a1ac3980ee..474ab94c08 100644 --- a/hw/9pfs/virtio-9p.h +++ b/hw/9pfs/virtio-9p.h @@ -5,7 +5,6 @@ #include "hw/virtio/virtio.h" #include "9p.h" -extern void handle_9p_output(VirtIODevice *vdev, VirtQueue *vq); extern void virtio_9p_push_and_notify(V9fsPDU *pdu); ssize_t virtio_pdu_vmarshal(V9fsPDU *pdu, size_t offset, |