[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 24/24] vhost-user: use an enum helper for feature
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH v6 24/24] vhost-user: use an enum helper for features mask |
Date: |
Tue, 29 Sep 2015 18:34:54 +0200 |
From: Thibaut Collet <address@hidden>
The VHOST_USER_PROTOCOL_FEATURE_MASK will be automatically updated when
adding new features to the enum.
Signed-off-by: Thibaut Collet <address@hidden>
[Adapted from mailing list discussion - Marc-André]
Signed-off-by: Marc-André Lureau <address@hidden>
---
hw/virtio/vhost-user.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 1716e4f..ea5b817 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -28,10 +28,15 @@
#define VHOST_MEMORY_MAX_NREGIONS 8
#define VHOST_USER_F_PROTOCOL_FEATURES 30
-#define VHOST_USER_PROTOCOL_FEATURE_MASK 0x7ULL
-#define VHOST_USER_PROTOCOL_F_MQ 0
-#define VHOST_USER_PROTOCOL_F_LOG_SHMFD 1
-#define VHOST_USER_PROTOCOL_F_RARP 2
+enum VhostUserProtocolFeature {
+ VHOST_USER_PROTOCOL_F_MQ = 0,
+ VHOST_USER_PROTOCOL_F_LOG_SHMFD = 1,
+ VHOST_USER_PROTOCOL_F_RARP = 2,
+
+ VHOST_USER_PROTOCOL_F_MAX
+};
+
+#define VHOST_USER_PROTOCOL_FEATURE_MASK ((1 << VHOST_USER_PROTOCOL_F_MAX) - 1)
typedef enum VhostUserRequest {
VHOST_USER_NONE = 0,
--
2.4.3
- [Qemu-devel] [PATCH v6 14/24] vhost-user: document migration log, (continued)
- [Qemu-devel] [PATCH v6 16/24] vhost user: add support of live migration, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 23/24] vhost-user-test: check ownership during migration, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 22/24] vhost-user-test: add live-migration test, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 24/24] vhost-user: use an enum helper for features mask,
marcandre . lureau <=
- [Qemu-devel] [PATCH v6 01/24] vhost-user: unit test for new messages, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 04/24] util: add linux-only memfd fallback, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 07/24] vhost: document log resizing, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 12/24] vhost-user: add a migration blocker, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 03/24] linux-headers: add unistd.h, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 17/24] vhost user: add rarp sending after live migration for legacy guest, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 20/24] vhost-user-test: wrap server in TestServer struct, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 02/24] configure: probe for memfd, marcandre . lureau, 2015/10/08