[fedora-virt] [PATCH 3/7] vhost: move vhost_set_vq_addr

Michael S. Tsirkin mst at redhat.com
Wed Feb 24 19:09:51 UTC 2010


Move function in file: we'll add another
call site in the following patch.

Signed-off-by: Michael S. Tsirkin <mst at redhat.com>
---
 hw/vhost.c |   38 +++++++++++++++++++-------------------
 1 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/hw/vhost.c b/hw/vhost.c
index 3c54596..54386e1 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -306,6 +306,25 @@ static void vhost_client_set_memory(CPUPhysMemoryClient *client,
 	}
 }
 
+static int vhost_virtqueue_set_addr(struct vhost_dev *dev,
+				    struct vhost_virtqueue *vq,
+				    unsigned idx, bool enable_log)
+{
+	struct vhost_vring_addr addr = {
+		.index = idx,
+		.desc_user_addr = (u_int64_t)(unsigned long)vq->desc,
+		.avail_user_addr = (u_int64_t)(unsigned long)vq->avail,
+		.used_user_addr = (u_int64_t)(unsigned long)vq->used,
+		.log_guest_addr = vq->used_phys,
+		.flags = enable_log ? (1 << VHOST_VRING_F_LOG) : 0,
+	};
+	int r = ioctl(dev->control, VHOST_SET_VRING_ADDR, &addr);
+	if (r < 0) {
+		return -errno;
+	}
+	return 0;
+}
+
 static int vhost_dev_set_log(struct vhost_dev *dev, bool enable_log)
 {
 	uint64_t features = dev->acked_features;
@@ -350,25 +369,6 @@ static int vhost_client_migration_log(struct CPUPhysMemoryClient *client,
 	return 0;
 }
 
-static int vhost_virtqueue_set_addr(struct vhost_dev *dev,
-				    struct vhost_virtqueue *vq,
-				    unsigned idx, bool enable_log)
-{
-	struct vhost_vring_addr addr = {
-		.index = idx,
-		.desc_user_addr = (u_int64_t)(unsigned long)vq->desc,
-		.avail_user_addr = (u_int64_t)(unsigned long)vq->avail,
-		.used_user_addr = (u_int64_t)(unsigned long)vq->used,
-		.log_guest_addr = vq->used_phys,
-		.flags = enable_log ? (1 << VHOST_VRING_F_LOG) : 0,
-	};
-	int r = ioctl(dev->control, VHOST_SET_VRING_ADDR, &addr);
-	if (r < 0) {
-		return -errno;
-	}
-	return 0;
-}
-
 static int vhost_virtqueue_init(struct vhost_dev *dev,
 				struct VirtIODevice *vdev,
 				struct vhost_virtqueue *vq,
-- 
1.7.0.18.g0d53a5



More information about the virt mailing list