diff options
author | Lennart Poettering <lennart@poettering.net> | 2021-02-10 22:15:01 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2021-02-18 18:20:56 +0100 |
commit | a11300221482da7ffe7be2d75d508ddd411814f6 (patch) | |
tree | 009163435be6a2878d026e70439d731a1587a6e9 /src/core/swap.c | |
parent | sd-device: don't compare pointers with numeric zero (diff) | |
download | systemd-a11300221482da7ffe7be2d75d508ddd411814f6.tar.xz systemd-a11300221482da7ffe7be2d75d508ddd411814f6.zip |
sd-device: add sd_device_get_action() + sd_device_get_seqnum() + sd_device_new_from_stat_rdev()
To make sd-device properly usable for all programs we need to provide an
API for the "action" field of an event, it's one of the most relevant
ones, and it was so far missing.
This also adds sd_device_get_seqnum(), which isn't that interesting,
except for generating pretty debug output, which we use it ourselves
for.
This also makes device_new_from_stat_rdev() public, as it is truly
useful, as we can see in our own uses of it, and I think is fairly
generic to show up in the public APIs.
Diffstat (limited to 'src/core/swap.c')
-rw-r--r-- | src/core/swap.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/core/swap.c b/src/core/swap.c index 5746940fa8..a81b1928b8 100644 --- a/src/core/swap.c +++ b/src/core/swap.c @@ -10,7 +10,6 @@ #include "alloc-util.h" #include "dbus-swap.h" #include "dbus-unit.h" -#include "device-private.h" #include "device-util.h" #include "device.h" #include "escape.h" @@ -307,7 +306,7 @@ static int swap_load_devnode(Swap *s) { if (stat(s->what, &st) < 0 || !S_ISBLK(st.st_mode)) return 0; - r = device_new_from_stat_rdev(&d, &st); + r = sd_device_new_from_stat_rdev(&d, &st); if (r < 0) { log_unit_full_errno(UNIT(s), r == -ENOENT ? LOG_DEBUG : LOG_WARNING, r, "Failed to allocate device for swap %s: %m", s->what); @@ -510,7 +509,7 @@ static int swap_process_new(Manager *m, const char *device, int prio, bool set_f if (stat(device, &st) < 0 || !S_ISBLK(st.st_mode)) return 0; - r = device_new_from_stat_rdev(&d, &st); + r = sd_device_new_from_stat_rdev(&d, &st); if (r < 0) { log_full_errno(r == -ENOENT ? LOG_DEBUG : LOG_WARNING, r, "Failed to allocate device for swap %s: %m", device); |