[libvirt] [PATCH v3 03/12] nodedev: Use common naming for virnodedeviceobj

Erik Skultety eskultet at redhat.com
Thu Jun 29 13:49:41 UTC 2017


On Sat, Jun 03, 2017 at 09:11:53AM -0400, John Ferlan wrote:
> A virNodeDeviceObjPtr is an @obj
>
> A virNodeDeviceObjListPtr is an @devs

There was some argument that this messes up with history in terms of nt
introducing any functional change, thus making it harder to go through the
commits and search for something relevant - true, can be painful as hell, but
truth to be told, long are the times gone when that was actually the case,
given the number of pure code movements etc. we had. And to me, consistency
which enhances readability even slightly matters to me a lot.

[..]

> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/conf/virnodedeviceobj.c | 124 ++++++++++++++++++++++----------------------
>  1 file changed, 62 insertions(+), 62 deletions(-)
>
> diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c
> index fa73de1..3aff5ca 100644
> --- a/src/conf/virnodedeviceobj.c
> +++ b/src/conf/virnodedeviceobj.c
> @@ -41,10 +41,10 @@ virNodeDeviceObjGetDef(virNodeDeviceObjPtr obj)
>
>
>  static int
> -virNodeDeviceObjHasCap(const virNodeDeviceObj *dev,
> +virNodeDeviceObjHasCap(const virNodeDeviceObj *obj,
>                         const char *cap)
>  {
> -    virNodeDevCapsDefPtr caps = dev->def->caps;
> +    virNodeDevCapsDefPtr caps = obj->def->caps;
>      const char *fc_host_cap =
>          virNodeDevCapTypeToString(VIR_NODE_DEV_CAP_FC_HOST);
>      const char *vports_cap =
> @@ -105,9 +105,9 @@ virNodeDeviceObjHasCap(const virNodeDeviceObj *dev,
>   * Pointer to the caps or NULL if not found
>   */
>  static virNodeDevCapsDefPtr
> -virNodeDeviceFindFCCapDef(const virNodeDeviceObj *dev)
> +virNodeDeviceFindFCCapDef(const virNodeDeviceObj *obj)

You should update the name of the var in the function commentary as well.

>  {
> -    virNodeDevCapsDefPtr caps = dev->def->caps;
> +    virNodeDevCapsDefPtr caps = obj->def->caps;
>
>      while (caps) {
>          if (caps->data.type == VIR_NODE_DEV_CAP_SCSI_HOST &&
> @@ -129,9 +129,9 @@ virNodeDeviceFindFCCapDef(const virNodeDeviceObj *dev)
>   * Pointer to the caps or NULL if not found
>   */
>  static virNodeDevCapsDefPtr
> -virNodeDeviceFindVPORTCapDef(const virNodeDeviceObj *dev)
> +virNodeDeviceFindVPORTCapDef(const virNodeDeviceObj *obj)

Here too.

[..]

> @@ -333,15 +333,15 @@ virNodeDeviceObjRemove(virNodeDeviceObjListPtr devs,
>   *   parent_host value on success (>= 0), -1 otherwise.
>   */
>  static int
> -virNodeDeviceFindFCParentHost(virNodeDeviceObjPtr parent)
> +virNodeDeviceFindFCParentHost(virNodeDeviceObjPtr obj)

Here too.

ACK

Erik




More information about the libvir-list mailing list