summaryrefslogtreecommitdiffstats
path: root/src/core/device.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-03-09 02:28:11 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-03-11 19:49:53 +0100
commita7395c867e8fb1b033a5417735341e7116874b74 (patch)
treee8e0c9f16415949c5917948a1f95d28ac4ab054c /src/core/device.c
parentudevadm-test: check action string earlier (diff)
downloadsystemd-a7395c867e8fb1b033a5417735341e7116874b74.tar.xz
systemd-a7395c867e8fb1b033a5417735341e7116874b74.zip
core/device: use device_get_action()
Diffstat (limited to 'src/core/device.c')
-rw-r--r--src/core/device.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/core/device.c b/src/core/device.c
index a979caf21c..506bf74478 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -893,7 +893,8 @@ static void device_propagate_reload_by_sysfs(Manager *m, const char *sysfs) {
static int device_dispatch_io(sd_device_monitor *monitor, sd_device *dev, void *userdata) {
Manager *m = userdata;
- const char *action, *sysfs;
+ DeviceAction action;
+ const char *sysfs;
int r;
assert(m);
@@ -905,19 +906,19 @@ static int device_dispatch_io(sd_device_monitor *monitor, sd_device *dev, void *
return 0;
}
- r = sd_device_get_property_value(dev, "ACTION", &action);
+ r = device_get_action(dev, &action);
if (r < 0) {
- log_device_error_errno(dev, r, "Failed to get udev action string: %m");
+ log_device_error_errno(dev, r, "Failed to get udev action: %m");
return 0;
}
- if (streq(action, "change"))
+ if (action == DEVICE_ACTION_CHANGE)
device_propagate_reload_by_sysfs(m, sysfs);
/* A change event can signal that a device is becoming ready, in particular if
* the device is using the SYSTEMD_READY logic in udev
* so we need to reach the else block of the follwing if, even for change events */
- if (streq(action, "remove")) {
+ if (action == DEVICE_ACTION_REMOVE) {
r = swap_process_device_remove(m, dev);
if (r < 0)
log_device_warning_errno(dev, r, "Failed to process swap device remove event, ignoring: %m");