aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2012-12-25 17:41:07 +0200
committerMichael S. Tsirkin <mst@redhat.com>2013-01-07 19:42:23 +0200
commit24f4fe345c1b80bab1ee18573914123d8028a9e6 (patch)
tree45f067ffa3e2e6473d159ca0756aa1de38714155 /hw
parent1830b80ff29dbd9d149f7f3cb565a690b5d5994c (diff)
downloadqemu-24f4fe345c1b80bab1ee18573914123d8028a9e6.zip
qemu-24f4fe345c1b80bab1ee18573914123d8028a9e6.tar.gz
qemu-24f4fe345c1b80bab1ee18573914123d8028a9e6.tar.bz2
vhost: set started flag while start is in progress
This makes it possible to use started flag for sanity checking of callbacks that happen during start/stop. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/vhost.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/hw/vhost.c b/hw/vhost.c
index b6d73ca..4fa5007 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -873,6 +873,9 @@ void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev)
int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
{
int i, r;
+
+ hdev->started = true;
+
if (!vdev->binding->set_guest_notifiers) {
fprintf(stderr, "binding does not support guest notifiers\n");
r = -ENOSYS;
@@ -918,8 +921,6 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
}
}
- hdev->started = true;
-
return 0;
fail_log:
fail_vq:
@@ -934,6 +935,8 @@ fail_features:
vdev->binding->set_guest_notifiers(vdev->binding_opaque, hdev->nvqs, false);
fail_notifiers:
fail:
+
+ hdev->started = false;
return r;
}