diff mbox

[v2,2/2] virtio: make virtqueue_alloc_element static

Message ID 1478163350-17339-3-git-send-email-lprosek@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ladi Prosek Nov. 3, 2016, 8:55 a.m. UTC
The function does not fully initialize the returned VirtQueueElement and should
be used only internally from the virtio module.

Signed-off-by: Ladi Prosek <lprosek@redhat.com>
---
 hw/virtio/virtio.c         | 2 +-
 include/hw/virtio/virtio.h | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

Comments

Cornelia Huck Nov. 4, 2016, 8:32 a.m. UTC | #1
On Thu,  3 Nov 2016 09:55:50 +0100
Ladi Prosek <lprosek@redhat.com> wrote:

> The function does not fully initialize the returned VirtQueueElement and should
> be used only internally from the virtio module.
> 
> Signed-off-by: Ladi Prosek <lprosek@redhat.com>
> ---
>  hw/virtio/virtio.c         | 2 +-
>  include/hw/virtio/virtio.h | 1 -
>  2 files changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>

...although I'm wondering if the callers could not pass in the index
value as well? (Still keeping this internal to virtio.c makes sense.)
diff mbox

Patch

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 68971fd..2471722 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -633,7 +633,7 @@  void virtqueue_map(VirtQueueElement *elem)
                         VIRTQUEUE_MAX_SIZE, 0);
 }
 
-void *virtqueue_alloc_element(size_t sz, unsigned out_num, unsigned in_num)
+static void *virtqueue_alloc_element(size_t sz, unsigned out_num, unsigned in_num)
 {
     VirtQueueElement *elem;
     size_t in_addr_ofs = QEMU_ALIGN_UP(sz, __alignof__(elem->in_addr[0]));
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 95adaca..0deafb7 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -151,7 +151,6 @@  VirtQueue *virtio_add_queue_aio(VirtIODevice *vdev, int queue_size,
 
 void virtio_del_queue(VirtIODevice *vdev, int n);
 
-void *virtqueue_alloc_element(size_t sz, unsigned out_num, unsigned in_num);
 void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem,
                     unsigned int len);
 void virtqueue_flush(VirtQueue *vq, unsigned int count);