diff options
author | Mike Yuan <me@yhndnzj.com> | 2024-09-26 17:29:30 +0200 |
---|---|---|
committer | Mike Yuan <me@yhndnzj.com> | 2024-09-26 17:59:00 +0200 |
commit | cdf684fc00cb44a693ee077c19f89aa09b54de61 (patch) | |
tree | f8f286460f426dabe815216b2cb6a350c72cc91a /src | |
parent | mkosi: update arch commit reference (diff) | |
download | systemd-cdf684fc00cb44a693ee077c19f89aa09b54de61.tar.xz systemd-cdf684fc00cb44a693ee077c19f89aa09b54de61.zip |
shared/bus-map-properties: move bus_map_job_id() from wait-for-units
Diffstat (limited to 'src')
-rw-r--r-- | src/shared/bus-map-properties.c | 12 | ||||
-rw-r--r-- | src/shared/bus-map-properties.h | 1 | ||||
-rw-r--r-- | src/shared/bus-wait-for-units.c | 16 |
3 files changed, 14 insertions, 15 deletions
diff --git a/src/shared/bus-map-properties.c b/src/shared/bus-map-properties.c index aa17ded5a3..a6cd752894 100644 --- a/src/shared/bus-map-properties.c +++ b/src/shared/bus-map-properties.c @@ -10,6 +10,8 @@ int bus_map_id128(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_err sd_id128_t *p = userdata; int r; + assert(m); + r = bus_message_read_id128(m, p); if (r < 0) return bus_log_parse_error_debug(r); @@ -21,6 +23,8 @@ int bus_map_strv_sort(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus char ***p = ASSERT_PTR(userdata); int r; + assert(m); + r = sd_bus_message_read_strv_extend(m, p); if (r < 0) return bus_log_parse_error_debug(r); @@ -29,6 +33,14 @@ int bus_map_strv_sort(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus return 0; } +int bus_map_job_id(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata) { + uint32_t *p = ASSERT_PTR(userdata); + + assert(m); + + return sd_bus_message_read(m, "(uo)", p, /* path = */ NULL); +} + static int map_basic(sd_bus_message *m, unsigned flags, void *userdata) { char type; int r; diff --git a/src/shared/bus-map-properties.h b/src/shared/bus-map-properties.h index e9f4a92ff2..183e9722f1 100644 --- a/src/shared/bus-map-properties.h +++ b/src/shared/bus-map-properties.h @@ -19,6 +19,7 @@ enum { int bus_map_id128(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata); int bus_map_strv_sort(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata); +int bus_map_job_id(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata); int bus_message_map_all_properties(sd_bus_message *m, const struct bus_properties_map *map, unsigned flags, sd_bus_error *error, void *userdata); int bus_map_all_properties(sd_bus *bus, const char *destination, const char *path, const struct bus_properties_map *map, diff --git a/src/shared/bus-wait-for-units.c b/src/shared/bus-wait-for-units.c index f16fe51e6e..20bb7d0405 100644 --- a/src/shared/bus-wait-for-units.c +++ b/src/shared/bus-wait-for-units.c @@ -202,25 +202,11 @@ static void wait_for_item_check_ready(WaitForItem *item) { bus_wait_for_units_check_ready(d); } -static int property_map_job_id( - sd_bus *bus, - const char *member, - sd_bus_message *m, - sd_bus_error *error, - void *userdata) { - - uint32_t *job_id = ASSERT_PTR(userdata); - - assert(m); - - return sd_bus_message_read(m, "(uo)", job_id, /* path = */ NULL); -} - static int wait_for_item_parse_properties(WaitForItem *item, sd_bus_message *m) { static const struct bus_properties_map map[] = { { "ActiveState", "s", NULL, offsetof(WaitForItem, active_state) }, - { "Job", "(uo)", property_map_job_id, offsetof(WaitForItem, job_id) }, + { "Job", "(uo)", bus_map_job_id, offsetof(WaitForItem, job_id) }, { "CleanResult", "s", NULL, offsetof(WaitForItem, clean_result) }, { "LiveMountResult", "s", NULL, offsetof(WaitForItem, live_mount_result) }, {} |