[libvirt] [PATCH 1/4] qemu: hostdev: Unify naming for qemuPrepareHost*Devices()

Laine Stump laine at laine.org
Thu Oct 22 00:40:39 UTC 2015


On 10/21/2015 06:44 PM, John Ferlan wrote:
>
> On 10/20/2015 11:20 AM, Andrea Bolognani wrote:
>> No functional changes.
>> ---
>>   src/qemu/qemu_hostdev.c | 40 ++++++++++++++++++++--------------------
>>   src/qemu/qemu_hostdev.h | 22 +++++++++++-----------
>>   src/qemu/qemu_hotplug.c |  9 ++++-----
>>   3 files changed, 35 insertions(+), 36 deletions(-)
>>
>> diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
>> index 706db0c..a4409d6 100644
>> --- a/src/qemu/qemu_hostdev.c
>> +++ b/src/qemu/qemu_hostdev.c
>> @@ -156,9 +156,9 @@ qemuHostdevHostSupportsPassthroughLegacy(void)
>>   
>>   
>>   static bool
>> -qemuPrepareHostdevPCICheckSupport(virDomainHostdevDefPtr *hostdevs,
>> -                                  size_t nhostdevs,
>> -                                  virQEMUCapsPtr qemuCaps)
>> +qemuPrepareHostPCIDevicesCheckSupport(virDomainHostdevDefPtr *hostdevs,
>> +                                      size_t nhostdevs,
>> +                                      virQEMUCapsPtr qemuCaps)
>>   {
>>       bool supportsPassthroughKVM = qemuHostdevHostSupportsPassthroughLegacy();
>>       bool supportsPassthroughVFIO = qemuHostdevHostSupportsPassthroughVFIO();
>> @@ -219,18 +219,18 @@ qemuPrepareHostdevPCICheckSupport(virDomainHostdevDefPtr *hostdevs,
>>   }
>>   
>>   int
>> -qemuPrepareHostdevPCIDevices(virQEMUDriverPtr driver,
>> -                             const char *name,
>> -                             const unsigned char *uuid,
>> -                             virDomainHostdevDefPtr *hostdevs,
>> -                             int nhostdevs,
>> -                             virQEMUCapsPtr qemuCaps,
>> -                             unsigned int flags)
>> +qemuPrepareHostPCIDevices(virQEMUDriverPtr driver,
>> +                          const char *name,
>> +                          const unsigned char *uuid,
>> +                          virDomainHostdevDefPtr *hostdevs,
>> +                          int nhostdevs,
>> +                          virQEMUCapsPtr qemuCaps,
>> +                          unsigned int flags)
>>   {
>>       int ret = -1;
>>       virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
>>   
>> -    if (!qemuPrepareHostdevPCICheckSupport(hostdevs, nhostdevs, qemuCaps))
>> +    if (!qemuPrepareHostPCIDevicesCheckSupport(hostdevs, nhostdevs, qemuCaps))
>>           goto out;
>>   
>>       ret = virHostdevPreparePCIDevices(hostdev_mgr, QEMU_DRIVER_NAME,
> Typically when searching I can change the "virDomainFoo" type string to
> a "qemuDomainFoo" string and find the qemu API.  Here those you'll see
> there's a virHostDevPreparePCIDevices(), so in a way I'd expect a
> qemuHostdevPreparePCIDevices
>
> Since is a "qemu_hostdev.{c,h}" type change, then theoretically all the
> API's in here should be qemuHostdevFoo, right?
>
>
> Rather than qemuPrepareFoo, qemuUpdateFoo, and qemuDomainReAttachFoo
> It'd be qemuHostdevPrepare, qemuHostdevUpdate, and qemuHostdevReAttach
>
> and your new API would be qemuHostdevUpdateActiveDevices

I had a similar reply queued up, but got interrupted by dinner:

You've changes all Hostdev into Host, but in all of these cases they 
really are <hostdev> devices, so I think the function name is clearer if 
it has Hostdev in it rather than Host.

Also, if we're going to normalize the names, it might be better to try 
and fit in with the naming convention that we've tried to start using in 
other places - virModuleNameModifierAction or 
virModuleNameActionModifier (or in the case of functions in the qemu 
directory qemuModuleNameModifierAction() or 
qemuModuleNameActionModifier()), for example virNetdevMacVLanCreate(). 
So instead of qemuPrepareHostdevPCIDevices() it could maybe be 
qemuHostdevPCIPrepareDevices(), qemuHostdevUSBPrepareDevices() and 
qemuHostdevSCSIPrepareDevices() (or maybe qemuHostdev*DevicesPrepare(), 
depending on how anal you want to be about putting the verb at the end)





More information about the libvir-list mailing list