[libvirt] [PATCH 2/2] qemu: Unify generation of command line for virtio devices

Ján Tomko jtomko at redhat.com
Tue Sep 4 15:51:32 UTC 2018


On Tue, Sep 04, 2018 at 05:32:51PM +0200, Andrea Bolognani wrote:
>On Tue, 2018-09-04 at 16:09 +0200, Ján Tomko wrote:
>> On Fri, Aug 31, 2018 at 04:03:10PM +0200, Andrea Bolognani wrote:
>> > +static char*
>> > +qemuBuildVirtioDevStr(const virDomainDeviceInfo *info,
>> > +                      const char *baseName)
>[...]
>> > +    virBufferAsprintf(&buf, "%s-%s", baseName, implName);
>>
>> buf is used exactly once in this function, could have been just
>> virAsprintf.
>>
>> Or, even better, since all the calls are followed by adding the string
>> to a buffer, just pass the buffer as the function argument.
>
>I did it that way initially, but then I changed it to return
>a char* to be consistent with other qemuBuild*DevStr(). I can
>definitely change it back, but perhaps a different name would
>be more appropriate at that point.
>

OTOH, many qemuBuild.*Str which only build a repetitive part of the
string have a virBuffer as the first argument.

If the DevStr inconsistency bothers you, maybe
'qemuBuildVirtioDeviceStr' or qemuBuildVirtioDeviceSuffix{,Str}?

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180904/186e0031/attachment-0001.sig>


More information about the libvir-list mailing list