if (!def)
return;
- virStorageSourceFree(def->src);
+ virObjectUnref(def->src);
VIR_FREE(def->serial);
VIR_FREE(def->dst);
- virStorageSourceFree(def->mirror);
+ virObjectUnref(def->mirror);
VIR_FREE(def->wwn);
VIR_FREE(def->driverName);
VIR_FREE(def->vendor);
if (!def)
return;
- virStorageSourceFree(def->src);
+ virObjectUnref(def->src);
VIR_FREE(def->dst);
virDomainDeviceInfoClear(&def->info);
VIR_FREE(def->virtio);
if (!iscsisrc)
return;
- virStorageSourceFree(iscsisrc->src);
+ virObjectUnref(iscsisrc->src);
iscsisrc->src = NULL;
}
virDomainSnapshotDiskDefClear(virDomainSnapshotDiskDefPtr disk)
{
VIR_FREE(disk->name);
- virStorageSourceFree(disk->src);
+ virObjectUnref(disk->src);
disk->src = NULL;
}
virStorageSourceClear;
virStorageSourceCopy;
virStorageSourceFindByNodeName;
-virStorageSourceFree;
virStorageSourceGetActualType;
virStorageSourceGetSecurityLabelDef;
virStorageSourceHasBacking;
VIR_WARN("Unable to update persistent definition "
"on vm %s after block job",
vm->def->name);
- virStorageSourceFree(copy);
+ virObjectUnref(copy);
copy = NULL;
persistDisk = NULL;
}
}
if (copy) {
- virStorageSourceFree(persistDisk->src);
+ virObjectUnref(persistDisk->src);
persistDisk->src = copy;
}
}
* want to only revoke the non-shared portion of the chain); so for
* now, we leak the access to the original. */
virDomainLockImageDetach(driver->lockManager, vm, disk->src);
- virStorageSourceFree(disk->src);
+ virObjectUnref(disk->src);
disk->src = disk->mirror;
} else {
if (disk->mirror) {
virDomainLockImageDetach(driver->lockManager, vm, disk->mirror);
- virStorageSourceFree(disk->mirror);
+ virObjectUnref(disk->mirror);
}
}
case VIR_DOMAIN_BLOCK_JOB_CANCELED:
if (disk->mirror) {
virDomainLockImageDetach(driver->lockManager, vm, disk->mirror);
- virStorageSourceFree(disk->mirror);
+ virObjectUnref(disk->mirror);
disk->mirror = NULL;
}
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE;
{
qemuDomainDiskPrivatePtr priv = obj;
- virStorageSourceFree(priv->migrSource);
+ virObjectUnref(priv->migrSource);
VIR_FREE(priv->qomName);
VIR_FREE(priv->nodeCopyOnRead);
virObjectUnref(priv->blockjob);
if (data[i].prepared)
qemuDomainDiskChainElementRevoke(driver, vm, data[i].src);
- virStorageSourceFree(data[i].src);
+ virObjectUnref(data[i].src);
}
- virStorageSourceFree(data[i].persistsrc);
+ virObjectUnref(data[i].persistsrc);
VIR_FREE(data[i].relPath);
}
cleanup:
VIR_FREE(device);
virObjectUnref(cfg);
- virStorageSourceFree(mirror);
+ virObjectUnref(mirror);
return ret;
}
ignore_value(qemuHotplugPrepareDiskSourceAccess(driver, vm, oldsrc, true));
/* media was changed, so we can remove the old media definition now */
- virStorageSourceFree(oldsrc);
+ virObjectUnref(oldsrc);
oldsrc = NULL;
disk->src = newsrc;
qemuBlockStorageSourceDetachOneBlockdev(driver, vm, asyncJob,
diskPriv->migrSource);
- virStorageSourceFree(diskPriv->migrSource);
+ virObjectUnref(diskPriv->migrSource);
diskPriv->migrSource = NULL;
}
* remote storage. To avoid trouble, just fake the backing store is RAW
* and put the string from the metadata as the path of the target. */
if (!virStorageSourceIsLocalStorage(target->backingStore)) {
- virStorageSourceFree(target->backingStore);
+ virObjectUnref(target->backingStore);
if (!(target->backingStore = virStorageSourceNew()))
return -1;
return def;
error:
- virStorageSourceFree(def);
+ virObjectUnref(def);
return NULL;
}
* image didn't specify an explicit format for its backing store. Callers are
* advised against probing for the backing store format in this case.
*
- * Caller MUST free the result after use via virStorageSourceFree.
+ * Caller MUST free the result after use via virObjectUnref.
*/
virStorageSourcePtr
virStorageFileGetMetadataFromBuf(const char *path,
if (virStorageFileGetMetadataInternal(ret, buf, len,
backingFormat) < 0) {
- virStorageSourceFree(ret);
+ virObjectUnref(ret);
return NULL;
}
* format, since a malicious guest can turn a raw file into any
* other non-raw format at will.
*
- * Caller MUST free the result after use via virStorageSourceFree.
+ * Caller MUST free the result after use via virObjectUnref.
*/
virStorageSourcePtr
virStorageFileGetMetadataFromFD(const char *path,
VIR_STEAL_PTR(ret, meta);
cleanup:
- virStorageSourceFree(meta);
+ virObjectUnref(meta);
return ret;
}
return def;
error:
- virStorageSourceFree(def);
+ virObjectUnref(def);
return NULL;
}
VIR_FREE(def->backingStoreRaw);
/* recursively free backing chain */
- virStorageSourceFree(def->backingStore);
+ virObjectUnref(def->backingStore);
def->backingStore = NULL;
}
}
-void
-virStorageSourceFree(virStorageSourcePtr def)
-{
- virObjectUnref(def);
-}
-
-
static virStorageSourcePtr
virStorageSourceNewFromBackingRelative(virStorageSourcePtr parent,
const char *rel)
return def;
error:
- virStorageSourceFree(def);
+ virObjectUnref(def);
def = NULL;
goto cleanup;
}
return def;
error:
- virStorageSourceFree(def);
+ virObjectUnref(def);
return NULL;
}
return def;
error:
- virStorageSourceFree(def);
+ virObjectUnref(def);
return NULL;
}
ret = 0;
cleanup:
- virStorageSourceFree(meta);
+ virObjectUnref(meta);
return ret;
}
if (virStorageSourceHasBacking(src))
src->backingStore->id = depth;
virStorageFileDeinit(src);
- virStorageSourceFree(backingStore);
+ virObjectUnref(backingStore);
return ret;
}
* If @report_broken is true, the whole function fails with a possibly sane
* error instead of just returning a broken chain.
*
- * Caller MUST free result after use via virStorageSourceFree.
+ * Caller MUST free result after use via virObjectUnref.
*/
int
virStorageFileGetMetadata(virStorageSourcePtr src,
ret = 0;
cleanup:
- virStorageSourceFree(tmp);
+ virObjectUnref(tmp);
return ret;
}
bool virStorageSourceIsEmpty(virStorageSourcePtr src);
bool virStorageSourceIsBlockLocal(const virStorageSource *src);
virStorageSourcePtr virStorageSourceNew(void);
-void virStorageSourceFree(virStorageSourcePtr def);
void virStorageSourceBackingStoreClear(virStorageSourcePtr def);
int virStorageSourceUpdatePhysicalSize(virStorageSourcePtr src,
int fd, struct stat const *sb);
ret = -1;
/* Test behavior of chain lookups, relative backing from absolute start */
- virStorageSourceFree(chain);
+ virObjectUnref(chain);
chain = testStorageFileGetMetadata(abswrap, VIR_STORAGE_FILE_QCOW2, -1, -1);
if (!chain) {
ret = -1;
ret = -1;
/* Test behavior of chain lookups, relative backing */
- virStorageSourceFree(chain);
+ virObjectUnref(chain);
chain = testStorageFileGetMetadata("sub/link2", VIR_STORAGE_FILE_QCOW2,
-1, -1);
if (!chain) {