X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fswap.c;h=d093c2e790c2985b24f4f6434919e1bb0313443a;hb=2c966c038dc32ef39baa176371395cde4e541d01;hp=501a1d96c8b70001f997209800b5feca54fb24a5;hpb=a3d4e06dfa234bf2a9398c8e534b705b68aa50a1;p=elogind.git diff --git a/src/swap.c b/src/swap.c index 501a1d96c..d093c2e79 100644 --- a/src/swap.c +++ b/src/swap.c @@ -38,7 +38,7 @@ static const UnitActiveState state_translation_table[_SWAP_STATE_MAX] = { [SWAP_DEAD] = UNIT_INACTIVE, [SWAP_ACTIVE] = UNIT_ACTIVE, - [SWAP_MAINTENANCE] = UNIT_INACTIVE + [SWAP_MAINTENANCE] = UNIT_MAINTENANCE }; static void swap_init(Unit *u) { @@ -77,10 +77,7 @@ int swap_add_one_mount_link(Swap *s, Mount *m) { if (!path_startswith(s->what, m->where)) return 0; - if ((r = unit_add_dependency(UNIT(m), UNIT_BEFORE, UNIT(s), true)) < 0) - return r; - - if ((r = unit_add_dependency(UNIT(s), UNIT_REQUIRES, UNIT(m), true)) < 0) + if ((r = unit_add_two_dependencies(UNIT(s), UNIT_AFTER, UNIT_REQUIRES, UNIT(m), true)) < 0) return r; return 0; @@ -127,7 +124,7 @@ static int swap_verify(Swap *s) { bool b; char *e; - if (UNIT(s)->meta.load_state != UNIT_LOADED) + if (s->meta.load_state != UNIT_LOADED) return 0; if (!(e = unit_name_from_path(s->what, ".swap"))) @@ -137,7 +134,7 @@ static int swap_verify(Swap *s) { free(e); if (!b) { - log_error("%s: Value of \"What\" and unit name do not match, not loading.\n", UNIT(s)->meta.id); + log_error("%s: Value of \"What\" and unit name do not match, not loading.\n", s->meta.id); return -EINVAL; } @@ -320,7 +317,7 @@ static void swap_set_state(Swap *s, SwapState state) { if (state != old_state) log_debug("%s changed %s -> %s", - UNIT(s)->meta.id, + s->meta.id, swap_state_to_string(old_state), swap_state_to_string(state));