mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
nodedev: udev: Split udevEventHandleCallback in two functions
This patch splits udevEventHandleCallback in two (introduces udevEventHandleThread) in order to be later able to refactor the latter to actually become a normal thread which will wait some time for the kernel to create the whole sysfs tree for a device as we cannot do that in the event loop directly. Signed-off-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
6215b036e7
commit
5a47baaf44
@ -1679,12 +1679,10 @@ udevEventMonitorSanityCheck(udevEventDataPtr priv,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
udevEventHandleCallback(int watch ATTRIBUTE_UNUSED,
|
udevEventHandleThread(void *opaque)
|
||||||
int fd,
|
|
||||||
int events ATTRIBUTE_UNUSED,
|
|
||||||
void *data ATTRIBUTE_UNUSED)
|
|
||||||
{
|
{
|
||||||
udevEventDataPtr priv = driver->privateData;
|
udevEventDataPtr priv = driver->privateData;
|
||||||
|
int fd = (intptr_t) opaque;
|
||||||
struct udev_device *device = NULL;
|
struct udev_device *device = NULL;
|
||||||
|
|
||||||
virObjectLock(priv);
|
virObjectLock(priv);
|
||||||
@ -1708,6 +1706,25 @@ udevEventHandleCallback(int watch ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
udevEventHandleCallback(int watch ATTRIBUTE_UNUSED,
|
||||||
|
int fd,
|
||||||
|
int events ATTRIBUTE_UNUSED,
|
||||||
|
void *data ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
udevEventDataPtr priv = driver->privateData;
|
||||||
|
|
||||||
|
virObjectLock(priv);
|
||||||
|
if (!udevEventMonitorSanityCheck(priv, fd)) {
|
||||||
|
virObjectUnlock(priv);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
virObjectUnlock(priv);
|
||||||
|
|
||||||
|
udevEventHandleThread((void *)(intptr_t) fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* DMI is intel-compatible specific */
|
/* DMI is intel-compatible specific */
|
||||||
#if defined(__x86_64__) || defined(__i386__) || defined(__amd64__)
|
#if defined(__x86_64__) || defined(__i386__) || defined(__amd64__)
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user