]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
util: introduce device_for_action()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 9 Mar 2019 01:45:15 +0000 (10:45 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 11 Mar 2019 18:49:53 +0000 (03:49 +0900)
It will be used in later commits.

src/shared/udev-util.c
src/shared/udev-util.h

index 6847d715f6660f58504489865b692f5357ab0922..19d823c11d3e1f3ded4442cbf63c603498ea0674 100644 (file)
@@ -181,3 +181,14 @@ int device_is_renaming(sd_device *dev) {
 
         return r >= 0;
 }
+
+bool device_for_action(sd_device *dev, DeviceAction action) {
+        DeviceAction a;
+
+        assert(dev);
+
+        if (device_get_action(dev, &a) < 0)
+                return false;
+
+        return a == action;
+}
index c45d6a11fd7838ad80e15a3b0a4e2bdb95973c5a..3c45447515651df15077dd53f7dcf085721a68b3 100644 (file)
@@ -3,6 +3,7 @@
 
 #include "sd-device.h"
 
+#include "device-private.h"
 #include "time-util.h"
 
 typedef enum ResolveNameTiming {
@@ -28,3 +29,4 @@ static inline int udev_parse_config(void) {
 
 int device_wait_for_initialization(sd_device *device, const char *subsystem, sd_device **ret);
 int device_is_renaming(sd_device *dev);
+bool device_for_action(sd_device *dev, DeviceAction action);