diff options
author | Mike Yuan <me@yhndnzj.com> | 2024-04-17 21:31:29 +0200 |
---|---|---|
committer | Mike Yuan <me@yhndnzj.com> | 2024-04-19 04:08:37 +0200 |
commit | 61cd6c4db764b5b6d94946120c1d9414b793b086 (patch) | |
tree | 869405b71486f8f27b8460dfda2922323ceac744 /src/shared | |
parent | bus-wait-for-units: drop 'current' field (diff) | |
download | systemd-61cd6c4db764b5b6d94946120c1d9414b793b086.tar.xz systemd-61cd6c4db764b5b6d94946120c1d9414b793b086.zip |
bus-wait-for-units: simplify property_map_job_id
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/bus-wait-for-units.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/shared/bus-wait-for-units.c b/src/shared/bus-wait-for-units.c index 7d919d3cd5..6ccf822064 100644 --- a/src/shared/bus-wait-for-units.c +++ b/src/shared/bus-wait-for-units.c @@ -197,32 +197,26 @@ static void wait_for_item_check_ready(WaitForItem *item) { bus_wait_for_units_check_ready(d); } -static int property_map_job( +static int property_map_job_id( sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata) { - WaitForItem *item = ASSERT_PTR(userdata); - const char *path; - uint32_t id; - int r; + uint32_t *job_id = ASSERT_PTR(userdata); - r = sd_bus_message_read(m, "(uo)", &id, &path); - if (r < 0) - return r; + assert(m); - item->job_id = id; - return 0; + 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, 0 }, - { "CleanResult", "s", NULL, offsetof(WaitForItem, clean_result) }, + { "ActiveState", "s", NULL, offsetof(WaitForItem, active_state) }, + { "Job", "(uo)", property_map_job_id, offsetof(WaitForItem, job_id) }, + { "CleanResult", "s", NULL, offsetof(WaitForItem, clean_result) }, {} }; |