From patchwork Wed Jan 30 16:41:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2/4] vhost: add set_vhost_endpoint and clear_vhost_endpoint callbacks Date: Wed, 30 Jan 2013 06:41:24 -0000 From: Paolo Bonzini X-Patchwork-Id: 216951 Message-Id: <1359564086-19705-3-git-send-email-pbonzini@redhat.com> To: qemu-devel@nongnu.org Cc: asias@redhat.com, stefanha@linux.vnet.ibm.com, nab@linux-iscsi.org, mst@redhat.com Needed for vhost-scsi, see previous commit. Signed-off-by: Paolo Bonzini --- hw/vhost.c | 9 +++++++++ hw/virtio.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/hw/vhost.c b/hw/vhost.c index edb6b08..09fa4e1 100644 --- a/hw/vhost.c +++ b/hw/vhost.c @@ -985,6 +985,12 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev) goto fail_vq; } } + if (vdev->set_vhost_endpoint) { + r = vdev->set_vhost_endpoint(vdev); + if (r < 0) { + goto fail_vq; + } + } for (j = 0; j < hdev->nvqs; ++j) { r = vhost_virtqueue_start(hdev, @@ -1051,6 +1057,9 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev) } assert (r >= 0); + if (vdev->clear_vhost_endpoint) { + vdev->clear_vhost_endpoint(vdev); + } hdev->started = false; g_free(hdev->log); hdev->log = NULL; diff --git a/hw/virtio.h b/hw/virtio.h index 9cc7b85..dd37d59 100644 --- a/hw/virtio.h +++ b/hw/virtio.h @@ -134,6 +134,8 @@ struct VirtIODevice */ uint32_t (*get_features)(VirtIODevice *vdev, uint32_t requested_features); uint32_t (*bad_features)(VirtIODevice *vdev); + int (*set_vhost_endpoint)(VirtIODevice *vdev); + void (*clear_vhost_endpoint)(VirtIODevice *vdev); void (*set_features)(VirtIODevice *vdev, uint32_t val); void (*get_config)(VirtIODevice *vdev, uint8_t *config); void (*set_config)(VirtIODevice *vdev, const uint8_t *config);