chiark / gitweb /
core/swap.c: Do not add Before=swap.target to swap units.
authorThomas Bächler <thomas@archlinux.org>
Fri, 5 Oct 2012 23:11:53 +0000 (01:11 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 16 Oct 2012 00:20:55 +0000 (02:20 +0200)
The fstab generator adds Before=swap.target by default, and when creating
a custom .swap unit, you can also add Before=swap.target to the unit.

However, it is impossible to not have this ordering dependency right now.
Virtually all existing setups likely use the fstab generator, so this
change is unlikely to break anything.

src/core/swap.c

index b4f53b724862ceae6a2caf57242b9c63dff43035..c708b7fefa3dac8e5f65dc8e46b848077b90a1f2 100644 (file)
@@ -165,22 +165,6 @@ static int swap_add_mount_links(Swap *s) {
         return 0;
 }
 
         return 0;
 }
 
-static int swap_add_target_links(Swap *s) {
-        Unit *tu;
-        int r;
-
-        assert(s);
-
-        if (!s->from_fragment)
-                return 0;
-
-        r = manager_load_unit(UNIT(s)->manager, SPECIAL_SWAP_TARGET, NULL, NULL, &tu);
-        if (r < 0)
-                return r;
-
-        return unit_add_dependency(UNIT(s), UNIT_BEFORE, tu, true);
-}
-
 static int swap_add_device_links(Swap *s) {
         SwapParameters *p;
 
 static int swap_add_device_links(Swap *s) {
         SwapParameters *p;
 
@@ -291,9 +275,6 @@ static int swap_load(Unit *u) {
                 if ((r = swap_add_mount_links(s)) < 0)
                         return r;
 
                 if ((r = swap_add_mount_links(s)) < 0)
                         return r;
 
-                if ((r = swap_add_target_links(s)) < 0)
-                        return r;
-
                 if ((r = unit_add_default_cgroups(u)) < 0)
                         return r;
 
                 if ((r = unit_add_default_cgroups(u)) < 0)
                         return r;