1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-06 08:58:35 +03:00

node_device_udev: Test for mdevctlTimeout != -1

It is done a little differently everywhere in libvirt, but most common is to
test for != -1.

Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
This commit is contained in:
Marc Hartmayer 2024-04-23 20:08:52 +02:00 committed by Jonathon Jongsma
parent b13ddadc51
commit 1606d7ec99

@ -88,7 +88,7 @@ udevEventDataDispose(void *obj)
if (priv->watch != -1) if (priv->watch != -1)
virEventRemoveHandle(priv->watch); virEventRemoveHandle(priv->watch);
if (priv->mdevctlTimeout > 0) if (priv->mdevctlTimeout != -1)
virEventRemoveTimeout(priv->mdevctlTimeout); virEventRemoveTimeout(priv->mdevctlTimeout);
if (!priv->udev_monitor) if (!priv->udev_monitor)
@ -139,6 +139,7 @@ udevEventDataNew(void)
return NULL; return NULL;
} }
ret->mdevctlTimeout = -1;
ret->watch = -1; ret->watch = -1;
return ret; return ret;
} }
@ -2082,7 +2083,7 @@ launchMdevctlUpdateThread(int timer G_GNUC_UNUSED, void *opaque)
udevEventData *priv = opaque; udevEventData *priv = opaque;
virThread thread; virThread thread;
if (priv->mdevctlTimeout > 0) { if (priv->mdevctlTimeout != -1) {
virEventRemoveTimeout(priv->mdevctlTimeout); virEventRemoveTimeout(priv->mdevctlTimeout);
priv->mdevctlTimeout = -1; priv->mdevctlTimeout = -1;
} }
@ -2192,7 +2193,7 @@ scheduleMdevctlUpdate(udevEventData *data,
bool force) bool force)
{ {
if (!force) { if (!force) {
if (data->mdevctlTimeout > 0) if (data->mdevctlTimeout != -1)
virEventRemoveTimeout(data->mdevctlTimeout); virEventRemoveTimeout(data->mdevctlTimeout);
data->mdevctlTimeout = virEventAddTimeout(100, launchMdevctlUpdateThread, data->mdevctlTimeout = virEventAddTimeout(100, launchMdevctlUpdateThread,
data, NULL); data, NULL);