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(a)redhat.com>
---
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);
} else {
virReportUnsupportedError();
virDispatchError(dev->conn);
return NULL;
}
}
- return dev->parent;
+ return dev->parentName;
}
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 61afa1f8eb..d04a31747a 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -256,7 +256,7 @@ nodeDeviceLookupByName(virConnectPtr conn,
goto cleanup;
if ((device = virGetNodeDevice(conn, name))) {
- if (VIR_STRDUP(device->parent, def->parent) < 0) {
+ if (VIR_STRDUP(device->parentName, def->parent) < 0) {
virObjectUnref(device);
device = NULL;
}
@@ -290,7 +290,7 @@ nodeDeviceLookupSCSIHostByWWN(virConnectPtr conn,
goto cleanup;
if ((device = virGetNodeDevice(conn, def->name))) {
- if (VIR_STRDUP(device->parent, def->parent) < 0) {
+ if (VIR_STRDUP(device->parentName, def->parent) < 0) {
virObjectUnref(device);
device = NULL;
}
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index eec7a82924..f5b5e3ee8d 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -5416,7 +5416,7 @@ testNodeDeviceLookupByName(virConnectPtr conn, const char *name)
def = virNodeDeviceObjGetDef(obj);
if ((ret = virGetNodeDevice(conn, name))) {
- if (VIR_STRDUP(ret->parent, def->parent) < 0) {
+ if (VIR_STRDUP(ret->parentName, def->parent) < 0) {
virObjectUnref(ret);
ret = NULL;
}
@@ -5641,8 +5641,8 @@ testNodeDeviceCreateXML(virConnectPtr conn,
if (!(dev = virGetNodeDevice(conn, objdef->name)))
goto cleanup;
- VIR_FREE(dev->parent);
- if (VIR_STRDUP(dev->parent, def->parent) < 0)
+ VIR_FREE(dev->parentName);
+ if (VIR_STRDUP(dev->parentName, def->parent) < 0)
goto cleanup;
ret = dev;
--
2.16.1