From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLDqi-0001cT-3d for qemu-devel@nongnu.org; Tue, 10 Feb 2015 11:39:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLDqc-0000Ud-Jb for qemu-devel@nongnu.org; Tue, 10 Feb 2015 11:39:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42640) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLDqc-0000UV-D6 for qemu-devel@nongnu.org; Tue, 10 Feb 2015 11:39:38 -0500 Message-ID: <1423586371.22865.812.camel@redhat.com> From: Alex Williamson Date: Tue, 10 Feb 2015 09:39:31 -0700 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC v3 07/10] vfio_pci: change vfio device features bit macro to enum definition List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chen Fan Cc: izumi.taku@jp.fujitsu.com, qemu-devel@nongnu.org On Tue, 2015-02-10 at 15:03 +0800, Chen Fan wrote: > Introduce an independent enum structure to define the features bitmap, > it would be good for adding new features definition. > > Signed-off-by: Chen Fan > --- > hw/vfio/pci.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c > index 75c932b..bf314a1 100644 > --- a/hw/vfio/pci.c > +++ b/hw/vfio/pci.c > @@ -134,6 +134,12 @@ typedef struct VFIOMSIXInfo { > void *mmap; > } VFIOMSIXInfo; > > +/* Bits in VFIOPCIDevice features field. */ > +enum { > +#define VFIO_FEATURE_ENABLE_VGA_BIT 0 > + VFIO_FEATURE_ENABLE_VGA = (1 << VFIO_FEATURE_ENABLE_VGA_BIT), > +}; > + As commented last time, I don't see why making this an enum helps anything. If anything, the bits could be an enum, but it makes no sense to me to put the feature mask into an enum. > typedef struct VFIOPCIDevice { > PCIDevice pdev; > VFIODevice vbasedev; > @@ -154,8 +160,6 @@ typedef struct VFIOPCIDevice { > PCIHostDeviceAddress host; > EventNotifier err_notifier; > uint32_t features; > -#define VFIO_FEATURE_ENABLE_VGA_BIT 0 > -#define VFIO_FEATURE_ENABLE_VGA (1 << VFIO_FEATURE_ENABLE_VGA_BIT) > int32_t bootindex; > uint8_t pm_cap; > bool has_vga;