Since virStorageSource is now a subclass of virObject, we can use VIR_AUTOUNREF instead. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/conf/domain_conf.c | 2 +- src/qemu/qemu_domain.c | 2 +- src/qemu/qemu_driver.c | 6 +++--- src/qemu/qemu_migration.c | 2 +- src/storage/storage_backend_gluster.c | 2 +- src/storage/storage_util.c | 4 ++-- src/util/virstoragefile.h | 1 - tests/qemublocktest.c | 4 ++-- tests/virstoragetest.c | 8 ++++---- 9 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 52cec5cd3d..91ee35391b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9071,7 +9071,7 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt, char *format = NULL; char *idx = NULL; int ret = -1; - VIR_AUTOPTR(virStorageSource) backingStore = NULL; + VIR_AUTOUNREF(virStorageSourcePtr) backingStore = NULL; if (!(ctxt->node = virXPathNode("./backingStore", ctxt))) { ret = 0; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0c8feb25be..a96a4f4049 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2733,7 +2733,7 @@ qemuDomainObjPrivateXMLParseJobNBDSource(xmlNodePtr node, char *format = NULL; char *type = NULL; int ret = -1; - VIR_AUTOPTR(virStorageSource) migrSource = NULL; + VIR_AUTOUNREF(virStorageSourcePtr) migrSource = NULL; ctxt->node = node; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f94955a22f..5a77afa1b4 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -279,7 +279,7 @@ qemuSecurityChownCallback(const virStorageSource *src, int save_errno = 0; int ret = -1; int rv; - VIR_AUTOPTR(virStorageSource) cpy = NULL; + VIR_AUTOUNREF(virStorageSourcePtr) cpy = NULL; rv = virStorageFileSupportsSecurityDriver(src); if (rv <= 0) @@ -17962,7 +17962,7 @@ qemuDomainBlockRebase(virDomainPtr dom, const char *path, const char *base, virDomainObjPtr vm; int ret = -1; unsigned long long speed = bandwidth; - VIR_AUTOPTR(virStorageSource) dest = NULL; + VIR_AUTOUNREF(virStorageSourcePtr) dest = NULL; virCheckFlags(VIR_DOMAIN_BLOCK_REBASE_SHALLOW | VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT | @@ -18156,7 +18156,7 @@ qemuDomainBlockCommit(virDomainPtr dom, unsigned long long speed = bandwidth; qemuBlockJobDataPtr job = NULL; qemuBlockJobType jobtype = QEMU_BLOCKJOB_TYPE_COMMIT; - VIR_AUTOPTR(virStorageSource) mirror = NULL; + VIR_AUTOUNREF(virStorageSourcePtr) mirror = NULL; /* XXX Add support for COMMIT_DELETE */ virCheckFlags(VIR_DOMAIN_BLOCK_COMMIT_SHALLOW | diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 8a9dbb5e63..b10f55f80c 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -790,7 +790,7 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriverPtr driver, qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); int mon_ret = 0; int ret = -1; - VIR_AUTOPTR(virStorageSource) copysrc = NULL; + VIR_AUTOUNREF(virStorageSourcePtr) copysrc = NULL; VIR_DEBUG("starting blockdev mirror for disk=%s to host=%s", diskAlias, host); diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c index 854ecf2b67..819993439a 100644 --- a/src/storage/storage_backend_gluster.c +++ b/src/storage/storage_backend_gluster.c @@ -239,7 +239,7 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state, ssize_t len; int backingFormat; VIR_AUTOPTR(virStorageVolDef) vol = NULL; - VIR_AUTOPTR(virStorageSource) meta = NULL; + VIR_AUTOUNREF(virStorageSourcePtr) meta = NULL; VIR_AUTOFREE(char *) header = NULL; *volptr = NULL; diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index 3a6cc34b68..1c5d4d14be 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -3359,7 +3359,7 @@ storageBackendProbeTarget(virStorageSourcePtr target, int backingStoreFormat; int rc; struct stat sb; - VIR_AUTOPTR(virStorageSource) meta = NULL; + VIR_AUTOUNREF(virStorageSourcePtr) meta = NULL; VIR_AUTOCLOSE fd = -1; if (encryption) @@ -3529,7 +3529,7 @@ virStorageBackendRefreshLocal(virStoragePoolObjPtr pool) int ret = -1; VIR_AUTOPTR(virStorageVolDef) vol = NULL; VIR_AUTOCLOSE fd = -1; - VIR_AUTOPTR(virStorageSource) target = NULL; + VIR_AUTOUNREF(virStorageSourcePtr) target = NULL; if (virDirOpen(&dir, def->target.path) < 0) goto cleanup; diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index dc75d2d36f..17eea6dc6b 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -547,6 +547,5 @@ void virStorageFileReportBrokenChain(int errcode, virStorageSourcePtr parent); VIR_DEFINE_AUTOPTR_FUNC(virStorageAuthDef, virStorageAuthDefFree); -VIR_DEFINE_AUTOPTR_FUNC(virStorageSource, virStorageSourceFree); #endif /* LIBVIRT_VIRSTORAGEFILE_H */ diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 813b20a08d..4cd15a1dff 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -52,8 +52,8 @@ testBackingXMLjsonXML(const void *args) char *protocolwrapper = NULL; char *actualxml = NULL; int ret = -1; - VIR_AUTOPTR(virStorageSource) xmlsrc = NULL; - VIR_AUTOPTR(virStorageSource) jsonsrc = NULL; + VIR_AUTOUNREF(virStorageSourcePtr) xmlsrc = NULL; + VIR_AUTOUNREF(virStorageSourcePtr) jsonsrc = NULL; if (!(xmlsrc = virStorageSourceNew())) return -1; diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index da70beb1f7..830d4fb08e 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -96,7 +96,7 @@ testStorageFileGetMetadata(const char *path, { struct stat st; virStorageSourcePtr ret = NULL; - VIR_AUTOPTR(virStorageSource) def = NULL; + VIR_AUTOUNREF(virStorageSourcePtr) def = NULL; if (!(def = virStorageSourceNew())) return NULL; @@ -308,7 +308,7 @@ testStorageChain(const void *args) const struct testChainData *data = args; virStorageSourcePtr elt; size_t i = 0; - VIR_AUTOPTR(virStorageSource) meta = NULL; + VIR_AUTOUNREF(virStorageSourcePtr) meta = NULL; VIR_AUTOFREE(char *) broken = NULL; meta = testStorageFileGetMetadata(data->start, data->format, -1, -1); @@ -642,7 +642,7 @@ testBackingParse(const void *args) virBuffer buf = VIR_BUFFER_INITIALIZER; int ret = -1; VIR_AUTOFREE(char *) xml = NULL; - VIR_AUTOPTR(virStorageSource) src = NULL; + VIR_AUTOUNREF(virStorageSourcePtr) src = NULL; if (!(src = virStorageSourceNewFromBackingAbsolute(data->backing))) { if (!data->expect) @@ -692,7 +692,7 @@ mymain(void) virStorageSourcePtr chain2; /* short for chain->backingStore */ virStorageSourcePtr chain3; /* short for chain2->backingStore */ VIR_AUTOPTR(virCommand) cmd = NULL; - VIR_AUTOPTR(virStorageSource) chain = NULL; + VIR_AUTOUNREF(virStorageSourcePtr) chain = NULL; if (storageRegisterAll() < 0) return EXIT_FAILURE; -- 2.20.1