From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36837) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bttGO-0007QV-KB for qemu-devel@nongnu.org; Tue, 11 Oct 2016 05:22:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bttGM-00069E-Fz for qemu-devel@nongnu.org; Tue, 11 Oct 2016 05:22:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47080) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bttGM-000692-66 for qemu-devel@nongnu.org; Tue, 11 Oct 2016 05:22:18 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BCFA815D9 for ; Tue, 11 Oct 2016 09:22:17 +0000 (UTC) From: Ladi Prosek Date: Tue, 11 Oct 2016 11:22:03 +0200 Message-Id: <1476177724-28712-2-git-send-email-lprosek@redhat.com> In-Reply-To: <1476177724-28712-1-git-send-email-lprosek@redhat.com> References: <1476177724-28712-1-git-send-email-lprosek@redhat.com> Subject: [Qemu-devel] [PATCH 1/2] virtio: rename virtqueue_discard to virtqueue_unpop List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, mst@redhat.com The function undoes the effect of virtqueue_pop and doesn't do anything destructive or irreversible so virtqueue_unpop is a more fitting name. Signed-off-by: Ladi Prosek --- hw/net/virtio-net.c | 2 +- hw/virtio/virtio-balloon.c | 2 +- hw/virtio/virtio.c | 6 +++--- include/hw/virtio/virtio.h | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 6b8ae2c..b3780f0 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1171,7 +1171,7 @@ static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t * must have consumed the complete packet. * Otherwise, drop it. */ if (!n->mergeable_rx_bufs && offset < size) { - virtqueue_discard(q->rx_vq, elem, total); + virtqueue_unpop(q->rx_vq, elem, total); g_free(elem); return size; } diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 49a2f4a..a159fbf 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -463,7 +463,7 @@ static void virtio_balloon_device_reset(VirtIODevice *vdev) VirtIOBalloon *s = VIRTIO_BALLOON(vdev); if (s->stats_vq_elem != NULL) { - virtqueue_discard(s->svq, s->stats_vq_elem, 0); + virtqueue_unpop(s->svq, s->stats_vq_elem, 0); g_free(s->stats_vq_elem); s->stats_vq_elem = NULL; } diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 18ce333..12cef6c 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -264,8 +264,8 @@ static void virtqueue_unmap_sg(VirtQueue *vq, const VirtQueueElement *elem, 0, elem->out_sg[i].iov_len); } -void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem, - unsigned int len) +void virtqueue_unpop(VirtQueue *vq, const VirtQueueElement *elem, + unsigned int len) { vq->last_avail_idx--; vq->inuse--; @@ -279,7 +279,7 @@ void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem, * Pretend that elements weren't popped from the virtqueue. The next * virtqueue_pop() will refetch the oldest element. * - * Use virtqueue_discard() instead if you have a VirtQueueElement. + * Use virtqueue_unpop() instead if you have a VirtQueueElement. * * Returns: true on success, false if @num is greater than the number of in use * elements. diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index 888c8de..5d12434 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -155,8 +155,8 @@ 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); -void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem, - unsigned int len); +void virtqueue_unpop(VirtQueue *vq, const VirtQueueElement *elem, + unsigned int len); bool virtqueue_rewind(VirtQueue *vq, unsigned int num); void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem, unsigned int len, unsigned int idx); -- 2.5.5