mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
lxc: Prepare virLXCDriverGetCapabilities for automatic mutex management
No functional change intended. This change makes the recfatoring to automatic mutex management easier to follow. Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
621fa350ab
commit
370fc9f47c
@ -156,28 +156,28 @@ virCaps *virLXCDriverCapsInit(virLXCDriver *driver)
|
|||||||
virCaps *virLXCDriverGetCapabilities(virLXCDriver *driver,
|
virCaps *virLXCDriverGetCapabilities(virLXCDriver *driver,
|
||||||
bool refresh)
|
bool refresh)
|
||||||
{
|
{
|
||||||
virCaps *ret;
|
virCaps *ret = NULL;
|
||||||
if (refresh) {
|
virCaps *caps = NULL;
|
||||||
virCaps *caps = NULL;
|
|
||||||
if ((caps = virLXCDriverCapsInit(driver)) == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
lxcDriverLock(driver);
|
lxcDriverLock(driver);
|
||||||
|
if (!refresh && !driver->caps) {
|
||||||
|
VIR_DEBUG("Capabilities didn't detect any guests. Forcing a refresh.");
|
||||||
|
refresh = true;
|
||||||
|
}
|
||||||
|
lxcDriverUnlock(driver);
|
||||||
|
|
||||||
|
if (refresh && !(caps = virLXCDriverCapsInit(driver)))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
lxcDriverLock(driver);
|
||||||
|
if (refresh) {
|
||||||
virObjectUnref(driver->caps);
|
virObjectUnref(driver->caps);
|
||||||
driver->caps = caps;
|
driver->caps = caps;
|
||||||
} else {
|
|
||||||
lxcDriverLock(driver);
|
|
||||||
|
|
||||||
if (driver->caps == NULL) {
|
|
||||||
VIR_DEBUG("Capabilities didn't detect any guests. Forcing a "
|
|
||||||
"refresh.");
|
|
||||||
lxcDriverUnlock(driver);
|
|
||||||
return virLXCDriverGetCapabilities(driver, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = virObjectRef(driver->caps);
|
ret = virObjectRef(driver->caps);
|
||||||
lxcDriverUnlock(driver);
|
lxcDriverUnlock(driver);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user