mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 02:25:18 +00:00
server rpc: Remove APIs for manipulating filters on locked client
We don't need to add or remove filters when client object is already locked anymore. There's no reason to keep the *Locked variants of those APIs. (cherry picked from commit d9ad41669828e33623ba8177f260b9f313c1963d)
This commit is contained in:
parent
6180670cd2
commit
f8e651117f
@ -218,20 +218,21 @@ static void virNetServerClientUpdateEvent(virNetServerClientPtr client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
int virNetServerClientAddFilter(virNetServerClientPtr client,
|
||||||
virNetServerClientAddFilterLocked(virNetServerClientPtr client,
|
virNetServerClientFilterFunc func,
|
||||||
virNetServerClientFilterFunc func,
|
void *opaque)
|
||||||
void *opaque)
|
|
||||||
{
|
{
|
||||||
virNetServerClientFilterPtr filter;
|
virNetServerClientFilterPtr filter;
|
||||||
virNetServerClientFilterPtr *place;
|
virNetServerClientFilterPtr *place;
|
||||||
int ret = -1;
|
int ret;
|
||||||
|
|
||||||
if (VIR_ALLOC(filter) < 0) {
|
if (VIR_ALLOC(filter) < 0) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virNetServerClientLock(client);
|
||||||
|
|
||||||
filter->id = client->nextFilterID++;
|
filter->id = client->nextFilterID++;
|
||||||
filter->func = func;
|
filter->func = func;
|
||||||
filter->opaque = opaque;
|
filter->opaque = opaque;
|
||||||
@ -243,28 +244,18 @@ virNetServerClientAddFilterLocked(virNetServerClientPtr client,
|
|||||||
|
|
||||||
ret = filter->id;
|
ret = filter->id;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int virNetServerClientAddFilter(virNetServerClientPtr client,
|
|
||||||
virNetServerClientFilterFunc func,
|
|
||||||
void *opaque)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
virNetServerClientLock(client);
|
|
||||||
ret = virNetServerClientAddFilterLocked(client, func, opaque);
|
|
||||||
virNetServerClientUnlock(client);
|
virNetServerClientUnlock(client);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void virNetServerClientRemoveFilter(virNetServerClientPtr client,
|
||||||
virNetServerClientRemoveFilterLocked(virNetServerClientPtr client,
|
int filterID)
|
||||||
int filterID)
|
|
||||||
{
|
{
|
||||||
virNetServerClientFilterPtr tmp, prev;
|
virNetServerClientFilterPtr tmp, prev;
|
||||||
|
|
||||||
|
virNetServerClientLock(client);
|
||||||
|
|
||||||
prev = NULL;
|
prev = NULL;
|
||||||
tmp = client->filters;
|
tmp = client->filters;
|
||||||
while (tmp) {
|
while (tmp) {
|
||||||
@ -280,13 +271,7 @@ virNetServerClientRemoveFilterLocked(virNetServerClientPtr client,
|
|||||||
prev = tmp;
|
prev = tmp;
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void virNetServerClientRemoveFilter(virNetServerClientPtr client,
|
|
||||||
int filterID)
|
|
||||||
{
|
|
||||||
virNetServerClientLock(client);
|
|
||||||
virNetServerClientRemoveFilterLocked(client, filterID);
|
|
||||||
virNetServerClientUnlock(client);
|
virNetServerClientUnlock(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user