diff options
author | Thomas Huth <thuth@redhat.com> | 2017-01-17 14:16:41 +0100 |
---|---|---|
committer | Alexey Kardashevskiy <aik@ozlabs.ru> | 2017-02-03 13:42:21 +1100 |
commit | f8ad6d0ae9c2861e2106580d7a2b8f72e95fb29f (patch) | |
tree | 6c5918c389c79867e8126521be734d4a160221f8 /lib/libvirtio/virtio-blk.c | |
parent | ba46a3f133c8532a517779cc3763e8ac2409d626 (diff) | |
download | SLOF-f8ad6d0ae9c2861e2106580d7a2b8f72e95fb29f.zip SLOF-f8ad6d0ae9c2861e2106580d7a2b8f72e95fb29f.tar.gz SLOF-f8ad6d0ae9c2861e2106580d7a2b8f72e95fb29f.tar.bz2 |
virtio: Remove global variables in block and 9p driver
No need for a global variable to store the virtqueue information here,
thus let's remove the global vq variable and make it local to the
init function instead.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Diffstat (limited to 'lib/libvirtio/virtio-blk.c')
-rw-r--r-- | lib/libvirtio/virtio-blk.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/libvirtio/virtio-blk.c b/lib/libvirtio/virtio-blk.c index cdfdd10..9eea99d 100644 --- a/lib/libvirtio/virtio-blk.c +++ b/lib/libvirtio/virtio-blk.c @@ -21,8 +21,6 @@ #define DEFAULT_SECTOR_SIZE 512 #define DRIVER_FEATURE_SUPPORT (VIRTIO_BLK_F_BLK_SIZE | VIRTIO_F_VERSION_1) -static struct vqs vq; - /** * Initialize virtio-block device. * @param dev pointer to virtio device information @@ -30,7 +28,7 @@ static struct vqs vq; int virtioblk_init(struct virtio_device *dev) { - struct vring_avail *vq_avail; + struct vqs vq; int blk_size = DEFAULT_SECTOR_SIZE; uint64_t features; int status = VIRTIO_STAT_ACKNOWLEDGE; @@ -59,9 +57,8 @@ virtioblk_init(struct virtio_device *dev) if (virtio_queue_init_vq(dev, &vq, 0)) goto dev_error; - vq_avail = virtio_get_vring_avail(dev, 0); - vq_avail->flags = virtio_cpu_to_modern16(dev, VRING_AVAIL_F_NO_INTERRUPT); - vq_avail->idx = 0; + vq.avail->flags = virtio_cpu_to_modern16(dev, VRING_AVAIL_F_NO_INTERRUPT); + vq.avail->idx = 0; /* Tell HV that setup succeeded */ status |= VIRTIO_STAT_DRIVER_OK; |