diff mbox

[4/5] kvm tools: drop virt_queue__get_used_elem virtio helper

Message ID 1302279007-15710-4-git-send-email-asias.hejun@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Asias He April 8, 2011, 4:10 p.m. UTC
Use virt_queue__set_used_elem insted.

Signed-off-by: Asias He <asias.hejun@gmail.com>
---
 tools/kvm/include/kvm/virtio.h |    6 ------
 tools/kvm/virtio-blk.c         |    5 +----
 2 files changed, 1 insertions(+), 10 deletions(-)
diff mbox

Patch

diff --git a/tools/kvm/include/kvm/virtio.h b/tools/kvm/include/kvm/virtio.h
index 075387d..9f892a1 100644
--- a/tools/kvm/include/kvm/virtio.h
+++ b/tools/kvm/include/kvm/virtio.h
@@ -26,12 +26,6 @@  static inline struct vring_desc *virt_queue__get_desc(struct virt_queue *queue,
 	return &queue->vring.desc[desc_ndx];
 }
 
-static inline struct vring_used_elem *virt_queue__get_used_elem(struct virt_queue *queue)
-{
-	return &queue->vring.used->ring[queue->vring.used->idx++ % queue->vring.num];
-}
-
-
 static inline bool virt_queue__available(struct virt_queue *vq)
 {
 	return vq->vring.avail->idx !=  vq->last_avail_idx;
diff --git a/tools/kvm/virtio-blk.c b/tools/kvm/virtio-blk.c
index a41d5ac..8351e7a 100644
--- a/tools/kvm/virtio-blk.c
+++ b/tools/kvm/virtio-blk.c
@@ -100,7 +100,6 @@  static bool virtio_blk_pci_io_in(struct kvm *self, uint16_t port, void *data, in
 
 static bool virtio_blk_request(struct kvm *self, struct virt_queue *queue)
 {
-	struct vring_used_elem *used_elem;
 	struct virtio_blk_outhdr *req;
 	uint16_t desc_block_last;
 	struct vring_desc *desc;
@@ -190,9 +189,7 @@  static bool virtio_blk_request(struct kvm *self, struct virt_queue *queue)
 
 	*status			= err_cnt ? VIRTIO_BLK_S_IOERR : VIRTIO_BLK_S_OK;
 
-	used_elem		= virt_queue__get_used_elem(queue);
-	used_elem->id		= desc_hdr;
-	used_elem->len		= block_cnt;
+	virt_queue__set_used_elem(queue, desc_hdr, block_cnt);
 
 	return true;
 }