[libvirt] [PATCH v2 7/7] tests: Use virBitmap for qemu command line caps

Jiri Denemark jdenemar at redhat.com
Thu Feb 24 11:31:35 UTC 2011


On Tue, Feb 22, 2011 at 10:50:53 -0700, Eric Blake wrote:
> On 02/22/2011 09:48 AM, Jiri Denemark wrote:
> > +static void printMismatchedFlags(virBitmapPtr got,
> > +                                 virBitmapPtr expect)
> >  {
> >      int i;
> >  
> > -    for (i = 0 ; i < (sizeof(got)*CHAR_BIT) ; i++) {
> > -        unsigned long long gotFlag = (got & (1LL << i));
> > -        unsigned long long expectFlag = (expect & (1LL << i));
> > +    for (i = 0 ; i < QEMU_CAPS_LAST ; i++) {
> > +        bool gotFlag = qemuCapsGet(got, i);
> > +        bool expectFlag = qemuCapsGet(expect, i);
> >          if (gotFlag && !expectFlag)
> >              fprintf(stderr, "Extra flag %i\n", i);
> 
> Hmm - debugging this will now be slightly harder.  Before, "extra flag
> 37" meant looking for (1LL << 37) in qemu_capabilities.h, but now we
> need to count 37 lines.  Perhaps you should amend the change in
> qemu_capabilities.h to preserve the integer numbering of each capability:
> 
> +    QEMU_CAPS_KQEMU = 0,          /* Whether KQEMU is compiled in */
> +    QEMU_CAPS_VNC_COLON = 1,      /* Does the VNC take just port, or
> address + display */

Makes sense. I reintroduced the explicit numbering there. Although once we
start saving the flags in XML configuration of running domains, we can get rid
of the numbering completely since we will be able to output flag names instead
of just numbers.

> ACK with that nit fixed.

Thanks. I squashed this patch into the previous one before pushing it.

Jirka




More information about the libvir-list mailing list