summaryrefslogtreecommitdiff
path: root/src/udev/udev-event.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-02-10 22:15:01 +0100
committerLennart Poettering <lennart@poettering.net>2021-02-18 18:20:56 +0100
commita11300221482da7ffe7be2d75d508ddd411814f6 (patch)
tree009163435be6a2878d026e70439d731a1587a6e9 /src/udev/udev-event.c
parent96fb82aa06f2edef153c0ecb1642783aac1c1c84 (diff)
downloadsystemd-a11300221482da7ffe7be2d75d508ddd411814f6.tar.gz
sd-device: add sd_device_get_action() + sd_device_get_seqnum() + sd_device_new_from_stat_rdev()
To make sd-device properly usable for all programs we need to provide an API for the "action" field of an event, it's one of the most relevant ones, and it was so far missing. This also adds sd_device_get_seqnum(), which isn't that interesting, except for generating pretty debug output, which we use it ourselves for. This also makes device_new_from_stat_rdev() public, as it is truly useful, as we can see in our own uses of it, and I think is fairly generic to show up in the public APIs.
Diffstat (limited to 'src/udev/udev-event.c')
-rw-r--r--src/udev/udev-event.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 8aeaf92e41..78a999d00a 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -831,7 +831,7 @@ static int rename_netif(UdevEvent *event) {
if (streq(event->name, oldname))
return 0; /* The interface name is already requested name. */
- if (!device_for_action(dev, DEVICE_ACTION_ADD))
+ if (!device_for_action(dev, SD_DEVICE_ADD))
return 0; /* Rename the interface only when it is added. */
r = sd_device_get_ifindex(dev, &ifindex);
@@ -904,7 +904,7 @@ static int update_devnode(UdevEvent *event) {
/* If group is set, but mode is not set, "upgrade" mode for the group. */
event->mode = 0660;
- bool apply_mac = device_for_action(dev, DEVICE_ACTION_ADD);
+ bool apply_mac = device_for_action(dev, SD_DEVICE_ADD);
return udev_node_add(dev, apply_mac, event->mode, event->uid, event->gid, event->seclabel_list);
}
@@ -975,7 +975,7 @@ int udev_event_execute_rules(UdevEvent *event,
Hashmap *properties_list,
UdevRules *rules) {
const char *subsystem;
- DeviceAction action;
+ sd_device_action_t action;
sd_device *dev;
int r;
@@ -988,11 +988,11 @@ int udev_event_execute_rules(UdevEvent *event,
if (r < 0)
return log_device_error_errno(dev, r, "Failed to get subsystem: %m");
- r = device_get_action(dev, &action);
+ r = sd_device_get_action(dev, &action);
if (r < 0)
return log_device_error_errno(dev, r, "Failed to get ACTION: %m");
- if (action == DEVICE_ACTION_REMOVE) {
+ if (action == SD_DEVICE_REMOVE) {
event_execute_rules_on_remove(event, timeout_usec, timeout_signal, properties_list, rules);
return 0;
}
@@ -1009,7 +1009,7 @@ int udev_event_execute_rules(UdevEvent *event,
/* Disable watch during event processing. */
(void) udev_watch_end(event->dev_db_clone);
- if (action == DEVICE_ACTION_MOVE) {
+ if (action == SD_DEVICE_MOVE) {
r = udev_event_on_move(event->dev);
if (r < 0)
return r;