[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH v2 08/25] qemu: command: Make BuildVirtioDevStr more generic



On 01/24/2019 11:57 AM, Andrea Bolognani wrote:
> On Thu, 2019-01-24 at 17:48 +0100, Andrea Bolognani wrote:
>> On Wed, 2019-01-23 at 16:32 -0500, Cole Robinson wrote:
>> [...]
>>> +/**
>>> + * qemuBuildVirtioDevStr
>>> + * @buf: virBufferPtr to append the built string
>>> + * @baseName: qemu virtio device basename string. Ex: virtio-rng for <rng>
>>> + * @devtype: virDomainDeviceType of the device. Ex: VIR_DOMAIN_DEVICE_TYPE_RNG
>>> + * @devdata: *DefPtr of the device definition
>>> + *
>>> + * Build the qemu virtio -device name from the passed parameters. Currently
>>> + * this is mostly about attaching the correct string prefix to @baseName for
>>> + * the passed @type. So for @baseName "virtio-rng" and devdata->info.type
>>> + * VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI, generate "virtio-rng-pci"
>>> + *
>>> + * Returns: -1 on failure, 0 on success
>>> + */
>>>  static int
>>>  qemuBuildVirtioDevStr(virBufferPtr buf,
>>>                        const char *baseName,
>>> -                      virDomainDeviceAddressType type)
>>> +                      virDomainDeviceType devtype,
>>> +                      void *devdata)
>>>  {
>>>      const char *implName = NULL;
>>> +    virDomainDeviceDef device = { .type = devtype };
>>> +    virDomainDeviceInfoPtr info;
>>>  
>>> -    switch (type) {
>>> +    virDomainDeviceSetData(&device, devdata);
>>> +    info = virDomainDeviceGetInfo(&device);
>>> +
>>> +    switch (info->type) {
>>
>> You should cast info->type to virDomainDeviceAddressType here to
>> force the compiler to check the switch statements covers all
>> possible values.
>>
>> With that fixed,
>>
>>   Reviewed-by: Andrea Bolognani <abologna redhat com>
> 
> Small additional note: I won't be able to review more patches until
> next week, but since everything up until here makes sense even in
> isolation and there were only minor / cosmetic issues, feel free to
> take care of those and then push away :)
> 

Great, thanks for all the help. I pushed 1-8 with your suggestions,
minus the memballoon bit I responded to

- Cole


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]