summaryrefslogtreecommitdiff
path: root/hw/virtio
diff options
context:
space:
mode:
authorThibaut Collet <thibaut.collet@6wind.com>2015-10-09 17:17:33 +0200
committerMichael S. Tsirkin <mst@redhat.com>2015-10-22 14:34:49 +0300
commitde1372d466fb4a7bed13f64f50bff14aaa4a5931 (patch)
treee957bb3efdf5db99d8204f6808c195303155ebdb /hw/virtio
parent3e866365e1eb6bcfa2d01c21debb05b9e47a47f7 (diff)
downloadqemu-de1372d466fb4a7bed13f64f50bff14aaa4a5931.tar.gz
vhost-user: use an enum helper for features mask
The VHOST_USER_PROTOCOL_FEATURE_MASK will be automatically updated when adding new features to the enum. Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com> [Adapted from mailing list discussion - Marc-André] Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
Diffstat (limited to 'hw/virtio')
-rw-r--r--hw/virtio/vhost-user.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index d804c5f565..78442ba980 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,