diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-04-10 17:53:17 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-04-10 18:00:34 +0200 |
commit | e537352b9bfffe6f6286483bff2c7601c78407e3 (patch) | |
tree | be1a46883f8a1bc6b666bd680adda2d309979c15 /target.c | |
parent | 108736d0d34d7b74a61a6ac7b99d4d4fec81ce09 (diff) |
mount: implement mounting properly
This also includes code that writes utmp/wtmp records when applicable,
making use the mount infrastructure to detct when those files are
accessible.
Finally, this also introduces a --dump-configuration-items switch.
Diffstat (limited to 'target.c')
-rw-r--r-- | target.c | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -37,6 +37,15 @@ static const char* const state_string_table[_TARGET_STATE_MAX] = { [TARGET_ACTIVE] = "active" }; +static void target_init(Unit *u) { + Target *t = TARGET(u); + + assert(t); + assert(u->meta.load_state == UNIT_STUB); + + t->state = 0; +} + static void target_dump(Unit *u, FILE *f, const char *prefix) { Target *t = TARGET(u); @@ -52,13 +61,11 @@ static void target_set_state(Target *t, TargetState state) { TargetState old_state; assert(t); - if (state == t->state) - return; - old_state = t->state; t->state = state; - log_debug("%s changed %s → %s", unit_id(UNIT(t)), state_string_table[old_state], state_string_table[state]); + if (state != old_state) + log_debug("%s changed %s → %s", unit_id(UNIT(t)), state_string_table[old_state], state_string_table[state]); unit_notify(UNIT(t), state_translation_table[old_state], state_translation_table[state]); } @@ -121,7 +128,8 @@ int target_get_runlevel(Target *t) { const UnitVTable target_vtable = { .suffix = ".target", - .init = unit_load_fragment_and_dropin, + .init = target_init, + .load = unit_load_fragment_and_dropin, .dump = target_dump, |