--- src/lxc/lxc_driver.c | 129 +++++++++++++++++--------------------------------- src/lxc/lxc_process.c | 3 +- 2 files changed, 44 insertions(+), 88 deletions(-) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 1086289..76ff824 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -263,8 +263,7 @@ static virDomainPtr lxcDomainLookupByID(virConnectPtr conn, dom->id = vm->def->id; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return dom; } @@ -293,8 +292,7 @@ static virDomainPtr lxcDomainLookupByUUID(virConnectPtr conn, dom->id = vm->def->id; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return dom; } @@ -320,8 +318,7 @@ static virDomainPtr lxcDomainLookupByName(virConnectPtr conn, dom->id = vm->def->id; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return dom; } @@ -340,8 +337,7 @@ static int lxcDomainIsActive(virDomainPtr dom) ret = virDomainObjIsActive(obj); cleanup: - if (obj) - virObjectUnlock(obj); + virObjectUnlock(obj); return ret; } @@ -360,8 +356,7 @@ static int lxcDomainIsPersistent(virDomainPtr dom) ret = obj->persistent; cleanup: - if (obj) - virObjectUnlock(obj); + virObjectUnlock(obj); return ret; } @@ -379,8 +374,7 @@ static int lxcDomainIsUpdated(virDomainPtr dom) ret = obj->updated; cleanup: - if (obj) - virObjectUnlock(obj); + virObjectUnlock(obj); return ret; } @@ -502,8 +496,7 @@ static virDomainPtr lxcDomainDefineXML(virConnectPtr conn, const char *xml) cleanup: virDomainDefFree(def); virDomainDefFree(oldDef); - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); if (event) virObjectEventStateQueue(driver->domainEventState, event); virObjectUnref(caps); @@ -553,8 +546,7 @@ static int lxcDomainUndefineFlags(virDomainPtr dom, ret = 0; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); if (event) virObjectEventStateQueue(driver->domainEventState, event); virObjectUnref(cfg); @@ -609,8 +601,7 @@ static int lxcDomainGetInfo(virDomainPtr dom, ret = 0; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return ret; } @@ -635,8 +626,7 @@ lxcDomainGetState(virDomainPtr dom, ret = 0; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return ret; } @@ -655,8 +645,7 @@ static char *lxcDomainGetOSType(virDomainPtr dom) goto cleanup; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return ret; } @@ -676,8 +665,7 @@ lxcDomainGetMaxMemory(virDomainPtr dom) ret = vm->def->mem.max_balloon; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return ret; } @@ -702,8 +690,7 @@ static int lxcDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) ret = 0; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return ret; } @@ -742,8 +729,7 @@ static int lxcDomainSetMemory(virDomainPtr dom, unsigned long newmem) ret = 0; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return ret; } @@ -872,8 +858,7 @@ lxcDomainSetMemoryParameters(virDomainPtr dom, ret = 0; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); virObjectUnref(caps); virObjectUnref(cfg); return ret; @@ -969,8 +954,7 @@ lxcDomainGetMemoryParameters(virDomainPtr dom, ret = 0; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); virObjectUnref(caps); return ret; } @@ -994,8 +978,7 @@ static char *lxcDomainGetXMLDesc(virDomainPtr dom, flags); cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return ret; } @@ -1085,8 +1068,7 @@ static int lxcDomainCreateWithFiles(virDomainPtr dom, } cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); if (event) virObjectEventStateQueue(driver->domainEventState, event); virObjectUnref(cfg); @@ -1199,8 +1181,7 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn, cleanup: virDomainDefFree(def); - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); if (event) virObjectEventStateQueue(driver->domainEventState, event); virObjectUnref(caps); @@ -1274,8 +1255,7 @@ static int lxcDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr secla ret = 0; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return ret; } @@ -1449,8 +1429,7 @@ lxcDomainDestroyFlags(virDomainPtr dom, } cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); if (event) virObjectEventStateQueue(driver->domainEventState, event); return ret; @@ -1776,8 +1755,7 @@ static char *lxcDomainGetSchedulerType(virDomainPtr dom, ignore_value(VIR_STRDUP(ret, "posix")); cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return ret; } @@ -1958,8 +1936,7 @@ lxcDomainSetSchedulerParametersFlags(virDomainPtr dom, cleanup: virDomainDefFree(vmdef); - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); virObjectUnref(caps); virObjectUnref(cfg); return ret; @@ -2066,8 +2043,7 @@ lxcDomainGetSchedulerParametersFlags(virDomainPtr dom, ret = 0; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); virObjectUnref(caps); return ret; } @@ -2306,8 +2282,7 @@ lxcDomainBlockStats(virDomainPtr dom, &stats->rd_req, &stats->wr_req); cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return ret; } @@ -2432,8 +2407,7 @@ lxcDomainBlockStatsFlags(virDomainPtr dom, *nparams = tmp; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return ret; } @@ -2639,8 +2613,7 @@ lxcDomainSetBlkioParameters(virDomainPtr dom, } cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); virObjectUnref(caps); virObjectUnref(cfg); return ret; @@ -3055,8 +3028,7 @@ lxcDomainGetBlkioParameters(virDomainPtr dom, ret = 0; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); virObjectUnref(caps); return ret; } @@ -3100,8 +3072,7 @@ lxcDomainInterfaceStats(virDomainPtr dom, _("Invalid path, '%s' is not a known interface"), path); cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return ret; } #else @@ -3131,8 +3102,7 @@ static int lxcDomainGetAutostart(virDomainPtr dom, ret = 0; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return ret; } @@ -3202,8 +3172,7 @@ static int lxcDomainSetAutostart(virDomainPtr dom, cleanup: VIR_FREE(configFile); VIR_FREE(autostartLink); - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); virObjectUnref(cfg); return ret; } @@ -3334,8 +3303,7 @@ static int lxcDomainSuspend(virDomainPtr dom) cleanup: if (event) virObjectEventStateQueue(driver->domainEventState, event); - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); virObjectUnref(cfg); return ret; } @@ -3384,8 +3352,7 @@ static int lxcDomainResume(virDomainPtr dom) cleanup: if (event) virObjectEventStateQueue(driver->domainEventState, event); - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); virObjectUnref(cfg); return ret; } @@ -3449,8 +3416,7 @@ lxcDomainOpenConsole(virDomainPtr dom, ret = 0; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return ret; } @@ -3522,8 +3488,7 @@ lxcDomainSendProcessSignal(virDomainPtr dom, ret = 0; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return ret; } @@ -3621,8 +3586,7 @@ lxcDomainShutdownFlags(virDomainPtr dom, ret = 0; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return ret; } @@ -3698,8 +3662,7 @@ lxcDomainReboot(virDomainPtr dom, ret = 0; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return ret; } @@ -5036,8 +4999,7 @@ static int lxcDomainAttachDeviceFlags(virDomainPtr dom, if (dev != dev_copy) virDomainDeviceDefFree(dev_copy); virDomainDeviceDefFree(dev); - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); virObjectUnref(caps); virObjectUnref(cfg); return ret; @@ -5158,8 +5120,7 @@ static int lxcDomainUpdateDeviceFlags(virDomainPtr dom, if (dev != dev_copy) virDomainDeviceDefFree(dev_copy); virDomainDeviceDefFree(dev); - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); virObjectUnref(caps); virObjectUnref(cfg); return ret; @@ -5278,8 +5239,7 @@ static int lxcDomainDetachDeviceFlags(virDomainPtr dom, if (dev != dev_copy) virDomainDeviceDefFree(dev_copy); virDomainDeviceDefFree(dev); - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); virObjectUnref(caps); virObjectUnref(cfg); return ret; @@ -5331,8 +5291,7 @@ static int lxcDomainLxcOpenNamespace(virDomainPtr dom, ret = nfds; cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return ret; } @@ -5427,8 +5386,7 @@ lxcDomainMemoryStats(virDomainPtr dom, } cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return ret; } @@ -5645,8 +5603,7 @@ lxcDomainGetCPUStats(virDomainPtr dom, ret = virCgroupGetPercpuStats(priv->cgroup, params, nparams, start_cpu, ncpus, 0); cleanup: - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); return ret; } diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index 0aef13a..115d6d7 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -516,8 +516,7 @@ static void virLXCProcessMonitorEOFNotify(virLXCMonitorPtr mon, } } - if (vm) - virObjectUnlock(vm); + virObjectUnlock(vm); if (event) { virObjectEventStateQueue(driver->domainEventState, event); } -- 1.9.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list