diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2012-04-06 10:38:37 +0200 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-04-19 10:31:05 +0200 |
| commit | c80decdbd9ea679a17f6b0202ea1df0f840e4828 (patch) | |
| tree | ed5069b043ef7cb003ff400a45a1347e7d85302f /hw/virtio.c | |
| parent | fcf104a74cb8d6d39dc935ab692afface3beab30 (diff) | |
| download | focaccia-qemu-c80decdbd9ea679a17f6b0202ea1df0f840e4828.tar.gz focaccia-qemu-c80decdbd9ea679a17f6b0202ea1df0f840e4828.zip | |
virtio: add virtio_queue_get_id
Serializing virtio-scsi requests needs a simple way to get from a VirtQueue to the number of the queue. The virtio_queue_get_id provides this. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/virtio.c')
| -rw-r--r-- | hw/virtio.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/virtio.c b/hw/virtio.c index 064aecf553..314abf8a18 100644 --- a/hw/virtio.c +++ b/hw/virtio.c @@ -624,6 +624,13 @@ int virtio_queue_get_num(VirtIODevice *vdev, int n) return vdev->vq[n].vring.num; } +int virtio_queue_get_id(VirtQueue *vq) +{ + VirtIODevice *vdev = vq->vdev; + assert(vq >= &vdev->vq[0] && vq < &vdev->vq[VIRTIO_PCI_QUEUE_MAX]); + return vq - &vdev->vq[0]; +} + void virtio_queue_notify_vq(VirtQueue *vq) { if (vq->vring.desc) { |