Skip to content

Commit

Permalink
9pfs: factor out virtio_9p_push_and_notify
Browse files Browse the repository at this point in the history
The new function resides in virtio specific file.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
  • Loading branch information
Wei Liu authored and kvaneesh committed Jan 8, 2016
1 parent ebe74f8 commit 0d3716b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
11 changes: 11 additions & 0 deletions hw/9pfs/virtio-9p-device.c
Expand Up @@ -20,6 +20,17 @@
#include "coth.h"
#include "hw/virtio/virtio-access.h"

void virtio_9p_push_and_notify(V9fsPDU *pdu)
{
V9fsState *s = pdu->s;

/* push onto queue and notify */
virtqueue_push(s->vq, &pdu->elem, pdu->size);

/* FIXME: we should batch these completions */
virtio_notify(VIRTIO_DEVICE(s), s->vq);
}

static uint64_t virtio_9p_get_features(VirtIODevice *vdev, uint64_t features,
Error **errp)
{
Expand Down
8 changes: 1 addition & 7 deletions hw/9pfs/virtio-9p.c
Expand Up @@ -65,13 +65,7 @@ ssize_t pdu_unmarshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...)

static void pdu_push_and_notify(V9fsPDU *pdu)
{
V9fsState *s = pdu->s;

/* push onto queue and notify */
virtqueue_push(s->vq, &pdu->elem, pdu->size);

/* FIXME: we should batch these completions */
virtio_notify(VIRTIO_DEVICE(s), s->vq);
virtio_9p_push_and_notify(pdu);
}

static int omode_to_uflags(int8_t mode)
Expand Down
2 changes: 2 additions & 0 deletions hw/9pfs/virtio-9p.h
Expand Up @@ -6,6 +6,8 @@
#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,
const char *fmt, va_list ap);
ssize_t virtio_pdu_vunmarshal(V9fsPDU *pdu, size_t offset,
Expand Down

0 comments on commit 0d3716b

Please sign in to comment.