From patchwork Wed Dec 26 10:52:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [7/8] vhost: set started flag while start is in progress Date: Wed, 26 Dec 2012 00:52:42 -0000 From: "Michael S. Tsirkin" X-Patchwork-Id: 208165 Message-Id: <9cce4f7971df53927ff787635a1b909f79507af6.1356519046.git.mst@redhat.com> To: qemu-devel@nongnu.org, asias@redhat.com, stefanha@redhat.com This makes it possible to use started flag for sanity checking of callbacks that happen during start/stop. Signed-off-by: Michael S. Tsirkin --- hw/vhost.c | 7 +++++-- 1 file 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; }