While iterating with virDomainObjListForEach it is safe to remove
current element. But while iterating, 'doms' lock is already taken, so
can't use standard virDomainObjListRemove. So introduce
virDomainObjListRemoveLocked for this purpose.
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
virObjectUnlock(doms);
}
+/* The caller must hold lock on 'doms' in addition to 'virDomainObjListRemove'
+ * requirements
+ *
+ * Can be used to remove current element while iterating with
+ * virDomainObjListForEach
+ */
+void virDomainObjListRemoveLocked(virDomainObjListPtr doms,
+ virDomainObjPtr dom)
+{
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+
+ virUUIDFormat(dom->def->uuid, uuidstr);
+ virObjectUnlock(dom);
+
+ virHashRemoveEntry(doms->objs, uuidstr);
+}
+
static int
virDomainDeviceCCWAddressIsValid(virDomainDeviceCCWAddressPtr addr)
{
void virDomainObjListRemove(virDomainObjListPtr doms,
virDomainObjPtr dom);
+void virDomainObjListRemoveLocked(virDomainObjListPtr doms,
+ virDomainObjPtr dom);
virDomainDeviceDefPtr virDomainDeviceDefParse(const char *xmlStr,
virDomainDefPtr def,
virDomainObjListNew;
virDomainObjListNumOfDomains;
virDomainObjListRemove;
+virDomainObjListRemoveLocked;
virDomainObjNew;
virDomainObjSetDefTransient;
virDomainObjSetState;