mirror of
https://github.com/systemd/systemd.git
synced 2026-08-03 14:40:31 +00:00
sd-device: drop device_new_from_synthetic_event() from libsystemd
It is used by only test-udev.c.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user