Re: [PATCH 3/9] datatypes: Rename @parent to @parentName in virNodeDevice

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

 



On Fri, Apr 13, 2018 at 04:47:10PM +0200, Michal Privoznik wrote:
> In next patches this name will be needed for a different memeber.
> Also, it makes sense to rename the variable because it does not
> contain reference to parent device, just its name.
>
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/conf/virnodedeviceobj.c          | 2 +-
>  src/datatypes.c                      | 2 +-
>  src/datatypes.h                      | 2 +-
>  src/libvirt-nodedev.c                | 6 +++---
>  src/node_device/node_device_driver.c | 4 ++--
>  src/test/test_driver.c               | 6 +++---
>  6 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c
> index ad0f27ee47..9d2996046f 100644
> --- a/src/conf/virnodedeviceobj.c
> +++ b/src/conf/virnodedeviceobj.c
> @@ -870,7 +870,7 @@ virNodeDeviceObjListExportCallback(void *payload,
>          virNodeDeviceMatch(obj, data->flags)) {
>          if (data->devices) {
>              if (!(device = virGetNodeDevice(data->conn, def->name)) ||
> -                VIR_STRDUP(device->parent, def->parent) < 0) {
> +                VIR_STRDUP(device->parentName, def->parent) < 0) {
>                  virObjectUnref(device);
>                  data->error = true;
>                  goto cleanup;
> diff --git a/src/datatypes.c b/src/datatypes.c
> index f7eef24ba8..0c3c66a9ce 100644
> --- a/src/datatypes.c
> +++ b/src/datatypes.c
> @@ -653,7 +653,7 @@ virNodeDeviceDispose(void *obj)
>      VIR_DEBUG("release dev %p %s", dev, dev->name);
>
>      VIR_FREE(dev->name);
> -    VIR_FREE(dev->parent);
> +    VIR_FREE(dev->parentName);
>
>      virObjectUnref(dev->conn);
>  }
> diff --git a/src/datatypes.h b/src/datatypes.h
> index 1a8ea01ba3..66733b075c 100644
> --- a/src/datatypes.h
> +++ b/src/datatypes.h
> @@ -618,7 +618,7 @@ struct _virNodeDevice {
>      virObject object;
>      virConnectPtr conn;                 /* pointer back to the connection */
>      char *name;                         /* device name (unique on node) */
> -    char *parent;                       /* parent device name */
> +    char *parentName;                   /* parent device name */
>  };
>
>  /**
> diff --git a/src/libvirt-nodedev.c b/src/libvirt-nodedev.c
> index 563ce889b9..8ced3cea0e 100644
> --- a/src/libvirt-nodedev.c
> +++ b/src/libvirt-nodedev.c
> @@ -346,16 +346,16 @@ virNodeDeviceGetParent(virNodeDevicePtr dev)
>
>      virCheckNodeDeviceReturn(dev, NULL);
>
> -    if (!dev->parent) {
> +    if (!dev->parentName) {
>          if (dev->conn->nodeDeviceDriver && dev->conn->nodeDeviceDriver->nodeDeviceGetParent) {
> -            dev->parent = dev->conn->nodeDeviceDriver->nodeDeviceGetParent(dev);
> +            dev->parentName = dev->conn->nodeDeviceDriver->nodeDeviceGetParent(dev);

Since you're adjusting the struct member name, you could go as far as fixing
the *GetParent accessor's name too.

With that:
Reviewed-by: Erik Skultety <eskultet@xxxxxxxxxx>

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux