util: Remove the AUTOPTR func for virStorageSource

Since virStorageSource is now a subclass of virObject, we can use
VIR_AUTOUNREF instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Peter Krempa 2019-02-15 12:52:45 +01:00
parent 0d13790695
commit e1c01b2252
9 changed files with 15 additions and 16 deletions

View File

@ -9160,7 +9160,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;

View File

@ -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;

View File

@ -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 |

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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 */

View File

@ -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;

View File

@ -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;