mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-26 18:41:17 +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,
|
||||
bool refresh)
|
||||
{
|
||||
virCaps *ret;
|
||||
if (refresh) {
|
||||
virCaps *ret = NULL;
|
||||
virCaps *caps = NULL;
|
||||
if ((caps = virLXCDriverCapsInit(driver)) == NULL)
|
||||
|
||||
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);
|
||||
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);
|
||||
lxcDriverUnlock(driver);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user