From patchwork Fri Oct 9 15:17:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 528376 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:4830:134:3::10]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 16BB21402B2 for ; Sat, 10 Oct 2015 05:18:17 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=zmvd8ho1; dkim-atps=neutral Received: from lists.gnu.org ([208.118.235.17]:46980) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkcFD-0005ex-9t for incoming@patchwork.ozlabs.org; Fri, 09 Oct 2015 14:18:15 -0400 Received: from localhost ([::1]:41103 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkcFC-0001ac-M8 for incoming@patchwork.ozlabs.org; Fri, 09 Oct 2015 14:18:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkZRZ-0001yM-It for qemu-devel@nongnu.org; Fri, 09 Oct 2015 11:18:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkZRW-00083T-CB for qemu-devel@nongnu.org; Fri, 09 Oct 2015 11:18:49 -0400 Received: from mail-qg0-x229.google.com ([2607:f8b0:400d:c04::229]:33192) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkZRW-00083P-8P for qemu-devel@nongnu.org; Fri, 09 Oct 2015 11:18:46 -0400 Received: by qgew37 with SMTP id w37so12685728qge.0 for ; Fri, 09 Oct 2015 08:18:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=U1dAWoEcdyQKfz/Qz3v8+zs27deMqJmg7QTawEcKBLQ=; b=zmvd8ho1tDsjtaqIzNtKHMrFvAN3yRyzy+Z9IDgAVzDRfpKilxkcMUdG+fFxmB8xyE 9LNQrjC10azl2ut0OIblWJ4GVD28n36KxJRJ2fQpF8kXTy8Mb0kbZgsBwMZfs78lznGM GI07ezU36LtT8ynHO0vGT249VwvoRNer3bXCHnwu5MNRYjixHbOny/cfo6tCoQuqqm9W rixt9u8MgXSd16w00XWNUBb1LUlahugrWT1AhlxvHrBZ6uo+TRTd8Ee5m6YU4NPBqWqG vpM4AnZZhp50Jfvd/L+Cf6v7nEw/CwSZZoMDyJiHuAbZOMTb02TntGDMCGABeWR+k6vo C2gQ== X-Received: by 10.140.34.208 with SMTP id l74mr2716686qgl.61.1444403925877; Fri, 09 Oct 2015 08:18:45 -0700 (PDT) Received: from localhost (bne75-h02-31-39-163-232.dsl.sta.abo.bbox.fr. [31.39.163.232]) by smtp.gmail.com with ESMTPSA id 79sm833313qhw.4.2015.10.09.08.18.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Oct 2015 08:18:45 -0700 (PDT) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Fri, 9 Oct 2015 17:17:33 +0200 Message-Id: <1444403861-3240-20-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1444403861-3240-1-git-send-email-marcandre.lureau@redhat.com> References: <1444403861-3240-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c04::229 Cc: haifeng.lin@huawei.com, mst@redhat.com, thibaut.collet@6wind.com, jasowang@redhat.com, pbonzini@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [Qemu-devel] [PATCH v8 19/27] vhost-user: use an enum helper for features mask X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x From: Thibaut Collet 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 --- 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 890506a..8b4ea0f 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,