From: Thibaut Collet Date: Fri, 9 Oct 2015 15:17:33 +0000 (+0200) Subject: vhost-user: use an enum helper for features mask X-Git-Tag: v2.5.0-rc0~57^2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=de1372d466fb4a7bed13f64f50bff14aaa4a5931;p=thirdparty%2Fqemu.git 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 [Adapted from mailing list discussion - Marc-André] Signed-off-by: Marc-André Lureau Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Tested-by: Thibaut Collet --- diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index d804c5f565f..78442ba980b 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,