Use g_autoptr instead of VIR_AUTOUNREF

Now that all the types using VIR_AUTOUNREF have a cleanup func defined
to virObjectUnref, use g_autoptr instead of VIR_AUTOUNREF.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Ján Tomko 2019-10-15 14:47:50 +02:00
parent df4986b51b
commit 2b390b97b4
29 changed files with 117 additions and 117 deletions

View File

@ -134,7 +134,7 @@ virDomainCheckpointDefParse(xmlXPathContextPtr ctxt,
int n; int n;
char *tmp; char *tmp;
g_autofree xmlNodePtr *nodes = NULL; g_autofree xmlNodePtr *nodes = NULL;
VIR_AUTOUNREF(virDomainCheckpointDefPtr) def = NULL; g_autoptr(virDomainCheckpointDef) def = NULL;
if (!(def = virDomainCheckpointDefNew())) if (!(def = virDomainCheckpointDefNew()))
return NULL; return NULL;

View File

@ -1785,7 +1785,7 @@ static virDomainVcpuDefPtr
virDomainVcpuDefNew(virDomainXMLOptionPtr xmlopt) virDomainVcpuDefNew(virDomainXMLOptionPtr xmlopt)
{ {
virDomainVcpuDefPtr ret = NULL; virDomainVcpuDefPtr ret = NULL;
VIR_AUTOUNREF(virObjectPtr) priv = NULL; g_autoptr(virObject) priv = NULL;
if (xmlopt && xmlopt->privateData.vcpuNew && if (xmlopt && xmlopt->privateData.vcpuNew &&
!(priv = xmlopt->privateData.vcpuNew())) !(priv = xmlopt->privateData.vcpuNew()))
@ -9276,7 +9276,7 @@ virDomainStorageSourceParseBase(const char *type,
const char *format, const char *format,
const char *index) const char *index)
{ {
VIR_AUTOUNREF(virStorageSourcePtr) src = NULL; g_autoptr(virStorageSource) src = NULL;
virStorageSourcePtr ret = NULL; virStorageSourcePtr ret = NULL;
if (!(src = virStorageSourceNew())) if (!(src = virStorageSourceNew()))
@ -9402,7 +9402,7 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt,
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt); VIR_XPATH_NODE_AUTORESTORE(ctxt);
xmlNodePtr source; xmlNodePtr source;
VIR_AUTOUNREF(virStorageSourcePtr) backingStore = NULL; g_autoptr(virStorageSource) backingStore = NULL;
g_autofree char *type = NULL; g_autofree char *type = NULL;
g_autofree char *format = NULL; g_autofree char *format = NULL;
g_autofree char *idx = NULL; g_autofree char *idx = NULL;
@ -19526,7 +19526,7 @@ virDomainCachetuneDefParse(virDomainDefPtr def,
int ret = -1; int ret = -1;
g_autoptr(virBitmap) vcpus = NULL; g_autoptr(virBitmap) vcpus = NULL;
g_autofree xmlNodePtr *nodes = NULL; g_autofree xmlNodePtr *nodes = NULL;
VIR_AUTOUNREF(virResctrlAllocPtr) alloc = NULL; g_autoptr(virResctrlAlloc) alloc = NULL;
ctxt->node = node; ctxt->node = node;
@ -19724,7 +19724,7 @@ virDomainMemorytuneDefParse(virDomainDefPtr def,
virDomainResctrlDefPtr resctrl = NULL; virDomainResctrlDefPtr resctrl = NULL;
g_autoptr(virBitmap) vcpus = NULL; g_autoptr(virBitmap) vcpus = NULL;
g_autofree xmlNodePtr *nodes = NULL; g_autofree xmlNodePtr *nodes = NULL;
VIR_AUTOUNREF(virResctrlAllocPtr) alloc = NULL; g_autoptr(virResctrlAlloc) alloc = NULL;
ssize_t i = 0; ssize_t i = 0;
int n; int n;
@ -30936,9 +30936,9 @@ virDomainNetCreatePort(virConnectPtr conn,
unsigned int flags) unsigned int flags)
{ {
virErrorPtr save_err; virErrorPtr save_err;
VIR_AUTOUNREF(virNetworkPtr) net = NULL; g_autoptr(virNetwork) net = NULL;
g_autoptr(virNetworkPortDef) portdef = NULL; g_autoptr(virNetworkPortDef) portdef = NULL;
VIR_AUTOUNREF(virNetworkPortPtr) port = NULL; g_autoptr(virNetworkPort) port = NULL;
g_autofree char *portxml = NULL; g_autofree char *portxml = NULL;
if (!(net = virNetworkLookupByName(conn, iface->data.network.name))) if (!(net = virNetworkLookupByName(conn, iface->data.network.name)))
@ -31156,8 +31156,8 @@ virDomainNetResolveActualType(virDomainNetDefPtr iface)
virNetworkDefPtr def = NULL; virNetworkDefPtr def = NULL;
int ret = -1; int ret = -1;
g_autofree char *xml = NULL; g_autofree char *xml = NULL;
VIR_AUTOUNREF(virConnectPtr) conn = NULL; g_autoptr(virConnect) conn = NULL;
VIR_AUTOUNREF(virNetworkPtr) net = NULL; g_autoptr(virNetwork) net = NULL;
if (iface->type != VIR_DOMAIN_NET_TYPE_NETWORK) if (iface->type != VIR_DOMAIN_NET_TYPE_NETWORK)
return iface->type; return iface->type;
@ -31344,9 +31344,9 @@ virDomainDiskTranslateSourcePool(virDomainDiskDefPtr def)
virStorageVolInfo info; virStorageVolInfo info;
g_autoptr(virStoragePoolDef) pooldef = NULL; g_autoptr(virStoragePoolDef) pooldef = NULL;
g_autofree char *poolxml = NULL; g_autofree char *poolxml = NULL;
VIR_AUTOUNREF(virConnectPtr) conn = NULL; g_autoptr(virConnect) conn = NULL;
VIR_AUTOUNREF(virStoragePoolPtr) pool = NULL; g_autoptr(virStoragePool) pool = NULL;
VIR_AUTOUNREF(virStorageVolPtr) vol = NULL; g_autoptr(virStorageVol) vol = NULL;
if (def->src->type != VIR_STORAGE_TYPE_VOLUME) if (def->src->type != VIR_STORAGE_TYPE_VOLUME)
return 0; return 0;

View File

@ -4100,7 +4100,7 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char *xmlDesc,
virDomainSnapshotPtr snapshot = NULL; virDomainSnapshotPtr snapshot = NULL;
bool diskOnly = (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY) != 0; bool diskOnly = (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY) != 0;
bool quiesce = (flags & VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE) != 0; bool quiesce = (flags & VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE) != 0;
VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL; g_autoptr(virDomainSnapshotDef) def = NULL;
unsigned int parse_flags = 0; unsigned int parse_flags = 0;
/* ESX supports disk-only and quiesced snapshots; libvirt tracks no /* ESX supports disk-only and quiesced snapshots; libvirt tracks no

View File

@ -6539,7 +6539,7 @@ libxlDomainSetMetadata(virDomainPtr dom,
unsigned int flags) unsigned int flags)
{ {
libxlDriverPrivatePtr driver = dom->conn->privateData; libxlDriverPrivatePtr driver = dom->conn->privateData;
VIR_AUTOUNREF(libxlDriverConfigPtr) cfg = libxlDriverConfigGet(driver); g_autoptr(libxlDriverConfig) cfg = libxlDriverConfigGet(driver);
virDomainObjPtr vm = NULL; virDomainObjPtr vm = NULL;
int ret = -1; int ret = -1;

View File

@ -103,7 +103,7 @@ qemuBlockJobDataPtr
qemuBlockJobDataNew(qemuBlockJobType type, qemuBlockJobDataNew(qemuBlockJobType type,
const char *name) const char *name)
{ {
VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL; g_autoptr(qemuBlockJobData) job = NULL;
if (qemuBlockJobDataInitialize() < 0) if (qemuBlockJobDataInitialize() < 0)
return NULL; return NULL;
@ -206,7 +206,7 @@ qemuBlockJobDiskNew(virDomainObjPtr vm,
qemuBlockJobType type, qemuBlockJobType type,
const char *jobname) const char *jobname)
{ {
VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL; g_autoptr(qemuBlockJobData) job = NULL;
if (!(job = qemuBlockJobDataNew(type, jobname))) if (!(job = qemuBlockJobDataNew(type, jobname)))
return NULL; return NULL;
@ -224,7 +224,7 @@ qemuBlockJobDiskNewPull(virDomainObjPtr vm,
virStorageSourcePtr base) virStorageSourcePtr base)
{ {
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL; g_autoptr(qemuBlockJobData) job = NULL;
g_autofree char *jobname = NULL; g_autofree char *jobname = NULL;
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) {
@ -255,7 +255,7 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm,
virStorageSourcePtr base) virStorageSourcePtr base)
{ {
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL; g_autoptr(qemuBlockJobData) job = NULL;
g_autofree char *jobname = NULL; g_autofree char *jobname = NULL;
qemuBlockJobType jobtype = QEMU_BLOCKJOB_TYPE_COMMIT; qemuBlockJobType jobtype = QEMU_BLOCKJOB_TYPE_COMMIT;
@ -290,7 +290,7 @@ qemuBlockJobNewCreate(virDomainObjPtr vm,
virStorageSourcePtr chain, virStorageSourcePtr chain,
bool storage) bool storage)
{ {
VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL; g_autoptr(qemuBlockJobData) job = NULL;
g_autofree char *jobname = NULL; g_autofree char *jobname = NULL;
const char *nodename = src->nodeformat; const char *nodename = src->nodeformat;
@ -323,7 +323,7 @@ qemuBlockJobDiskNewCopy(virDomainObjPtr vm,
bool reuse) bool reuse)
{ {
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL; g_autoptr(qemuBlockJobData) job = NULL;
g_autofree char *jobname = NULL; g_autofree char *jobname = NULL;
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) {
@ -595,7 +595,7 @@ qemuBlockJobRewriteConfigDiskSource(virDomainObjPtr vm,
virStorageSourcePtr newsrc) virStorageSourcePtr newsrc)
{ {
virDomainDiskDefPtr persistDisk = NULL; virDomainDiskDefPtr persistDisk = NULL;
VIR_AUTOUNREF(virStorageSourcePtr) copy = NULL; g_autoptr(virStorageSource) copy = NULL;
virStorageSourcePtr n; virStorageSourcePtr n;
if (!vm->newDef) if (!vm->newDef)

View File

@ -118,7 +118,7 @@ qemuCheckpointDiscard(virQEMUDriverPtr driver,
virDomainMomentObjPtr moment; virDomainMomentObjPtr moment;
virDomainCheckpointDefPtr parentdef = NULL; virDomainCheckpointDefPtr parentdef = NULL;
size_t i, j; size_t i, j;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
g_autofree char *chkFile = NULL; g_autofree char *chkFile = NULL;
if (!metadata_only && !virDomainObjIsActive(vm)) { if (!metadata_only && !virDomainObjIsActive(vm)) {
@ -354,11 +354,11 @@ qemuCheckpointCreateXML(virDomainPtr domain,
bool redefine = flags & VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE; bool redefine = flags & VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE;
unsigned int parse_flags = 0; unsigned int parse_flags = 0;
virDomainMomentObjPtr other = NULL; virDomainMomentObjPtr other = NULL;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = NULL; g_autoptr(virQEMUDriverConfig) cfg = NULL;
VIR_AUTOUNREF(virCapsPtr) caps = NULL; g_autoptr(virCaps) caps = NULL;
g_autoptr(virJSONValue) actions = NULL; g_autoptr(virJSONValue) actions = NULL;
int ret; int ret;
VIR_AUTOUNREF(virDomainCheckpointDefPtr) def = NULL; g_autoptr(virDomainCheckpointDef) def = NULL;
virCheckFlags(VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE, NULL); virCheckFlags(VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE, NULL);
@ -532,7 +532,7 @@ qemuCheckpointDelete(virDomainObjPtr vm,
{ {
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
virQEMUDriverPtr driver = priv->driver; virQEMUDriverPtr driver = priv->driver;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
int ret = -1; int ret = -1;
virDomainMomentObjPtr chk = NULL; virDomainMomentObjPtr chk = NULL;
virQEMUMomentRemove rem; virQEMUMomentRemove rem;

View File

@ -6753,7 +6753,7 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
virQEMUCapsPtr qemuCaps) virQEMUCapsPtr qemuCaps)
{ {
size_t i; size_t i;
VIR_AUTOUNREF(virCapsPtr) caps = NULL; g_autoptr(virCaps) caps = NULL;
virCPUDefPtr cpu = def->cpu; virCPUDefPtr cpu = def->cpu;
if (!(caps = virQEMUDriverGetCapabilities(driver, false))) if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
@ -8337,7 +8337,7 @@ qemuInterfaceVhostuserConnect(virQEMUDriverPtr driver,
virQEMUCapsPtr qemuCaps, virQEMUCapsPtr qemuCaps,
char **chardev) char **chardev)
{ {
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
switch ((virDomainChrType)net->data.vhostuser->type) { switch ((virDomainChrType)net->data.vhostuser->type) {
case VIR_DOMAIN_CHR_TYPE_UNIX: case VIR_DOMAIN_CHR_TYPE_UNIX:
@ -10277,7 +10277,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
size_t i; size_t i;
char uuid[VIR_UUID_STRING_BUFLEN]; char uuid[VIR_UUID_STRING_BUFLEN];
g_autoptr(virCommand) cmd = NULL; g_autoptr(virCommand) cmd = NULL;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
unsigned int bootHostdevNet = 0; unsigned int bootHostdevNet = 0;
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
virDomainDefPtr def = vm->def; virDomainDefPtr def = vm->def;

View File

@ -105,7 +105,7 @@ qemuDriverUnlock(virQEMUDriverPtr driver)
virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged) virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
{ {
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = NULL; g_autoptr(virQEMUDriverConfig) cfg = NULL;
if (virQEMUConfigInitialize() < 0) if (virQEMUConfigInitialize() < 0)
return NULL; return NULL;
@ -1243,7 +1243,7 @@ virQEMUDriverCreateXMLConf(virQEMUDriverPtr driver)
virCapsPtr virQEMUDriverCreateCapabilities(virQEMUDriverPtr driver) virCapsPtr virQEMUDriverCreateCapabilities(virQEMUDriverPtr driver)
{ {
size_t i, j; size_t i, j;
VIR_AUTOUNREF(virCapsPtr) caps = NULL; g_autoptr(virCaps) caps = NULL;
g_autofree virSecurityManagerPtr *sec_managers = NULL; g_autofree virSecurityManagerPtr *sec_managers = NULL;
/* Security driver data */ /* Security driver data */
const char *doi, *model, *lbl, *type; const char *doi, *model, *lbl, *type;
@ -1379,9 +1379,9 @@ virQEMUDriverGetDomainCapabilities(virQEMUDriverPtr driver,
virArch arch, virArch arch,
virDomainVirtType virttype) virDomainVirtType virttype)
{ {
VIR_AUTOUNREF(virDomainCapsPtr) domCaps = NULL; g_autoptr(virDomainCaps) domCaps = NULL;
VIR_AUTOUNREF(virCapsPtr) caps = NULL; g_autoptr(virCaps) caps = NULL;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virHashTablePtr domCapsCache = virQEMUCapsGetDomainCapsCache(qemuCaps); virHashTablePtr domCapsCache = virQEMUCapsGetDomainCapsCache(qemuCaps);
struct virQEMUDriverSearchDomcapsData data = { struct virQEMUDriverSearchDomcapsData data = {
.path = virQEMUCapsGetBinary(qemuCaps), .path = virQEMUCapsGetBinary(qemuCaps),

View File

@ -3015,7 +3015,7 @@ qemuDomainObjPrivateXMLParseBlockjobChain(xmlNodePtr node,
g_autofree char *format = NULL; g_autofree char *format = NULL;
g_autofree char *type = NULL; g_autofree char *type = NULL;
g_autofree char *index = NULL; g_autofree char *index = NULL;
VIR_AUTOUNREF(virStorageSourcePtr) src = NULL; g_autoptr(virStorageSource) src = NULL;
xmlNodePtr sourceNode; xmlNodePtr sourceNode;
unsigned int xmlflags = VIR_DOMAIN_DEF_PARSE_STATUS; unsigned int xmlflags = VIR_DOMAIN_DEF_PARSE_STATUS;
@ -3161,7 +3161,7 @@ qemuDomainObjPrivateXMLParseBlockjobData(virDomainObjPtr vm,
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt); VIR_XPATH_NODE_AUTORESTORE(ctxt);
virDomainDiskDefPtr disk = NULL; virDomainDiskDefPtr disk = NULL;
VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL; g_autoptr(qemuBlockJobData) job = NULL;
g_autofree char *name = NULL; g_autofree char *name = NULL;
g_autofree char *typestr = NULL; g_autofree char *typestr = NULL;
int type; int type;
@ -3313,7 +3313,7 @@ qemuDomainObjPrivateXMLParseJobNBDSource(xmlNodePtr node,
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
g_autofree char *format = NULL; g_autofree char *format = NULL;
g_autofree char *type = NULL; g_autofree char *type = NULL;
VIR_AUTOUNREF(virStorageSourcePtr) migrSource = NULL; g_autoptr(virStorageSource) migrSource = NULL;
xmlNodePtr sourceNode; xmlNodePtr sourceNode;
ctxt->node = node; ctxt->node = node;
@ -8083,7 +8083,7 @@ void
qemuDomainSaveConfig(virDomainObjPtr obj) qemuDomainSaveConfig(virDomainObjPtr obj)
{ {
virQEMUDriverPtr driver = QEMU_DOMAIN_PRIVATE(obj)->driver; virQEMUDriverPtr driver = QEMU_DOMAIN_PRIVATE(obj)->driver;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = NULL; g_autoptr(virQEMUDriverConfig) cfg = NULL;
virDomainDefPtr def = NULL; virDomainDefPtr def = NULL;
if (virDomainObjIsActive(obj)) if (virDomainObjIsActive(obj))
@ -8911,7 +8911,7 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver,
def->cpu && def->cpu &&
(def->cpu->mode != VIR_CPU_MODE_CUSTOM || (def->cpu->mode != VIR_CPU_MODE_CUSTOM ||
def->cpu->model)) { def->cpu->model)) {
VIR_AUTOUNREF(virQEMUCapsPtr) qCaps = NULL; g_autoptr(virQEMUCaps) qCaps = NULL;
if (qemuCaps) { if (qemuCaps) {
qCaps = virObjectRef(qemuCaps); qCaps = virObjectRef(qemuCaps);
@ -10263,7 +10263,7 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
virStorageSourcePtr disksrc, virStorageSourcePtr disksrc,
bool report_broken) bool report_broken)
{ {
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virStorageSourcePtr src; /* iterator for the backing chain declared in XML */ virStorageSourcePtr src; /* iterator for the backing chain declared in XML */
virStorageSourcePtr n; /* iterator for the backing chain detected from disk */ virStorageSourcePtr n; /* iterator for the backing chain detected from disk */
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
@ -10442,7 +10442,7 @@ qemuDomainStorageSourceAccessModify(virQEMUDriverPtr driver,
virStorageSourcePtr src, virStorageSourcePtr src,
qemuDomainStorageSourceAccessFlags flags) qemuDomainStorageSourceAccessFlags flags)
{ {
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
const char *srcstr = NULLSTR(src->path); const char *srcstr = NULLSTR(src->path);
int ret = -1; int ret = -1;
virErrorPtr orig_err = NULL; virErrorPtr orig_err = NULL;

View File

@ -255,7 +255,7 @@ qemuSecurityChownCallback(const virStorageSource *src,
int save_errno = 0; int save_errno = 0;
int ret = -1; int ret = -1;
int rv; int rv;
VIR_AUTOUNREF(virStorageSourcePtr) cpy = NULL; g_autoptr(virStorageSource) cpy = NULL;
rv = virStorageFileSupportsSecurityDriver(src); rv = virStorageFileSupportsSecurityDriver(src);
if (rv <= 0) if (rv <= 0)
@ -4804,7 +4804,7 @@ processBlockJobEvent(virQEMUDriverPtr driver,
int status) int status)
{ {
virDomainDiskDefPtr disk; virDomainDiskDefPtr disk;
VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL; g_autoptr(qemuBlockJobData) job = NULL;
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
return; return;
@ -13695,7 +13695,7 @@ qemuConnectCompareHypervisorCPU(virConnectPtr conn,
{ {
int ret = VIR_CPU_COMPARE_ERROR; int ret = VIR_CPU_COMPARE_ERROR;
virQEMUDriverPtr driver = conn->privateData; virQEMUDriverPtr driver = conn->privateData;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virQEMUCapsPtr qemuCaps = NULL; virQEMUCapsPtr qemuCaps = NULL;
bool failIncompatible; bool failIncompatible;
virCPUDefPtr hvCPU; virCPUDefPtr hvCPU;
@ -13908,7 +13908,7 @@ qemuConnectBaselineHypervisorCPU(virConnectPtr conn,
unsigned int flags) unsigned int flags)
{ {
virQEMUDriverPtr driver = conn->privateData; virQEMUDriverPtr driver = conn->privateData;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virCPUDefPtr *cpus = NULL; virCPUDefPtr *cpus = NULL;
virQEMUCapsPtr qemuCaps = NULL; virQEMUCapsPtr qemuCaps = NULL;
virArch arch; virArch arch;
@ -15458,7 +15458,7 @@ qemuDomainSnapshotDiskPrepareOne(virQEMUDriverPtr driver,
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
char *backingStoreStr; char *backingStoreStr;
virDomainDiskDefPtr persistdisk; virDomainDiskDefPtr persistdisk;
VIR_AUTOUNREF(virStorageSourcePtr) terminator = NULL; g_autoptr(virStorageSource) terminator = NULL;
bool supportsCreate; bool supportsCreate;
bool supportsBacking; bool supportsBacking;
int rc; int rc;
@ -15968,7 +15968,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
virCapsPtr caps = NULL; virCapsPtr caps = NULL;
qemuDomainObjPrivatePtr priv; qemuDomainObjPrivatePtr priv;
virDomainSnapshotState state; virDomainSnapshotState state;
VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL; g_autoptr(virDomainSnapshotDef) def = NULL;
virCheckFlags(VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE | virCheckFlags(VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE |
VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT | VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT |
@ -17970,7 +17970,7 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom,
virDomainDiskDefPtr disk; virDomainDiskDefPtr disk;
int ret = -1; int ret = -1;
qemuMonitorBlockJobInfo rawInfo; qemuMonitorBlockJobInfo rawInfo;
VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL; g_autoptr(qemuBlockJobData) job = NULL;
virCheckFlags(VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES, -1); virCheckFlags(VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES, -1);
@ -18214,13 +18214,13 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
virDomainDiskDefPtr disk = NULL; virDomainDiskDefPtr disk = NULL;
int ret = -1; int ret = -1;
bool need_unlink = false; bool need_unlink = false;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
const char *format = NULL; const char *format = NULL;
bool mirror_reuse = !!(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT); bool mirror_reuse = !!(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT);
bool mirror_shallow = !!(flags & VIR_DOMAIN_BLOCK_COPY_SHALLOW); bool mirror_shallow = !!(flags & VIR_DOMAIN_BLOCK_COPY_SHALLOW);
bool existing = mirror_reuse; bool existing = mirror_reuse;
qemuBlockJobDataPtr job = NULL; qemuBlockJobDataPtr job = NULL;
VIR_AUTOUNREF(virStorageSourcePtr) mirror = mirrorsrc; g_autoptr(virStorageSource) mirror = mirrorsrc;
bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
bool mirror_initialized = false; bool mirror_initialized = false;
g_autoptr(qemuBlockStorageSourceChainData) data = NULL; g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
@ -18493,7 +18493,7 @@ qemuDomainBlockRebase(virDomainPtr dom, const char *path, const char *base,
virDomainObjPtr vm; virDomainObjPtr vm;
int ret = -1; int ret = -1;
unsigned long long speed = bandwidth; unsigned long long speed = bandwidth;
VIR_AUTOUNREF(virStorageSourcePtr) dest = NULL; g_autoptr(virStorageSource) dest = NULL;
virCheckFlags(VIR_DOMAIN_BLOCK_REBASE_SHALLOW | virCheckFlags(VIR_DOMAIN_BLOCK_REBASE_SHALLOW |
VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT | VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT |
@ -18698,7 +18698,7 @@ qemuDomainBlockCommit(virDomainPtr dom,
g_autofree char *backingPath = NULL; g_autofree char *backingPath = NULL;
unsigned long long speed = bandwidth; unsigned long long speed = bandwidth;
qemuBlockJobDataPtr job = NULL; qemuBlockJobDataPtr job = NULL;
VIR_AUTOUNREF(virStorageSourcePtr) mirror = NULL; g_autoptr(virStorageSource) mirror = NULL;
const char *nodetop = NULL; const char *nodetop = NULL;
const char *nodebase = NULL; const char *nodebase = NULL;
bool persistjob = false; bool persistjob = false;
@ -20693,7 +20693,7 @@ qemuDomainGetResctrlMonData(virQEMUDriverPtr driver,
virDomainResctrlDefPtr resctrl = NULL; virDomainResctrlDefPtr resctrl = NULL;
virQEMUResctrlMonDataPtr res = NULL; virQEMUResctrlMonDataPtr res = NULL;
char **features = NULL; char **features = NULL;
VIR_AUTOUNREF(virCapsPtr) caps = NULL; g_autoptr(virCaps) caps = NULL;
size_t i = 0; size_t i = 0;
size_t j = 0; size_t j = 0;

View File

@ -1028,7 +1028,7 @@ qemuFirmwareEnableFeatures(virQEMUDriverPtr driver,
virDomainDefPtr def, virDomainDefPtr def,
const qemuFirmware *fw) const qemuFirmware *fw)
{ {
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
const qemuFirmwareMappingFlash *flash = &fw->mapping.data.flash; const qemuFirmwareMappingFlash *flash = &fw->mapping.data.flash;
const qemuFirmwareMappingKernel *kernel = &fw->mapping.data.kernel; const qemuFirmwareMappingKernel *kernel = &fw->mapping.data.kernel;
const qemuFirmwareMappingMemory *memory = &fw->mapping.data.memory; const qemuFirmwareMappingMemory *memory = &fw->mapping.data.memory;

View File

@ -584,7 +584,7 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
virStorageSourcePtr newsrc, virStorageSourcePtr newsrc,
bool force) bool force)
{ {
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
virStorageSourcePtr oldsrc = disk->src; virStorageSourcePtr oldsrc = disk->src;
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
@ -676,7 +676,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriverPtr driver,
int ret = -1; int ret = -1;
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
g_autofree char *devstr = NULL; g_autofree char *devstr = NULL;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
g_autoptr(virJSONValue) corProps = NULL; g_autoptr(virJSONValue) corProps = NULL;
g_autofree char *corAlias = NULL; g_autofree char *corAlias = NULL;
bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
@ -1147,7 +1147,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
bool iface_connected = false; bool iface_connected = false;
virDomainNetType actualType; virDomainNetType actualType;
virNetDevBandwidthPtr actualBandwidth; virNetDevBandwidthPtr actualBandwidth;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virDomainCCWAddressSetPtr ccwaddrs = NULL; virDomainCCWAddressSetPtr ccwaddrs = NULL;
size_t i; size_t i;
g_autofree char *charDevAlias = NULL; g_autofree char *charDevAlias = NULL;
@ -1543,7 +1543,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
bool teardowndevice = false; bool teardowndevice = false;
bool teardownmemlock = false; bool teardownmemlock = false;
int backend; int backend;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
unsigned int flags = 0; unsigned int flags = 0;
if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0) if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0)
@ -1767,7 +1767,7 @@ qemuDomainAddChardevTLSObjects(virQEMUDriverPtr driver,
const char **secAlias) const char **secAlias)
{ {
int ret = -1; int ret = -1;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
qemuDomainChrSourcePrivatePtr chrSourcePriv; qemuDomainChrSourcePrivatePtr chrSourcePriv;
qemuDomainSecretInfoPtr secinfo = NULL; qemuDomainSecretInfoPtr secinfo = NULL;
@ -1823,7 +1823,7 @@ qemuDomainDelChardevTLSObjects(virQEMUDriverPtr driver,
virDomainChrSourceDefPtr dev, virDomainChrSourceDefPtr dev,
const char *inAlias) const char *inAlias)
{ {
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
g_autofree char *tlsAlias = NULL; g_autofree char *tlsAlias = NULL;
g_autofree char *secAlias = NULL; g_autofree char *secAlias = NULL;
@ -2333,7 +2333,7 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver,
{ {
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
virErrorPtr orig_err; virErrorPtr orig_err;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
unsigned long long oldmem = virDomainDefGetMemoryTotal(vm->def); unsigned long long oldmem = virDomainDefGetMemoryTotal(vm->def);
unsigned long long newmem = oldmem + mem->size; unsigned long long newmem = oldmem + mem->size;
g_autofree char *devstr = NULL; g_autofree char *devstr = NULL;
@ -3301,7 +3301,7 @@ qemuDomainAttachLease(virQEMUDriverPtr driver,
virDomainLeaseDefPtr lease) virDomainLeaseDefPtr lease)
{ {
int ret = -1; int ret = -1;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
if (virDomainLeaseInsertPreAlloc(vm->def) < 0) if (virDomainLeaseInsertPreAlloc(vm->def) < 0)
goto cleanup; goto cleanup;
@ -4012,7 +4012,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
virDomainGraphicsDefPtr dev) virDomainGraphicsDefPtr dev)
{ {
virDomainGraphicsDefPtr olddev = qemuDomainFindGraphics(vm, dev); virDomainGraphicsDefPtr olddev = qemuDomainFindGraphics(vm, dev);
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
const char *type = virDomainGraphicsTypeToString(dev->type); const char *type = virDomainGraphicsTypeToString(dev->type);
size_t i; size_t i;
int ret = -1; int ret = -1;
@ -4555,7 +4555,7 @@ qemuDomainRemoveNetDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainNetDefPtr net) virDomainNetDefPtr net)
{ {
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
g_autofree char *hostnet_name = NULL; g_autofree char *hostnet_name = NULL;
g_autofree char *charDevAlias = NULL; g_autofree char *charDevAlias = NULL;
@ -6306,7 +6306,7 @@ qemuDomainSetVcpusInternal(virQEMUDriverPtr driver,
unsigned int nvcpus, unsigned int nvcpus,
bool hotpluggable) bool hotpluggable)
{ {
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virBitmapPtr vcpumap = NULL; virBitmapPtr vcpumap = NULL;
bool enable; bool enable;
int ret = -1; int ret = -1;
@ -6501,7 +6501,7 @@ qemuDomainSetVcpuInternal(virQEMUDriverPtr driver,
virBitmapPtr map, virBitmapPtr map,
bool state) bool state)
{ {
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virBitmapPtr livevcpus = NULL; virBitmapPtr livevcpus = NULL;
int ret = -1; int ret = -1;

View File

@ -797,7 +797,7 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriverPtr driver,
g_autoptr(qemuBlockStorageSourceAttachData) data = NULL; g_autoptr(qemuBlockStorageSourceAttachData) data = NULL;
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
int mon_ret = 0; int mon_ret = 0;
VIR_AUTOUNREF(virStorageSourcePtr) copysrc = NULL; g_autoptr(virStorageSource) copysrc = NULL;
VIR_DEBUG("starting blockdev mirror for disk=%s to host=%s", diskAlias, host); VIR_DEBUG("starting blockdev mirror for disk=%s to host=%s", diskAlias, host);
@ -991,7 +991,7 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr driver,
unsigned long long mirror_speed = speed; unsigned long long mirror_speed = speed;
bool mirror_shallow = *migrate_flags & QEMU_MONITOR_MIGRATE_NON_SHARED_INC; bool mirror_shallow = *migrate_flags & QEMU_MONITOR_MIGRATE_NON_SHARED_INC;
int rv; int rv;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
VIR_DEBUG("Starting drive mirrors for domain %s", vm->def->name); VIR_DEBUG("Starting drive mirrors for domain %s", vm->def->name);

View File

@ -936,7 +936,7 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon G_GNUC_UNUSED,
virQEMUDriverPtr driver = opaque; virQEMUDriverPtr driver = opaque;
struct qemuProcessEvent *processEvent = NULL; struct qemuProcessEvent *processEvent = NULL;
virDomainDiskDefPtr disk; virDomainDiskDefPtr disk;
VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL; g_autoptr(qemuBlockJobData) job = NULL;
char *data = NULL; char *data = NULL;
virObjectLock(vm); virObjectLock(vm);
@ -5537,7 +5537,7 @@ static int
qemuProcessStartUpdateCustomCaps(virDomainObjPtr vm) qemuProcessStartUpdateCustomCaps(virDomainObjPtr vm)
{ {
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(priv->driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(priv->driver);
qemuDomainXmlNsDefPtr nsdef = vm->def->namespaceData; qemuDomainXmlNsDefPtr nsdef = vm->def->namespaceData;
char **next; char **next;
int tmp; int tmp;

View File

@ -240,7 +240,7 @@ qemuSlirpStop(qemuSlirpPtr slirp,
virDomainNetDefPtr net, virDomainNetDefPtr net,
bool hot) bool hot)
{ {
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
g_autofree char *pidfile = NULL; g_autofree char *pidfile = NULL;
g_autofree char *dbus_path = NULL; g_autofree char *dbus_path = NULL;
g_autofree char *id = qemuSlirpGetDBusVMStateId(net); g_autofree char *id = qemuSlirpGetDBusVMStateId(net);
@ -296,7 +296,7 @@ qemuSlirpStart(qemuSlirpPtr slirp,
bool hotplug, bool hotplug,
bool incoming) bool incoming)
{ {
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
g_autoptr(virCommand) cmd = NULL; g_autoptr(virCommand) cmd = NULL;
g_autofree char *pidfile = NULL; g_autofree char *pidfile = NULL;
g_autofree char *dbus_path = NULL; g_autofree char *dbus_path = NULL;

View File

@ -105,7 +105,7 @@ int qemuExtVhostUserGPUStart(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainVideoDefPtr video) virDomainVideoDefPtr video)
{ {
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
g_autofree char *shortname = NULL; g_autofree char *shortname = NULL;
g_autofree char *pidfile = NULL; g_autofree char *pidfile = NULL;
g_autoptr(virCommand) cmd = NULL; g_autoptr(virCommand) cmd = NULL;
@ -209,7 +209,7 @@ void qemuExtVhostUserGPUStop(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainVideoDefPtr video) virDomainVideoDefPtr video)
{ {
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
g_autofree char *pidfile = NULL; g_autofree char *pidfile = NULL;
g_autofree char *shortname = NULL; g_autofree char *shortname = NULL;
virErrorPtr orig_err; virErrorPtr orig_err;
@ -252,7 +252,7 @@ qemuExtVhostUserGPUSetupCgroup(virQEMUDriverPtr driver,
virDomainVideoDefPtr video, virDomainVideoDefPtr video,
virCgroupPtr cgroup) virCgroupPtr cgroup)
{ {
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
g_autofree char *shortname = NULL; g_autofree char *shortname = NULL;
int rc; int rc;
pid_t pid; pid_t pid;

View File

@ -239,7 +239,7 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state,
ssize_t len; ssize_t len;
int backingFormat; int backingFormat;
g_autoptr(virStorageVolDef) vol = NULL; g_autoptr(virStorageVolDef) vol = NULL;
VIR_AUTOUNREF(virStorageSourcePtr) meta = NULL; g_autoptr(virStorageSource) meta = NULL;
g_autofree char *header = NULL; g_autofree char *header = NULL;
*volptr = NULL; *volptr = NULL;

View File

@ -3359,7 +3359,7 @@ storageBackendProbeTarget(virStorageSourcePtr target,
int backingStoreFormat; int backingStoreFormat;
int rc; int rc;
struct stat sb; struct stat sb;
VIR_AUTOUNREF(virStorageSourcePtr) meta = NULL; g_autoptr(virStorageSource) meta = NULL;
VIR_AUTOCLOSE fd = -1; VIR_AUTOCLOSE fd = -1;
if (encryption) if (encryption)
@ -3529,7 +3529,7 @@ virStorageBackendRefreshLocal(virStoragePoolObjPtr pool)
int ret = -1; int ret = -1;
g_autoptr(virStorageVolDef) vol = NULL; g_autoptr(virStorageVolDef) vol = NULL;
VIR_AUTOCLOSE fd = -1; VIR_AUTOCLOSE fd = -1;
VIR_AUTOUNREF(virStorageSourcePtr) target = NULL; g_autoptr(virStorageSource) target = NULL;
if (virDirOpen(&dir, def->target.path) < 0) if (virDirOpen(&dir, def->target.path) < 0)
goto cleanup; goto cleanup;

View File

@ -8558,7 +8558,7 @@ testDomainSnapshotCreateXML(virDomainPtr domain,
bool update_current = true; bool update_current = true;
bool redefine = flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE; bool redefine = flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE;
unsigned int parse_flags = VIR_DOMAIN_SNAPSHOT_PARSE_DISKS; unsigned int parse_flags = VIR_DOMAIN_SNAPSHOT_PARSE_DISKS;
VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL; g_autoptr(virDomainSnapshotDef) def = NULL;
/* /*
* DISK_ONLY: Not implemented yet * DISK_ONLY: Not implemented yet
@ -9042,7 +9042,7 @@ testDomainCheckpointCreateXML(virDomainPtr domain,
bool update_current = true; bool update_current = true;
bool redefine = flags & VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE; bool redefine = flags & VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE;
unsigned int parse_flags = 0; unsigned int parse_flags = 0;
VIR_AUTOUNREF(virDomainCheckpointDefPtr) def = NULL; g_autoptr(virDomainCheckpointDef) def = NULL;
virCheckFlags(VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE | virCheckFlags(VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE |
VIR_DOMAIN_CHECKPOINT_CREATE_QUIESCE, NULL); VIR_DOMAIN_CHECKPOINT_CREATE_QUIESCE, NULL);

View File

@ -144,7 +144,7 @@ virHostdevManagerDispose(void *obj)
static virHostdevManagerPtr static virHostdevManagerPtr
virHostdevManagerNew(void) virHostdevManagerNew(void)
{ {
VIR_AUTOUNREF(virHostdevManagerPtr) hostdevMgr = NULL; g_autoptr(virHostdevManager) hostdevMgr = NULL;
bool privileged = geteuid() == 0; bool privileged = geteuid() == 0;
if (!(hostdevMgr = virObjectNew(virHostdevManagerClass))) if (!(hostdevMgr = virObjectNew(virHostdevManagerClass)))
@ -264,7 +264,7 @@ virHostdevGetPCIHostDevice(const virDomainHostdevDef *hostdev,
static virPCIDeviceListPtr static virPCIDeviceListPtr
virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs) virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs)
{ {
VIR_AUTOUNREF(virPCIDeviceListPtr) pcidevs = NULL; g_autoptr(virPCIDeviceList) pcidevs = NULL;
size_t i; size_t i;
if (!(pcidevs = virPCIDeviceListNew())) if (!(pcidevs = virPCIDeviceListNew()))
@ -713,7 +713,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
int nhostdevs, int nhostdevs,
unsigned int flags) unsigned int flags)
{ {
VIR_AUTOUNREF(virPCIDeviceListPtr) pcidevs = NULL; g_autoptr(virPCIDeviceList) pcidevs = NULL;
int last_processed_hostdev_vf = -1; int last_processed_hostdev_vf = -1;
size_t i; size_t i;
int ret = -1; int ret = -1;
@ -985,7 +985,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr mgr,
int nhostdevs, int nhostdevs,
const char *oldStateDir) const char *oldStateDir)
{ {
VIR_AUTOUNREF(virPCIDeviceListPtr) pcidevs = NULL; g_autoptr(virPCIDeviceList) pcidevs = NULL;
size_t i; size_t i;
if (!nhostdevs) if (!nhostdevs)
@ -1386,7 +1386,7 @@ virHostdevFindUSBDevice(virDomainHostdevDefPtr hostdev,
* automatically found before. * automatically found before.
*/ */
if (vendor) { if (vendor) {
VIR_AUTOUNREF(virUSBDeviceListPtr) devs = NULL; g_autoptr(virUSBDeviceList) devs = NULL;
rc = virUSBDeviceFindByVendor(vendor, product, NULL, mandatory, &devs); rc = virUSBDeviceFindByVendor(vendor, product, NULL, mandatory, &devs);
if (rc < 0) { if (rc < 0) {
@ -1442,7 +1442,7 @@ virHostdevPrepareUSBDevices(virHostdevManagerPtr mgr,
unsigned int flags) unsigned int flags)
{ {
size_t i; size_t i;
VIR_AUTOUNREF(virUSBDeviceListPtr) list = NULL; g_autoptr(virUSBDeviceList) list = NULL;
virUSBDevicePtr tmp; virUSBDevicePtr tmp;
bool coldBoot = !!(flags & VIR_HOSTDEV_COLD_BOOT); bool coldBoot = !!(flags & VIR_HOSTDEV_COLD_BOOT);
@ -1537,7 +1537,7 @@ virHostdevPrepareSCSIDevices(virHostdevManagerPtr mgr,
{ {
size_t i, j; size_t i, j;
int count; int count;
VIR_AUTOUNREF(virSCSIDeviceListPtr) list = NULL; g_autoptr(virSCSIDeviceList) list = NULL;
virSCSIDevicePtr tmp; virSCSIDevicePtr tmp;
if (!nhostdevs) if (!nhostdevs)
@ -1632,7 +1632,7 @@ virHostdevPrepareSCSIVHostDevices(virHostdevManagerPtr mgr,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs) int nhostdevs)
{ {
VIR_AUTOUNREF(virSCSIVHostDeviceListPtr) list = NULL; g_autoptr(virSCSIVHostDeviceList) list = NULL;
virSCSIVHostDevicePtr tmp; virSCSIVHostDevicePtr tmp;
size_t i, j; size_t i, j;
@ -1718,7 +1718,7 @@ virHostdevPrepareMediatedDevices(virHostdevManagerPtr mgr,
int nhostdevs) int nhostdevs)
{ {
size_t i; size_t i;
VIR_AUTOUNREF(virMediatedDeviceListPtr) list = NULL; g_autoptr(virMediatedDeviceList) list = NULL;
if (!nhostdevs) if (!nhostdevs)
return 0; return 0;

View File

@ -1129,7 +1129,7 @@ static virStorageSourcePtr
virStorageFileMetadataNew(const char *path, virStorageFileMetadataNew(const char *path,
int format) int format)
{ {
VIR_AUTOUNREF(virStorageSourcePtr) def = NULL; g_autoptr(virStorageSource) def = NULL;
virStorageSourcePtr ret = NULL; virStorageSourcePtr ret = NULL;
if (!(def = virStorageSourceNew())) if (!(def = virStorageSourceNew()))
@ -1219,7 +1219,7 @@ virStorageFileGetMetadataFromFD(const char *path,
struct stat sb; struct stat sb;
int dummy; int dummy;
g_autofree char *buf = NULL; g_autofree char *buf = NULL;
VIR_AUTOUNREF(virStorageSourcePtr) meta = NULL; g_autoptr(virStorageSource) meta = NULL;
if (!backingFormat) if (!backingFormat)
backingFormat = &dummy; backingFormat = &dummy;
@ -2251,7 +2251,7 @@ virStorageSourceCopy(const virStorageSource *src,
bool backingChain) bool backingChain)
{ {
virStorageSourcePtr ret = NULL; virStorageSourcePtr ret = NULL;
VIR_AUTOUNREF(virStorageSourcePtr) def = NULL; g_autoptr(virStorageSource) def = NULL;
if (!(def = virStorageSourceNew())) if (!(def = virStorageSourceNew()))
return NULL; return NULL;
@ -2629,7 +2629,7 @@ virStorageSourceNewFromBackingRelative(virStorageSourcePtr parent,
{ {
virStorageSourcePtr ret = NULL; virStorageSourcePtr ret = NULL;
g_autofree char *dirname = NULL; g_autofree char *dirname = NULL;
VIR_AUTOUNREF(virStorageSourcePtr) def = NULL; g_autoptr(virStorageSource) def = NULL;
if (!(def = virStorageSourceNew())) if (!(def = virStorageSourceNew()))
return NULL; return NULL;
@ -3681,7 +3681,7 @@ virStorageSourceNewFromBackingAbsolute(const char *path,
{ {
const char *json; const char *json;
int rc = 0; int rc = 0;
VIR_AUTOUNREF(virStorageSourcePtr) def = NULL; g_autoptr(virStorageSource) def = NULL;
*src = NULL; *src = NULL;
@ -3748,7 +3748,7 @@ virStorageSourceNewFromChild(virStorageSourcePtr parent,
virStorageSourcePtr *child) virStorageSourcePtr *child)
{ {
struct stat st; struct stat st;
VIR_AUTOUNREF(virStorageSourcePtr) def = NULL; g_autoptr(virStorageSource) def = NULL;
int rc = 0; int rc = 0;
*child = NULL; *child = NULL;
@ -3948,7 +3948,7 @@ virStorageSourceUpdateCapacity(virStorageSourcePtr src,
bool probe) bool probe)
{ {
int format = src->format; int format = src->format;
VIR_AUTOUNREF(virStorageSourcePtr) meta = NULL; g_autoptr(virStorageSource) meta = NULL;
/* Raw files: capacity is physical size. For all other files: if /* Raw files: capacity is physical size. For all other files: if
* the metadata has a capacity, use that, otherwise fall back to * the metadata has a capacity, use that, otherwise fall back to
@ -4943,7 +4943,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
int backingFormat; int backingFormat;
int rv; int rv;
g_autofree char *buf = NULL; g_autofree char *buf = NULL;
VIR_AUTOUNREF(virStorageSourcePtr) backingStore = NULL; g_autoptr(virStorageSource) backingStore = NULL;
VIR_DEBUG("path=%s format=%d uid=%u gid=%u", VIR_DEBUG("path=%s format=%d uid=%u gid=%u",
src->path, src->format, src->path, src->format,
@ -5028,7 +5028,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
VIR_STEAL_PTR(src->backingStore, backingStore); VIR_STEAL_PTR(src->backingStore, backingStore);
if (src->externalDataStoreRaw) { if (src->externalDataStoreRaw) {
VIR_AUTOUNREF(virStorageSourcePtr) externalDataStore = NULL; g_autoptr(virStorageSource) externalDataStore = NULL;
if ((rv = virStorageSourceNewFromExternalData(src, if ((rv = virStorageSourceNewFromExternalData(src,
&externalDataStore)) < 0) &externalDataStore)) < 0)
@ -5121,7 +5121,7 @@ virStorageFileGetBackingStoreStr(virStorageSourcePtr src,
ssize_t headerLen; ssize_t headerLen;
int rv; int rv;
g_autofree char *buf = NULL; g_autofree char *buf = NULL;
VIR_AUTOUNREF(virStorageSourcePtr) tmp = NULL; g_autoptr(virStorageSource) tmp = NULL;
*backing = NULL; *backing = NULL;

View File

@ -5477,7 +5477,7 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom,
virDomainSnapshotPtr ret = NULL; virDomainSnapshotPtr ret = NULL;
unsigned int parse_flags = (VIR_DOMAIN_SNAPSHOT_PARSE_DISKS | unsigned int parse_flags = (VIR_DOMAIN_SNAPSHOT_PARSE_DISKS |
VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE); VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE);
VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL; g_autoptr(virDomainSnapshotDef) def = NULL;
if (!data->vboxObj) if (!data->vboxObj)
return ret; return ret;
@ -6199,7 +6199,7 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
char *ret = NULL; char *ret = NULL;
virDomainDefPtr defdom; virDomainDefPtr defdom;
VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL; g_autoptr(virDomainSnapshotDef) def = NULL;
if (!data->vboxObj) if (!data->vboxObj)
return ret; return ret;

View File

@ -2595,7 +2595,7 @@ vzDomainSnapshotCreateXML(virDomainPtr domain,
virDomainSnapshotObjListPtr snapshots = NULL; virDomainSnapshotObjListPtr snapshots = NULL;
virDomainMomentObjPtr current; virDomainMomentObjPtr current;
bool job = false; bool job = false;
VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL; g_autoptr(virDomainSnapshotDef) def = NULL;
virCheckFlags(VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE, NULL); virCheckFlags(VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE, NULL);

View File

@ -54,8 +54,8 @@ testBackingXMLjsonXML(const void *args)
g_autofree char *propsstr = NULL; g_autofree char *propsstr = NULL;
g_autofree char *protocolwrapper = NULL; g_autofree char *protocolwrapper = NULL;
g_autofree char *actualxml = NULL; g_autofree char *actualxml = NULL;
VIR_AUTOUNREF(virStorageSourcePtr) xmlsrc = NULL; g_autoptr(virStorageSource) xmlsrc = NULL;
VIR_AUTOUNREF(virStorageSourcePtr) jsonsrc = NULL; g_autoptr(virStorageSource) jsonsrc = NULL;
if (!(xmlsrc = virStorageSourceNew())) if (!(xmlsrc = virStorageSourceNew()))
return -1; return -1;
@ -400,7 +400,7 @@ testQemuImageCreate(const void *opaque)
struct testQemuImageCreateData *data = (void *) opaque; struct testQemuImageCreateData *data = (void *) opaque;
g_autoptr(virJSONValue) protocolprops = NULL; g_autoptr(virJSONValue) protocolprops = NULL;
g_autoptr(virJSONValue) formatprops = NULL; g_autoptr(virJSONValue) formatprops = NULL;
VIR_AUTOUNREF(virStorageSourcePtr) src = NULL; g_autoptr(virStorageSource) src = NULL;
g_auto(virBuffer) debug = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) debug = VIR_BUFFER_INITIALIZER;
g_auto(virBuffer) actualbuf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) actualbuf = VIR_BUFFER_INITIALIZER;
g_autofree char *jsonprotocol = NULL; g_autofree char *jsonprotocol = NULL;

View File

@ -41,7 +41,7 @@ testCompareXMLToXMLFiles(const char *inxml,
g_autofree char *inXmlData = NULL; g_autofree char *inXmlData = NULL;
g_autofree char *outXmlData = NULL; g_autofree char *outXmlData = NULL;
g_autofree char *actual = NULL; g_autofree char *actual = NULL;
VIR_AUTOUNREF(virDomainCheckpointDefPtr) def = NULL; g_autoptr(virDomainCheckpointDef) def = NULL;
if (flags & TEST_REDEFINE) if (flags & TEST_REDEFINE)
parseflags |= VIR_DOMAIN_CHECKPOINT_PARSE_REDEFINE; parseflags |= VIR_DOMAIN_CHECKPOINT_PARSE_REDEFINE;

View File

@ -38,7 +38,7 @@ testCompareXMLToXMLFiles(const char *inxml,
unsigned int parseflags = VIR_DOMAIN_SNAPSHOT_PARSE_DISKS; unsigned int parseflags = VIR_DOMAIN_SNAPSHOT_PARSE_DISKS;
unsigned int formatflags = VIR_DOMAIN_SNAPSHOT_FORMAT_SECURE; unsigned int formatflags = VIR_DOMAIN_SNAPSHOT_FORMAT_SECURE;
bool cur = false; bool cur = false;
VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL; g_autoptr(virDomainSnapshotDef) def = NULL;
if (flags & TEST_INTERNAL) { if (flags & TEST_INTERNAL) {
parseflags |= VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL; parseflags |= VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL;

View File

@ -40,7 +40,7 @@ prepareObjects(virQEMUDriverPtr driver,
virDomainObjPtr *vm_ret) virDomainObjPtr *vm_ret)
{ {
qemuDomainObjPrivatePtr priv; qemuDomainObjPrivatePtr priv;
VIR_AUTOUNREF(virDomainObjPtr) vm = NULL; g_autoptr(virDomainObj) vm = NULL;
g_autofree char *filename = NULL; g_autofree char *filename = NULL;
g_autofree char *domxml = NULL; g_autofree char *domxml = NULL;
g_autofree char *latestCapsFile = NULL; g_autofree char *latestCapsFile = NULL;
@ -84,7 +84,7 @@ static int
testDomain(const void *opaque) testDomain(const void *opaque)
{ {
const struct testData *data = opaque; const struct testData *data = opaque;
VIR_AUTOUNREF(virDomainObjPtr) vm = NULL; g_autoptr(virDomainObj) vm = NULL;
VIR_AUTOSTRINGLIST notRestored = NULL; VIR_AUTOSTRINGLIST notRestored = NULL;
size_t i; size_t i;
int ret = -1; int ret = -1;

View File

@ -54,7 +54,7 @@ test_virStoragePoolCapsFormat(const void *opaque)
struct test_virStoragePoolCapsFormatData *data = struct test_virStoragePoolCapsFormatData *data =
(struct test_virStoragePoolCapsFormatData *) opaque; (struct test_virStoragePoolCapsFormatData *) opaque;
virCapsPtr driverCaps = data->driverCaps; virCapsPtr driverCaps = data->driverCaps;
VIR_AUTOUNREF(virStoragePoolCapsPtr) poolCaps = NULL; g_autoptr(virStoragePoolCaps) poolCaps = NULL;
g_autofree char *path = NULL; g_autofree char *path = NULL;
g_autofree char *poolCapsXML = NULL; g_autofree char *poolCapsXML = NULL;
@ -81,8 +81,8 @@ static int
mymain(void) mymain(void)
{ {
int ret = 0; int ret = 0;
VIR_AUTOUNREF(virCapsPtr) fullCaps = NULL; g_autoptr(virCaps) fullCaps = NULL;
VIR_AUTOUNREF(virCapsPtr) fsCaps = NULL; g_autoptr(virCaps) fsCaps = NULL;
#define DO_TEST(Filename, DriverCaps) \ #define DO_TEST(Filename, DriverCaps) \
do { \ do { \

View File

@ -86,7 +86,7 @@ testStorageFileGetMetadata(const char *path,
{ {
struct stat st; struct stat st;
virStorageSourcePtr ret = NULL; virStorageSourcePtr ret = NULL;
VIR_AUTOUNREF(virStorageSourcePtr) def = NULL; g_autoptr(virStorageSource) def = NULL;
if (!(def = virStorageSourceNew())) if (!(def = virStorageSourceNew()))
return NULL; return NULL;
@ -278,7 +278,7 @@ testStorageChain(const void *args)
const struct testChainData *data = args; const struct testChainData *data = args;
virStorageSourcePtr elt; virStorageSourcePtr elt;
size_t i = 0; size_t i = 0;
VIR_AUTOUNREF(virStorageSourcePtr) meta = NULL; g_autoptr(virStorageSource) meta = NULL;
g_autofree char *broken = NULL; g_autofree char *broken = NULL;
meta = testStorageFileGetMetadata(data->start, data->format, -1, -1); meta = testStorageFileGetMetadata(data->start, data->format, -1, -1);
@ -612,7 +612,7 @@ testBackingParse(const void *args)
const struct testBackingParseData *data = args; const struct testBackingParseData *data = args;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
g_autofree char *xml = NULL; g_autofree char *xml = NULL;
VIR_AUTOUNREF(virStorageSourcePtr) src = NULL; g_autoptr(virStorageSource) src = NULL;
int rc; int rc;
int erc = data->rv; int erc = data->rv;
@ -664,7 +664,7 @@ mymain(void)
virStorageSourcePtr chain2; /* short for chain->backingStore */ virStorageSourcePtr chain2; /* short for chain->backingStore */
virStorageSourcePtr chain3; /* short for chain2->backingStore */ virStorageSourcePtr chain3; /* short for chain2->backingStore */
g_autoptr(virCommand) cmd = NULL; g_autoptr(virCommand) cmd = NULL;
VIR_AUTOUNREF(virStorageSourcePtr) chain = NULL; g_autoptr(virStorageSource) chain = NULL;
if (storageRegisterAll() < 0) if (storageRegisterAll() < 0)
return EXIT_FAILURE; return EXIT_FAILURE;