diff options
author | Mike Yuan <me@yhndnzj.com> | 2024-04-16 08:39:36 +0200 |
---|---|---|
committer | Mike Yuan <me@yhndnzj.com> | 2024-04-19 04:08:36 +0200 |
commit | 4b8fdb4681cb8ee650abc5cadf189da7d0b4fa2c (patch) | |
tree | b65eaadd4be7942108734b57ee62469ff51513c2 /src/shared | |
parent | systemctl-start-unit: Subscribe() is unnecessary if we RefUnit explicitly (diff) | |
download | systemd-4b8fdb4681cb8ee650abc5cadf189da7d0b4fa2c.tar.xz systemd-4b8fdb4681cb8ee650abc5cadf189da7d0b4fa2c.zip |
bus-wait-for-units: drop ready_callback
This is never used, and given that bus_wait_for_units_run
returns BusWaitForUnits.state it's not really useful.
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/bus-wait-for-units.c | 19 | ||||
-rw-r--r-- | src/shared/bus-wait-for-units.h | 2 |
2 files changed, 1 insertions, 20 deletions
diff --git a/src/shared/bus-wait-for-units.c b/src/shared/bus-wait-for-units.c index 49963ffe34..e84b5386ba 100644 --- a/src/shared/bus-wait-for-units.c +++ b/src/shared/bus-wait-for-units.c @@ -32,9 +32,6 @@ typedef struct BusWaitForUnits { Hashmap *items; - bus_wait_for_units_ready_callback ready_callback; - void *userdata; - WaitForItem *current; BusWaitForUnitsState state; @@ -112,11 +109,7 @@ static int match_disconnected(sd_bus_message *m, void *userdata, sd_bus_error *e log_warning("D-Bus connection terminated while waiting for unit."); bus_wait_for_units_clear(d); - - if (d->ready_callback) - d->ready_callback(d, BUS_WAIT_FAILURE, d->userdata); - else /* If no ready callback is specified close the connection so that the event loop exits */ - sd_bus_close(sd_bus_message_get_bus(m)); + sd_bus_close(sd_bus_message_get_bus(m)); return 0; } @@ -172,13 +165,6 @@ static bool bus_wait_for_units_is_ready(BusWaitForUnits *d) { return hashmap_isempty(d->items); } -void bus_wait_for_units_set_ready_callback(BusWaitForUnits *d, bus_wait_for_units_ready_callback callback, void *userdata) { - assert(d); - - d->ready_callback = callback; - d->userdata = userdata; -} - static void bus_wait_for_units_check_ready(BusWaitForUnits *d) { assert(d); @@ -186,9 +172,6 @@ static void bus_wait_for_units_check_ready(BusWaitForUnits *d) { return; d->state = d->has_failed ? BUS_WAIT_FAILURE : BUS_WAIT_SUCCESS; - - if (d->ready_callback) - d->ready_callback(d, d->state, d->userdata); } static void wait_for_item_check_ready(WaitForItem *item) { diff --git a/src/shared/bus-wait-for-units.h b/src/shared/bus-wait-for-units.h index c87eabcbbc..d2a2756dc7 100644 --- a/src/shared/bus-wait-for-units.h +++ b/src/shared/bus-wait-for-units.h @@ -21,7 +21,6 @@ typedef enum BusWaitForUnitsFlags { BUS_WAIT_REFFED = 1 << 3, /* The unit is already reffed with RefUnit() */ } BusWaitForUnitsFlags; -typedef void (*bus_wait_for_units_ready_callback)(BusWaitForUnits *d, BusWaitForUnitsState state, void *userdata); typedef void (*bus_wait_for_units_unit_callback)(BusWaitForUnits *d, const char *unit_path, bool good, void *userdata); int bus_wait_for_units_new(sd_bus *bus, BusWaitForUnits **ret); @@ -30,6 +29,5 @@ BusWaitForUnits* bus_wait_for_units_free(BusWaitForUnits *d); DEFINE_TRIVIAL_CLEANUP_FUNC(BusWaitForUnits*, bus_wait_for_units_free); BusWaitForUnitsState bus_wait_for_units_state(BusWaitForUnits *d); -void bus_wait_for_units_set_ready_callback(BusWaitForUnits *d, bus_wait_for_units_ready_callback callback, void *userdata); int bus_wait_for_units_add_unit(BusWaitForUnits *d, const char *unit, BusWaitForUnitsFlags flags, bus_wait_for_units_unit_callback callback, void *userdata); int bus_wait_for_units_run(BusWaitForUnits *d); |