summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-11-01 22:52:39 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-11-07 13:35:03 +0900
commit77ad202c72b991d35f9a943601884be77772b795 (patch)
tree8b8c3499692f9c122387649b5f0c023cb2d54ae5 /src/udev
parentcf28ad46890df60d03a20e83fe8217d486dc45bb (diff)
downloadsystemd-77ad202c72b991d35f9a943601884be77772b795.tar.gz
systemd-77ad202c72b991d35f9a943601884be77772b795.tar.bz2
systemd-77ad202c72b991d35f9a943601884be77772b795.zip
udevadm-test: replace udev_device by sd_device
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udevadm-test.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/udev/udevadm-test.c b/src/udev/udevadm-test.c
index 002c390c4e..cfaaf03db9 100644
--- a/src/udev/udevadm-test.c
+++ b/src/udev/udevadm-test.c
@@ -12,7 +12,10 @@
#include <sys/signalfd.h>
#include <unistd.h>
-#include "libudev-device-internal.h"
+#include "sd-device.h"
+
+#include "device-private.h"
+#include "device-util.h"
#include "string-util.h"
#include "udev-builtin.h"
#include "udev.h"
@@ -89,11 +92,10 @@ static int parse_argv(int argc, char *argv[]) {
int test_main(int argc, char *argv[], void *userdata) {
_cleanup_(udev_rules_unrefp) struct udev_rules *rules = NULL;
- _cleanup_(udev_device_unrefp) struct udev_device *dev = NULL;
_cleanup_(udev_event_freep) struct udev_event *event = NULL;
- struct udev_list_entry *entry;
+ _cleanup_(sd_device_unrefp) sd_device *dev = NULL;
+ const char *cmd, *key, *value;
sigset_t mask, sigmask_orig;
- const char *cmd;
Iterator i;
void *val;
int r;
@@ -120,16 +122,16 @@ int test_main(int argc, char *argv[], void *userdata) {
goto out;
}
- dev = udev_device_new_from_synthetic_event(NULL, arg_syspath, arg_action);
- if (dev == NULL) {
- r = log_error_errno(errno, "Failed to open device '%s': %m", arg_syspath);
+ r = device_new_from_synthetic_event(&dev, arg_syspath, arg_action);
+ if (r < 0) {
+ log_error_errno(r, "Failed to open device '%s': %m", arg_syspath);
goto out;
}
/* don't read info from the db */
- udev_device_set_info_loaded(dev);
+ device_seal(dev);
- event = udev_event_new(dev->device, 0, NULL);
+ event = udev_event_new(dev, 0, NULL);
sigfillset(&mask);
sigprocmask(SIG_SETMASK, &mask, &sigmask_orig);
@@ -139,8 +141,8 @@ int test_main(int argc, char *argv[], void *userdata) {
NULL,
rules);
- udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev))
- printf("%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry));
+ FOREACH_DEVICE_PROPERTY(dev, key, value)
+ printf("%s=%s\n", key, value);
HASHMAP_FOREACH_KEY(val, cmd, event->run_list, i) {
char program[UTIL_PATH_SIZE];