[Libvir] [PATCH] Add bus attribute to disk target definition

Jim Meyering jim at meyering.net
Tue Apr 29 14:22:31 UTC 2008

"Daniel P. Berrange" <berrange at redhat.com> wrote:

> On Tue, Apr 29, 2008 at 04:10:40PM +0200, Soren Hansen wrote:
>> On Tue, Apr 29, 2008 at 02:27:00PM +0100, Daniel P. Berrange wrote:
>> >> +    if (!bus)
>> >> +        disk->bus = QEMUD_DISK_BUS_IDE;
>> >> +    else if (!strcmp((const char *)bus, "ide"))
>> >> +        disk->bus = QEMUD_DISK_BUS_IDE;
>> >> +    else if (!strcmp((const char *)bus, "scsi"))
>> >> +        disk->bus = QEMUD_DISK_BUS_SCSI;
>> >> +    else if (!strcmp((const char *)bus, "virtio"))
>> >> +        disk->bus = QEMUD_DISK_BUS_VIRTIO;
>> > Can you use the   STREQ   macro here instead of strcmp.
>> Erm... I *could*.. I'm curious, though, why e.g. the similar code right
>> above it doesn't use STREQ if that's the preferred way to do it?
> We've been slowly updating code to match these new standards when doing
> patches.

FYI, there's already a test for this, but it's currently disabled.
If someone wants to turn it on (remove the sc_prohibit_strcmp
line from Makefile.cfg) and fix all the new violations exposed
by running "make syntax-check", it sounds like it would be welcome, now.

>> > You can run 'make syntax-check' for check for such issues.
>> Yes, in theory :)  In the real world, however, "make syntax-check" fails
>> horribly here. I'll be fixing that up next.
> If you send details to the list,  Jim will no doubt be able to point you
> in the right direction on this...

Yep.  Though most of it is intended to be self explanatory.
If not, please let me know and I'll fix the rules in Makefile.maint.

More information about the libvir-list mailing list