find_device_from_devnode was guarded by HAVE_SYS_INOTIFY_H, alas its use in process_monitor_event was not, so linking failed.
On the way reduce the scope of a variable (which makes sense per se and avoids introducing a compiler warning with this change).
-- v2: winebus.sys: Fix the build without HAVE_SYS_INOTIFY_H winebus.sys: Fix the build without HAVE_SYS_INOTIFY_H
From: Gerald Pfeifer gerald@pfeifer.com
find_device_from_devnode was guarded by HAVE_SYS_INOTIFY_H, alas its use in process_monitor_event was not, so linking failed.
On the way reduce the scope of a variable (which makes sense per se and avoids introducing a compiler warning with this change). --- dlls/winebus.sys/bus_udev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 71b9ef84530..dfd9c97fdc6 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -1714,7 +1714,6 @@ error:
static void process_monitor_event(struct udev_monitor *monitor) { - struct base_device *impl; struct udev_device *dev; const char *action;
@@ -1735,9 +1734,13 @@ static void process_monitor_event(struct udev_monitor *monitor) udev_add_device(dev, -1); else { +#ifdef HAVE_SYS_INOTIFY_H + struct base_device *impl; + impl = find_device_from_devnode(udev_device_get_devnode(dev)); if (impl) bus_event_queue_device_removed(&event_queue, &impl->unix_device); else WARN("failed to find device for udev device %p\n", dev); +#endif }
udev_device_unref(dev);
From: Gerald Pfeifer gerald@pfeifer.com
find_device_from_devnode was unnecessarily guarded by HAVE_SYS_INOTIFY_H, alas its use in process_monitor_event was not, so linking failed. Simply make find_device_from_devnode generally available.
On the way reduce the scope of a variable. --- dlls/winebus.sys/bus_udev.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index dfd9c97fdc6..602591e6bc8 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -260,6 +260,16 @@ static struct base_device *find_device_from_fd(int fd) return NULL; }
+static struct base_device *find_device_from_devnode(const char *path) +{ + struct base_device *impl; + + LIST_FOR_EACH_ENTRY(impl, &device_list, struct base_device, unix_device.entry) + if (!strcmp(impl->devnode, path)) return impl; + + return NULL; +} + static void hidraw_device_destroy(struct unix_device *iface) { struct hidraw_device *impl = hidraw_impl_from_unix_device(iface); @@ -1546,16 +1556,6 @@ static int create_inotify(void) return fd; }
-static struct base_device *find_device_from_devnode(const char *path) -{ - struct base_device *impl; - - LIST_FOR_EACH_ENTRY(impl, &device_list, struct base_device, unix_device.entry) - if (!strcmp(impl->devnode, path)) return impl; - - return NULL; -} - static void maybe_remove_devnode(const char *base, const char *dir) { struct base_device *impl; @@ -1734,13 +1734,11 @@ static void process_monitor_event(struct udev_monitor *monitor) udev_add_device(dev, -1); else { -#ifdef HAVE_SYS_INOTIFY_H struct base_device *impl;
impl = find_device_from_devnode(udev_device_get_devnode(dev)); if (impl) bus_event_queue_device_removed(&event_queue, &impl->unix_device); else WARN("failed to find device for udev device %p\n", dev); -#endif }
udev_device_unref(dev);
On Tue Dec 13 17:44:21 2022 +0000, Alex Henrie wrote:
Would it be helpful to print a (different) warning message if inotify.h was not available at compile time?
Per other comments, we can actually retain the functionality by making the function available also when HAVE_SYS_INOTIFY_H is off.
Sooo... squashing - 2cdbe34a - winebus.sys: Fix the build without HAVE_SYS_INOTIFY_H - 302ef78f - winebus.sys: Fix the build without HAVE_SYS_INOTIFY_H
(and ignoring the 21 commits from branch wine:master) this now works and does what everyone suggested.
Just Git and me are not friends yet, and I'm not sure how to proceed. :-(
I could create a completely new request, which would lose history and doesn't feel right? Help, please.
On Wed Dec 14 09:47:33 2022 +0000, Gerald Pfeifer wrote:
Sooo... squashing
- 2cdbe34a - winebus.sys: Fix the build without HAVE_SYS_INOTIFY_H
- 302ef78f - winebus.sys: Fix the build without HAVE_SYS_INOTIFY_H
(and ignoring the 21 commits from branch wine:master) this now works and does what everyone suggested. Just Git and me are not friends yet, and I'm not sure how to proceed. :-( I could create a completely new request, which would lose history and doesn't feel right? Help, please.
With your branch checked out, you can do `git rebase -i master`. Then change the second "pick" into "fixup" and force push the branch again.