Use "virNodeDeviceObj" as a prefix for any external API in virnodedeviceobj
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/conf/virnodedeviceobj.c | 28 ++++++++++++++--------------
src/conf/virnodedeviceobj.h | 18 +++++++++---------
src/libvirt_private.syms | 10 +++++-----
src/node_device/node_device_driver.c | 24 ++++++++++++------------
src/node_device/node_device_hal.c | 10 ++++------
src/node_device/node_device_udev.c | 12 ++++++------
src/test/test_driver.c | 28 ++++++++++++++--------------
7 files changed, 64 insertions(+), 66 deletions(-)
diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c
index f37e597..3fe3ae5 100644
--- a/src/conf/virnodedeviceobj.c
+++ b/src/conf/virnodedeviceobj.c
@@ -34,8 +34,8 @@ VIR_LOG_INIT("conf.virnodedeviceobj");
int
-virNodeDeviceHasCap(const virNodeDeviceObj *dev,
- const char *cap)
+virNodeDeviceObjHasCap(const virNodeDeviceObj *dev,
+ const char *cap)
{
virNodeDevCapsDefPtr caps = dev->def->caps;
const char *fc_host_cap =
@@ -109,8 +109,8 @@ virNodeDeviceFindVPORTCapDef(const virNodeDeviceObj *dev)
virNodeDeviceObjPtr
-virNodeDeviceFindBySysfsPath(virNodeDeviceObjListPtr devs,
- const char *sysfs_path)
+virNodeDeviceObjFindBySysfsPath(virNodeDeviceObjListPtr devs,
+ const char *sysfs_path)
{
size_t i;
@@ -128,8 +128,8 @@ virNodeDeviceFindBySysfsPath(virNodeDeviceObjListPtr devs,
virNodeDeviceObjPtr
-virNodeDeviceFindByName(virNodeDeviceObjListPtr devs,
- const char *name)
+virNodeDeviceObjFindByName(virNodeDeviceObjListPtr devs,
+ const char *name)
{
size_t i;
@@ -192,7 +192,7 @@ virNodeDeviceFindByCap(virNodeDeviceObjListPtr devs,
for (i = 0; i < devs->count; i++) {
virNodeDeviceObjLock(devs->objs[i]);
- if (virNodeDeviceHasCap(devs->objs[i], cap))
+ if (virNodeDeviceObjHasCap(devs->objs[i], cap))
return devs->objs[i];
virNodeDeviceObjUnlock(devs->objs[i]);
}
@@ -229,12 +229,12 @@ virNodeDeviceObjListFree(virNodeDeviceObjListPtr devs)
virNodeDeviceObjPtr
-virNodeDeviceAssignDef(virNodeDeviceObjListPtr devs,
- virNodeDeviceDefPtr def)
+virNodeDeviceObjAssignDef(virNodeDeviceObjListPtr devs,
+ virNodeDeviceDefPtr def)
{
virNodeDeviceObjPtr device;
- if ((device = virNodeDeviceFindByName(devs, def->name))) {
+ if ((device = virNodeDeviceObjFindByName(devs, def->name))) {
virNodeDeviceDefFree(device->def);
device->def = def;
return device;
@@ -323,7 +323,7 @@ virNodeDeviceGetParentHostByParent(virNodeDeviceObjListPtr devs,
virNodeDeviceObjPtr parent = NULL;
int ret;
- if (!(parent = virNodeDeviceFindByName(devs, parent_name))) {
+ if (!(parent = virNodeDeviceObjFindByName(devs, parent_name))) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Could not find parent device for '%s'"),
dev_name);
@@ -407,9 +407,9 @@ virNodeDeviceFindVportParentHost(virNodeDeviceObjListPtr devs)
int
-virNodeDeviceGetParentHost(virNodeDeviceObjListPtr devs,
- virNodeDeviceDefPtr def,
- int create)
+virNodeDeviceObjGetParentHost(virNodeDeviceObjListPtr devs,
+ virNodeDeviceDefPtr def,
+ int create)
{
int parent_host = -1;
diff --git a/src/conf/virnodedeviceobj.h b/src/conf/virnodedeviceobj.h
index 6ad7fb1..b4409b7 100644
--- a/src/conf/virnodedeviceobj.h
+++ b/src/conf/virnodedeviceobj.h
@@ -40,24 +40,24 @@ struct _virNodeDeviceDriverState {
};
-int virNodeDeviceHasCap(const virNodeDeviceObj *dev, const char *cap);
+int virNodeDeviceObjHasCap(const virNodeDeviceObj *dev, const char *cap);
-virNodeDeviceObjPtr virNodeDeviceFindByName(virNodeDeviceObjListPtr devs,
+virNodeDeviceObjPtr virNodeDeviceObjFindByName(virNodeDeviceObjListPtr devs,
const char *name);
virNodeDeviceObjPtr
-virNodeDeviceFindBySysfsPath(virNodeDeviceObjListPtr devs,
- const char *sysfs_path)
+virNodeDeviceObjFindBySysfsPath(virNodeDeviceObjListPtr devs,
+ const char *sysfs_path)
ATTRIBUTE_NONNULL(2);
-virNodeDeviceObjPtr virNodeDeviceAssignDef(virNodeDeviceObjListPtr devs,
- virNodeDeviceDefPtr def);
+virNodeDeviceObjPtr virNodeDeviceObjAssignDef(virNodeDeviceObjListPtr devs,
+ virNodeDeviceDefPtr def);
void virNodeDeviceObjRemove(virNodeDeviceObjListPtr devs,
virNodeDeviceObjPtr *dev);
-int virNodeDeviceGetParentHost(virNodeDeviceObjListPtr devs,
- virNodeDeviceDefPtr def,
- int create);
+int virNodeDeviceObjGetParentHost(virNodeDeviceObjListPtr devs,
+ virNodeDeviceDefPtr def,
+ int create);
void virNodeDeviceObjFree(virNodeDeviceObjPtr dev);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 8639979..aed1d3d 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -949,11 +949,11 @@ virDomainObjListRename;
# conf/virnodedeviceobj.h
-virNodeDeviceAssignDef;
-virNodeDeviceFindByName;
-virNodeDeviceFindBySysfsPath;
-virNodeDeviceGetParentHost;
-virNodeDeviceHasCap;
+virNodeDeviceObjAssignDef;
+virNodeDeviceObjFindByName;
+virNodeDeviceObjFindBySysfsPath;
+virNodeDeviceObjGetParentHost;
+virNodeDeviceObjHasCap;
virNodeDeviceObjListExport;
virNodeDeviceObjListFree;
virNodeDeviceObjLock;
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 5d57006..0869b1b 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -173,7 +173,7 @@ nodeNumOfDevices(virConnectPtr conn,
virNodeDeviceObjLock(obj);
if (virNodeNumOfDevicesCheckACL(conn, obj->def) &&
((cap == NULL) ||
- virNodeDeviceHasCap(obj, cap)))
+ virNodeDeviceObjHasCap(obj, cap)))
++ndevs;
virNodeDeviceObjUnlock(obj);
}
@@ -202,7 +202,7 @@ nodeListDevices(virConnectPtr conn,
virNodeDeviceObjLock(obj);
if (virNodeListDevicesCheckACL(conn, obj->def) &&
(cap == NULL ||
- virNodeDeviceHasCap(obj, cap))) {
+ virNodeDeviceObjHasCap(obj, cap))) {
if (VIR_STRDUP(names[ndevs++], obj->def->name) < 0) {
virNodeDeviceObjUnlock(obj);
goto failure;
@@ -249,7 +249,7 @@ nodeDeviceLookupByName(virConnectPtr conn, const char *name)
virNodeDevicePtr ret = NULL;
nodeDeviceLock();
- obj = virNodeDeviceFindByName(&driver->devs, name);
+ obj = virNodeDeviceObjFindByName(&driver->devs, name);
nodeDeviceUnlock();
if (!obj) {
@@ -337,7 +337,7 @@ nodeDeviceGetXMLDesc(virNodeDevicePtr dev,
virCheckFlags(0, NULL);
nodeDeviceLock();
- obj = virNodeDeviceFindByName(&driver->devs, dev->name);
+ obj = virNodeDeviceObjFindByName(&driver->devs, dev->name);
nodeDeviceUnlock();
if (!obj) {
@@ -370,7 +370,7 @@ nodeDeviceGetParent(virNodeDevicePtr dev)
char *ret = NULL;
nodeDeviceLock();
- obj = virNodeDeviceFindByName(&driver->devs, dev->name);
+ obj = virNodeDeviceObjFindByName(&driver->devs, dev->name);
nodeDeviceUnlock();
if (!obj) {
@@ -407,7 +407,7 @@ nodeDeviceNumOfCaps(virNodeDevicePtr dev)
int ret = -1;
nodeDeviceLock();
- obj = virNodeDeviceFindByName(&driver->devs, dev->name);
+ obj = virNodeDeviceObjFindByName(&driver->devs, dev->name);
nodeDeviceUnlock();
if (!obj) {
@@ -452,7 +452,7 @@ nodeDeviceListCaps(virNodeDevicePtr dev, char **const names, int
maxnames)
int ret = -1;
nodeDeviceLock();
- obj = virNodeDeviceFindByName(&driver->devs, dev->name);
+ obj = virNodeDeviceObjFindByName(&driver->devs, dev->name);
nodeDeviceUnlock();
if (!obj) {
@@ -590,8 +590,8 @@ nodeDeviceCreateXML(virConnectPtr conn,
if (virNodeDeviceGetWWNs(def, &wwnn, &wwpn) == -1)
goto cleanup;
- if ((parent_host = virNodeDeviceGetParentHost(&driver->devs, def,
- CREATE_DEVICE)) < 0)
+ if ((parent_host = virNodeDeviceObjGetParentHost(&driver->devs, def,
+ CREATE_DEVICE)) < 0)
goto cleanup;
if (virVHBAManageVport(parent_host, wwpn, wwnn, VPORT_CREATE) < 0)
@@ -625,7 +625,7 @@ nodeDeviceDestroy(virNodeDevicePtr dev)
int parent_host = -1;
nodeDeviceLock();
- if (!(obj = virNodeDeviceFindByName(&driver->devs, dev->name))) {
+ if (!(obj = virNodeDeviceObjFindByName(&driver->devs, dev->name))) {
virReportError(VIR_ERR_NO_NODE_DEVICE,
_("no node device with matching name '%s'"),
dev->name);
@@ -645,8 +645,8 @@ nodeDeviceDestroy(virNodeDevicePtr dev)
def = obj->def;
virNodeDeviceObjUnlock(obj);
obj = NULL;
- if ((parent_host = virNodeDeviceGetParentHost(&driver->devs, def,
- EXISTING_DEVICE)) < 0)
+ if ((parent_host = virNodeDeviceObjGetParentHost(&driver->devs, def,
+ EXISTING_DEVICE)) < 0)
goto cleanup;
if (virVHBAManageVport(parent_host, wwpn, wwnn, VPORT_DELETE) < 0)
diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c
index fb7bf25..f17618c 100644
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -493,9 +493,7 @@ dev_create(const char *udi)
/* Some devices don't have a path in sysfs, so ignore failure */
(void)get_str_prop(ctx, udi, "linux.sysfs_path", &devicePath);
- dev = virNodeDeviceAssignDef(&driver->devs,
- def);
-
+ dev = virNodeDeviceObjAssignDef(&driver->devs, def);
if (!dev) {
VIR_FREE(devicePath);
goto failure;
@@ -525,7 +523,7 @@ dev_refresh(const char *udi)
virNodeDeviceObjPtr dev;
nodeDeviceLock();
- dev = virNodeDeviceFindByName(&driver->devs, name);
+ dev = virNodeDeviceObjFindByName(&driver->devs, name);
if (dev) {
/* Simply "rediscover" device -- incrementally handling changes
* to sub-capabilities (like net.80203) is nasty ... so avoid it.
@@ -557,7 +555,7 @@ device_removed(LibHalContext *ctx ATTRIBUTE_UNUSED,
virNodeDeviceObjPtr dev;
nodeDeviceLock();
- dev = virNodeDeviceFindByName(&driver->devs, name);
+ dev = virNodeDeviceObjFindByName(&driver->devs, name);
VIR_DEBUG("%s", name);
if (dev)
virNodeDeviceObjRemove(&driver->devs, &dev);
@@ -575,7 +573,7 @@ device_cap_added(LibHalContext *ctx,
virNodeDeviceObjPtr dev;
nodeDeviceLock();
- dev = virNodeDeviceFindByName(&driver->devs, name);
+ dev = virNodeDeviceObjFindByName(&driver->devs, name);
nodeDeviceUnlock();
VIR_DEBUG("%s %s", cap, name);
if (dev) {
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 1016075..6bc0a53 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1099,7 +1099,7 @@ static int udevRemoveOneDevice(struct udev_device *device)
int ret = -1;
name = udev_device_get_syspath(device);
- dev = virNodeDeviceFindBySysfsPath(&driver->devs, name);
+ dev = virNodeDeviceObjFindBySysfsPath(&driver->devs, name);
if (!dev) {
VIR_DEBUG("Failed to find device to remove that has udev name
'%s'",
@@ -1146,8 +1146,8 @@ static int udevSetParent(struct udev_device *device,
goto cleanup;
}
- dev = virNodeDeviceFindBySysfsPath(&driver->devs,
- parent_sysfs_path);
+ dev = virNodeDeviceObjFindBySysfsPath(&driver->devs,
+ parent_sysfs_path);
if (dev != NULL) {
if (VIR_STRDUP(def->parent, dev->def->name) < 0) {
virNodeDeviceObjUnlock(dev);
@@ -1203,7 +1203,7 @@ static int udevAddOneDevice(struct udev_device *device)
if (udevSetParent(device, def) != 0)
goto cleanup;
- dev = virNodeDeviceFindByName(&driver->devs, def->name);
+ dev = virNodeDeviceObjFindByName(&driver->devs, def->name);
if (dev) {
virNodeDeviceObjUnlock(dev);
new_device = false;
@@ -1211,7 +1211,7 @@ static int udevAddOneDevice(struct udev_device *device)
/* If this is a device change, the old definition will be freed
* and the current definition will take its place. */
- dev = virNodeDeviceAssignDef(&driver->devs, def);
+ dev = virNodeDeviceObjAssignDef(&driver->devs, def);
if (dev == NULL)
goto cleanup;
@@ -1492,7 +1492,7 @@ static int udevSetupSystemDev(void)
udevGetDMIData(&def->caps->data);
#endif
- dev = virNodeDeviceAssignDef(&driver->devs, def);
+ dev = virNodeDeviceObjAssignDef(&driver->devs, def);
if (dev == NULL)
goto cleanup;
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index c6214c6..61c82b9 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1166,7 +1166,7 @@ testParseNodedevs(testDriverPtr privconn,
if (!def)
goto error;
- if (!(obj = virNodeDeviceAssignDef(&privconn->devs, def))) {
+ if (!(obj = virNodeDeviceObjAssignDef(&privconn->devs, def))) {
virNodeDeviceDefFree(def);
goto error;
}
@@ -5424,7 +5424,7 @@ testNodeNumOfDevices(virConnectPtr conn,
testDriverLock(driver);
for (i = 0; i < driver->devs.count; i++)
if ((cap == NULL) ||
- virNodeDeviceHasCap(driver->devs.objs[i], cap))
+ virNodeDeviceObjHasCap(driver->devs.objs[i], cap))
++ndevs;
testDriverUnlock(driver);
@@ -5448,7 +5448,7 @@ testNodeListDevices(virConnectPtr conn,
for (i = 0; i < driver->devs.count && ndevs < maxnames; i++) {
virNodeDeviceObjLock(driver->devs.objs[i]);
if (cap == NULL ||
- virNodeDeviceHasCap(driver->devs.objs[i], cap)) {
+ virNodeDeviceObjHasCap(driver->devs.objs[i], cap)) {
if (VIR_STRDUP(names[ndevs++], driver->devs.objs[i]->def->name) <
0) {
virNodeDeviceObjUnlock(driver->devs.objs[i]);
goto failure;
@@ -5476,7 +5476,7 @@ testNodeDeviceLookupByName(virConnectPtr conn, const char *name)
virNodeDevicePtr ret = NULL;
testDriverLock(driver);
- obj = virNodeDeviceFindByName(&driver->devs, name);
+ obj = virNodeDeviceObjFindByName(&driver->devs, name);
testDriverUnlock(driver);
if (!obj) {
@@ -5508,7 +5508,7 @@ testNodeDeviceGetXMLDesc(virNodeDevicePtr dev,
virCheckFlags(0, NULL);
testDriverLock(driver);
- obj = virNodeDeviceFindByName(&driver->devs, dev->name);
+ obj = virNodeDeviceObjFindByName(&driver->devs, dev->name);
testDriverUnlock(driver);
if (!obj) {
@@ -5534,7 +5534,7 @@ testNodeDeviceGetParent(virNodeDevicePtr dev)
char *ret = NULL;
testDriverLock(driver);
- obj = virNodeDeviceFindByName(&driver->devs, dev->name);
+ obj = virNodeDeviceObjFindByName(&driver->devs, dev->name);
testDriverUnlock(driver);
if (!obj) {
@@ -5568,7 +5568,7 @@ testNodeDeviceNumOfCaps(virNodeDevicePtr dev)
int ret = -1;
testDriverLock(driver);
- obj = virNodeDeviceFindByName(&driver->devs, dev->name);
+ obj = virNodeDeviceObjFindByName(&driver->devs, dev->name);
testDriverUnlock(driver);
if (!obj) {
@@ -5599,7 +5599,7 @@ testNodeDeviceListCaps(virNodeDevicePtr dev, char **const names, int
maxnames)
int ret = -1;
testDriverLock(driver);
- obj = virNodeDeviceFindByName(&driver->devs, dev->name);
+ obj = virNodeDeviceObjFindByName(&driver->devs, dev->name);
testDriverUnlock(driver);
if (!obj) {
@@ -5647,7 +5647,7 @@ testNodeDeviceMockCreateVport(testDriverPtr driver,
* using the scsi_host11 definition, changing the name and the
* scsi_host capability fields before calling virNodeDeviceAssignDef
* to add the def to the node device objects list. */
- if (!(objcopy = virNodeDeviceFindByName(&driver->devs,
"scsi_host11")))
+ if (!(objcopy = virNodeDeviceObjFindByName(&driver->devs,
"scsi_host11")))
goto cleanup;
xml = virNodeDeviceDefFormat(objcopy->def);
@@ -5687,7 +5687,7 @@ testNodeDeviceMockCreateVport(testDriverPtr driver,
caps = caps->next;
}
- if (!(obj = virNodeDeviceAssignDef(&driver->devs, def)))
+ if (!(obj = virNodeDeviceObjAssignDef(&driver->devs, def)))
goto cleanup;
def = NULL;
@@ -5730,7 +5730,7 @@ testNodeDeviceCreateXML(virConnectPtr conn,
/* Unlike the "real" code we don't need the parent_host in order to
* call virVHBAManageVport, but still let's make sure the code finds
* something valid and no one messed up the mock environment. */
- if (virNodeDeviceGetParentHost(&driver->devs, def, CREATE_DEVICE) < 0)
+ if (virNodeDeviceObjGetParentHost(&driver->devs, def, CREATE_DEVICE) < 0)
goto cleanup;
/* In the real code, we'd call virVHBAManageVport followed by
@@ -5772,7 +5772,7 @@ testNodeDeviceDestroy(virNodeDevicePtr dev)
virObjectEventPtr event = NULL;
testDriverLock(driver);
- obj = virNodeDeviceFindByName(&driver->devs, dev->name);
+ obj = virNodeDeviceObjFindByName(&driver->devs, dev->name);
testDriverUnlock(driver);
if (!obj) {
@@ -5796,8 +5796,8 @@ testNodeDeviceDestroy(virNodeDevicePtr dev)
/* We do this just for basic validation, but also avoid finding a
* vport capable HBA if for some reason our vHBA doesn't exist */
- if (virNodeDeviceGetParentHost(&driver->devs, obj->def,
- EXISTING_DEVICE) < 0) {
+ if (virNodeDeviceObjGetParentHost(&driver->devs, obj->def,
+ EXISTING_DEVICE) < 0) {
obj = NULL;
goto out;
}
--
2.9.3