unit: rework trigger dependency logic
Instead of having explicit type-specific callbacks that inform the triggering unit when a triggered unit changes state, make this generic so that state changes are forwarded betwee any triggered and triggering unit. Also, get rid of UnitRef references from automount, timer, path units, to the units they trigger and rely exclsuively on UNIT_TRIGGER type dendencies.
This commit is contained in:
@@ -152,15 +152,15 @@ static int bus_timer_append_calendar_timers(DBusMessageIter *i, const char *prop
|
||||
}
|
||||
|
||||
static int bus_timer_append_unit(DBusMessageIter *i, const char *property, void *data) {
|
||||
Unit *u = data;
|
||||
Timer *timer = TIMER(u);
|
||||
Unit *u = data, *trigger;
|
||||
const char *t;
|
||||
|
||||
assert(i);
|
||||
assert(property);
|
||||
assert(u);
|
||||
|
||||
t = UNIT_DEREF(timer->unit) ? UNIT_DEREF(timer->unit)->id : "";
|
||||
trigger = UNIT_TRIGGER(u);
|
||||
t = trigger ? trigger->id : "";
|
||||
|
||||
return dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, &t) ? 0 : -ENOMEM;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user