udev: drop trivial wrapper for udev_watch_begin()
This commit is contained in:
committed by
Luca Boccassi
parent
f80b7d1a89
commit
04b2541000
@@ -1134,24 +1134,3 @@ void udev_event_execute_run(UdevEvent *event, usec_t timeout_usec, int timeout_s
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void udev_event_process_inotify_watch(UdevEvent *event, int inotify_fd) {
|
||||
sd_device *dev;
|
||||
int r;
|
||||
|
||||
assert(event);
|
||||
assert(inotify_fd >= 0);
|
||||
|
||||
dev = ASSERT_PTR(event->dev);
|
||||
|
||||
if (!event->inotify_watch)
|
||||
return;
|
||||
|
||||
if (device_for_action(dev, SD_DEVICE_REMOVE))
|
||||
return;
|
||||
|
||||
r = udev_watch_begin(inotify_fd, dev);
|
||||
if (r < 0) /* The device may be already removed, downgrade log level in that case. */
|
||||
log_device_full_errno(dev, r == -ENOENT ? LOG_DEBUG : LOG_WARNING, r,
|
||||
"Failed to add inotify watch, ignoring: %m");
|
||||
}
|
||||
|
||||
@@ -76,7 +76,6 @@ int udev_event_execute_rules(
|
||||
Hashmap *properties_list,
|
||||
UdevRules *rules);
|
||||
void udev_event_execute_run(UdevEvent *event, usec_t timeout_usec, int timeout_signal);
|
||||
void udev_event_process_inotify_watch(UdevEvent *event, int inotify_fd);
|
||||
|
||||
static inline usec_t udev_warn_timeout(usec_t timeout_usec) {
|
||||
return DIV_ROUND_UP(timeout_usec, 3);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "rm-rf.h"
|
||||
#include "stdio-util.h"
|
||||
#include "string-util.h"
|
||||
#include "udev-util.h"
|
||||
#include "udev-watch.h"
|
||||
|
||||
int device_new_from_watch_handle_at(sd_device **ret, int dirfd, int wd) {
|
||||
@@ -180,6 +181,9 @@ int udev_watch_begin(int inotify_fd, sd_device *dev) {
|
||||
assert(inotify_fd >= 0);
|
||||
assert(dev);
|
||||
|
||||
if (device_for_action(dev, SD_DEVICE_REMOVE))
|
||||
return 0;
|
||||
|
||||
r = sd_device_get_devname(dev, &devnode);
|
||||
if (r < 0)
|
||||
return log_device_debug_errno(dev, r, "Failed to get device node: %m");
|
||||
|
||||
+5
-1
@@ -642,7 +642,11 @@ static int worker_process_device(Manager *manager, sd_device *dev) {
|
||||
/* in case rtnl was initialized */
|
||||
manager->rtnl = sd_netlink_ref(udev_event->rtnl);
|
||||
|
||||
udev_event_process_inotify_watch(udev_event, manager->inotify_fd);
|
||||
if (udev_event->inotify_watch) {
|
||||
r = udev_watch_begin(manager->inotify_fd, dev);
|
||||
if (r < 0 && r != -ENOENT) /* The device may be already removed, ignore -ENOENT. */
|
||||
log_device_warning_errno(dev, r, "Failed to add inotify watch, ignoring: %m");
|
||||
}
|
||||
|
||||
log_device_uevent(dev, "Device processed");
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user