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:
Lennart Poettering
2013-04-23 16:00:32 -03:00
parent a34cb32e54
commit 3ecaa09bcc
14 changed files with 170 additions and 217 deletions
+3 -3
View File
@@ -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;
}