summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-02-02 12:46:29 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-02-02 20:34:38 +0900
commit4900ae14a5a09bc31f084e4f59131743aa04aae2 (patch)
tree184dfa99e61dab268eea02a0083e3b5cd3338a22
parent043543f1bbbd7fd7a7a7acfec1c45c74e6031f34 (diff)
downloadsystemd-4900ae14a5a09bc31f084e4f59131743aa04aae2.tar.gz
sd-device: drop device_new_from_synthetic_event() from libsystemd
It is used by only test-udev.c.
-rw-r--r--src/libsystemd/sd-device/device-private.c25
-rw-r--r--src/libsystemd/sd-device/device-private.h1
-rw-r--r--src/test/test-udev.c29
3 files changed, 29 insertions, 26 deletions
diff --git a/src/libsystemd/sd-device/device-private.c b/src/libsystemd/sd-device/device-private.c
index 23f9ce97de..8eb7198808 100644
--- a/src/libsystemd/sd-device/device-private.c
+++ b/src/libsystemd/sd-device/device-private.c
@@ -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;
diff --git a/src/libsystemd/sd-device/device-private.h b/src/libsystemd/sd-device/device-private.h
index 11f019f88a..ec37807621 100644
--- a/src/libsystemd/sd-device/device-private.h
+++ b/src/libsystemd/sd-device/device-private.h
@@ -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);
diff --git a/src/test/test-udev.c b/src/test/test-udev.c
index c0e779a813..3ca132db3b 100644
--- a/src/test/test-udev.c
+++ b/src/test/test-udev.c
@@ -25,6 +25,35 @@
#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;