mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
virStorageVolObjNew: Move locking to usage site
This allows a later patch to replace virObjectLock/Unlock pairs with automatic mutex management code. Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
d12417de63
commit
bafcc61548
@ -125,16 +125,10 @@ VIR_ONCE_GLOBAL_INIT(virStorageVolObj);
|
|||||||
static virStorageVolObj *
|
static virStorageVolObj *
|
||||||
virStorageVolObjNew(void)
|
virStorageVolObjNew(void)
|
||||||
{
|
{
|
||||||
virStorageVolObj *obj;
|
|
||||||
|
|
||||||
if (virStorageVolObjInitialize() < 0)
|
if (virStorageVolObjInitialize() < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!(obj = virObjectLockableNew(virStorageVolObjClass)))
|
return virObjectLockableNew(virStorageVolObjClass);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
virObjectLock(obj);
|
|
||||||
return obj;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -638,6 +632,8 @@ virStoragePoolObjAddVol(virStoragePoolObj *obj,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virObjectLock(volobj);
|
||||||
|
|
||||||
g_hash_table_insert(volumes->objsKey, g_strdup(voldef->key), volobj);
|
g_hash_table_insert(volumes->objsKey, g_strdup(voldef->key), volobj);
|
||||||
virObjectRef(volobj);
|
virObjectRef(volobj);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user