On Thu, Nov 30, 2017 at 02:23:45PM +0800, Peter Xu wrote: > On Wed, Nov 29, 2017 at 07:46:25PM +1100, David Gibson wrote: > > [...] > > > struct PCIBus { > > BusState qbus; > > + enum PCIBusFlags flags; > > PCIIOMMUFunc iommu_fn; > > void *iommu_opaque; > > uint8_t devfn_min; > > @@ -440,8 +446,12 @@ struct PCIBus { > > Notifier machine_done; > > }; > > I would prefer directly defining flags as uint64_t then it's more > clear that it's a bitmask (enum let me think of only one flag will be > set, but I may be wrong), but it's fine too to me.
In most languages an enum would only allow one value to be set, but C enums are weird - they're basically just a funny way of defining integer constants. I'm not particularly bothered either way: using the enum type makes it clear the right set of constants to use with this field, using an int makes it clearer that bit flags can be set. So both options are slightly misleading in different ways. If there's another vote for uint64_t over using the enum, I'll change it. > Reviewed-by: Peter Xu <pet...@redhat.com> > -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature