]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev-util: introduce device_is_processing() helper function
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 2 Jan 2024 19:34:54 +0000 (04:34 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 11 Feb 2024 16:14:48 +0000 (01:14 +0900)
src/shared/udev-util.c
src/shared/udev-util.h

index 922364b0012ce87ef3954cd6c1265b6b566be266..9acdaeff521e0615d9cf49f99ad6f69198e82218 100644 (file)
@@ -239,6 +239,18 @@ int device_is_renaming(sd_device *dev) {
         return r;
 }
 
+int device_is_processing(sd_device *dev) {
+        int r;
+
+        assert(dev);
+
+        r = device_get_property_bool(dev, "ID_PROCESSING");
+        if (r == -ENOENT)
+                return false; /* defaults to false */
+
+        return r;
+}
+
 bool device_for_action(sd_device *dev, sd_device_action_t a) {
         sd_device_action_t b;
 
index 4d27bed1d948f26ca0de104a6a2bb7546b6f027c..13710a3ec1f51e9ab8bac768ef49907c2d544c67 100644 (file)
@@ -13,6 +13,7 @@ int udev_parse_config(void);
 int device_wait_for_initialization(sd_device *device, const char *subsystem, usec_t timeout_usec, sd_device **ret);
 int device_wait_for_devlink(const char *path, const char *subsystem, usec_t timeout_usec, sd_device **ret);
 int device_is_renaming(sd_device *dev);
+int device_is_processing(sd_device *dev);
 
 bool device_for_action(sd_device *dev, sd_device_action_t action);