]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-device: drop device_new_from_synthetic_event() from libsystemd 22358/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 2 Feb 2022 03:46:29 +0000 (12:46 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 2 Feb 2022 11:34:38 +0000 (20:34 +0900)
It is used by only test-udev.c.

src/libsystemd/sd-device/device-private.c
src/libsystemd/sd-device/device-private.h
src/test/test-udev.c

index 23f9ce97de94fa4d064a5873239c00d38610664e..8eb7198808c443e00960fa799f633214f3df8f6a 100644 (file)
@@ -858,31 +858,6 @@ int device_clone_with_db(sd_device *old_device, sd_device **new_device) {
         return 0;
 }
 
-int device_new_from_synthetic_event(sd_device **new_device, const char *syspath, const char *action) {
-        _cleanup_(sd_device_unrefp) sd_device *ret = NULL;
-        int r;
-
-        assert(new_device);
-        assert(syspath);
-        assert(action);
-
-        r = sd_device_new_from_syspath(&ret, syspath);
-        if (r < 0)
-                return r;
-
-        r = device_read_uevent_file(ret);
-        if (r < 0)
-                return r;
-
-        r = device_set_action_from_string(ret, action);
-        if (r < 0)
-                return r;
-
-        *new_device = TAKE_PTR(ret);
-
-        return 0;
-}
-
 int device_copy_properties(sd_device *device_dst, sd_device *device_src) {
         const char *property, *value;
         int r;
index 11f019f88a32a81a7d58f6575e60f2cac82cb304..ec378076217e6ce21528025fc7167e95290f824c 100644 (file)
@@ -53,7 +53,6 @@ int device_rename(sd_device *device, const char *name);
 int device_shallow_clone(sd_device *old_device, sd_device **new_device);
 int device_clone_with_db(sd_device *old_device, sd_device **new_device);
 int device_copy_properties(sd_device *device_dst, sd_device *device_src);
-int device_new_from_synthetic_event(sd_device **new_device, const char *syspath, const char *action);
 
 int device_tag_index(sd_device *dev, sd_device *dev_old, bool add);
 int device_update_db(sd_device *device);
index c0e779a813b6e8f81cbcc5a3837ddfc2e0854798..3ca132db3bce451e5245d279ec9b733e0090f7c5 100644 (file)
 #include "udev-event.h"
 #include "version.h"
 
+static int device_new_from_synthetic_event(sd_device **ret, const char *syspath, const char *action) {
+        _cleanup_(sd_device_unrefp) sd_device *dev = NULL;
+        sd_device_action_t a;
+        int r;
+
+        assert(ret);
+        assert(syspath);
+        assert(action);
+
+        a = device_action_from_string(action);
+        if (a < 0)
+                return a;
+
+        r = sd_device_new_from_syspath(&dev, syspath);
+        if (r < 0)
+                return r;
+
+        r = device_read_uevent_file(dev);
+        if (r < 0)
+                return r;
+
+        r = device_set_action(dev, a);
+        if (r < 0)
+                return r;
+
+        *ret = TAKE_PTR(dev);
+        return 0;
+}
+
 static int fake_filesystems(void) {
         static const struct fakefs {
                 const char *src;