qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH RFC 5/6] vhost-user: send log shm fd along with log_


From: Marc-André Lureau
Subject: [Qemu-devel] [PATCH RFC 5/6] vhost-user: send log shm fd along with log_base
Date: Thu, 23 Jul 2015 03:36:42 +0200

Send the shm for the dirty pages logging if the backend support
VHOST_USER_PROTOCOL_F_LOG_SHMFD.

Signed-off-by: Marc-André Lureau <address@hidden>
---
 hw/virtio/vhost-user.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 4993b63..fe75618 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -26,7 +26,9 @@
 #define VHOST_MEMORY_MAX_NREGIONS    8
 
 #define VHOST_USER_F_PROTOCOL_FEATURES 30
-#define VHOST_USER_PROTOCOL_FEATURE_MASK 0x0ULL
+
+#define VHOST_USER_PROTOCOL_FEATURE_MASK 0x1ULL
+#define VHOST_USER_PROTOCOL_F_LOG_SHMFD 0
 
 typedef enum VhostUserRequest {
     VHOST_USER_NONE = 0,
@@ -213,8 +215,15 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned 
long int request,
         need_reply = 1;
         break;
 
-    case VHOST_USER_SET_FEATURES:
     case VHOST_USER_SET_LOG_BASE:
+        if (__virtio_has_feature(dev->protocol_features,
+                                 VHOST_USER_PROTOCOL_F_LOG_SHMFD) &&
+            dev->log->fd != -1) {
+            fds[fd_num++] = dev->log->fd;
+        }
+        /* fall through */
+
+    case VHOST_USER_SET_FEATURES:
         msg.u64 = *((__u64 *) arg);
         msg.size = sizeof(m.u64);
         break;
-- 
2.4.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]