It's only relevant for QEMU driver. Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> --- src/libvirt_private.syms | 1 - src/qemu/qemu_domain.c | 38 ++++++++++++++++++++++++++++++++------ src/util/virstoragefile.c | 25 ------------------------- src/util/virstoragefile.h | 5 ----- 4 files changed, 32 insertions(+), 37 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index c325040b60..84b650cb86 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3175,7 +3175,6 @@ virStorageSourceChainHasManagedPR; virStorageSourceChainHasNVMe; virStorageSourceClear; virStorageSourceCopy; -virStorageSourceFindByNodeName; virStorageSourceGetActualType; virStorageSourceGetSecurityLabelDef; virStorageSourceHasBacking; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index dd79cfd9d9..966608882f 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2582,6 +2582,32 @@ qemuDomainObjPrivateXMLParseBlockjobChain(xmlNodePtr node, } +/** + * qemuDomainVirStorageSourceFindByNodeName: + * @top: backing chain top + * @nodeName: node name to find in backing chain + * + * Looks up the given storage source in the backing chain and returns the + * pointer to it. + * On failure NULL is returned and no error is reported. + */ +static virStorageSourcePtr +qemuDomainVirStorageSourceFindByNodeName(virStorageSourcePtr top, + const char *nodeName) +{ + virStorageSourcePtr tmp; + + for (tmp = top; virStorageSourceIsBacking(tmp); tmp = tmp->backingStore) { + if ((tmp->nodeformat && STREQ(tmp->nodeformat, nodeName)) || + (tmp->nodestorage && STREQ(tmp->nodestorage, nodeName))) + return tmp; + } + + return NULL; +} + + + static void qemuDomainObjPrivateXMLParseBlockjobNodename(qemuBlockJobDataPtr job, const char *xpath, @@ -2596,15 +2622,15 @@ qemuDomainObjPrivateXMLParseBlockjobNodename(qemuBlockJobDataPtr job, return; if (job->disk && - (*src = virStorageSourceFindByNodeName(job->disk->src, nodename))) + (*src = qemuDomainVirStorageSourceFindByNodeName(job->disk->src, nodename))) return; if (job->chain && - (*src = virStorageSourceFindByNodeName(job->chain, nodename))) + (*src = qemuDomainVirStorageSourceFindByNodeName(job->chain, nodename))) return; if (job->mirrorChain && - (*src = virStorageSourceFindByNodeName(job->mirrorChain, nodename))) + (*src = qemuDomainVirStorageSourceFindByNodeName(job->mirrorChain, nodename))) return; /* the node was in the XML but was not found in the job definitions */ @@ -10028,11 +10054,11 @@ qemuDomainDiskLookupByNodename(virDomainDefPtr def, for (i = 0; i < def->ndisks; i++) { virDomainDiskDefPtr domdisk = def->disks[i]; - if ((*src = virStorageSourceFindByNodeName(domdisk->src, nodename))) + if ((*src = qemuDomainVirStorageSourceFindByNodeName(domdisk->src, nodename))) return domdisk; if (domdisk->mirror && - (*src = virStorageSourceFindByNodeName(domdisk->mirror, nodename))) + (*src = qemuDomainVirStorageSourceFindByNodeName(domdisk->mirror, nodename))) return domdisk; } @@ -10041,7 +10067,7 @@ qemuDomainDiskLookupByNodename(virDomainDefPtr def, virDomainBackupDiskDefPtr backupdisk = backupdef->disks + i; if (backupdisk->store && - (*src = virStorageSourceFindByNodeName(backupdisk->store, nodename))) + (*src = qemuDomainVirStorageSourceFindByNodeName(backupdisk->store, nodename))) return virDomainDiskByTarget(def, backupdisk->name); } } diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 24b47fc788..13a86f34e5 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -4445,31 +4445,6 @@ virStorageSourceIsRelative(virStorageSourcePtr src) } -/** - * virStorageSourceFindByNodeName: - * @top: backing chain top - * @nodeName: node name to find in backing chain - * - * Looks up the given storage source in the backing chain and returns the - * pointer to it. - * On failure NULL is returned and no error is reported. - */ -virStorageSourcePtr -virStorageSourceFindByNodeName(virStorageSourcePtr top, - const char *nodeName) -{ - virStorageSourcePtr tmp; - - for (tmp = top; virStorageSourceIsBacking(tmp); tmp = tmp->backingStore) { - if ((tmp->nodeformat && STREQ(tmp->nodeformat, nodeName)) || - (tmp->nodestorage && STREQ(tmp->nodestorage, nodeName))) - return tmp; - } - - return NULL; -} - - static unsigned int virStorageSourceNetworkDefaultPort(virStorageNetProtocol protocol) { diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 1a722e1fa4..46da6a8a18 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -521,11 +521,6 @@ int virStorageSourceNewFromBackingAbsolute(const char *path, bool virStorageSourceIsRelative(virStorageSourcePtr src); -virStorageSourcePtr -virStorageSourceFindByNodeName(virStorageSourcePtr top, - const char *nodeName) - ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); - void virStorageSourceNetworkAssignDefaultPorts(virStorageSourcePtr src) ATTRIBUTE_NONNULL(1); -- 2.29.2