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:
Erik Skultety 2017-06-28 14:20:37 +02:00
parent 6215b036e7
commit 5a47baaf44

View File

@ -1679,12 +1679,10 @@ udevEventMonitorSanityCheck(udevEventDataPtr priv,
static void
udevEventHandleCallback(int watch ATTRIBUTE_UNUSED,
int fd,
int events ATTRIBUTE_UNUSED,
void *data ATTRIBUTE_UNUSED)
udevEventHandleThread(void *opaque)
{
udevEventDataPtr priv = driver->privateData;
int fd = (intptr_t) opaque;
struct udev_device *device = NULL;
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 */
#if defined(__x86_64__) || defined(__i386__) || defined(__amd64__)
static void