summaryrefslogtreecommitdiff
path: root/src/swap.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-11-14 23:47:53 +0100
committerLennart Poettering <lennart@poettering.net>2010-11-14 23:48:21 +0100
commit6210e7fc31e14159627144f7409eadd3ce0d72b9 (patch)
treeb4510ab2477bdb0fa1df3dbefa91f1b01846c451 /src/swap.c
parent9381a72403f622f66294ab10315240a4c4fd71cd (diff)
manager: always pull 'following' units into transaction
Diffstat (limited to 'src/swap.c')
-rw-r--r--src/swap.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/swap.c b/src/swap.c
index ddda9e1a31..6de79280c9 100644
--- a/src/swap.c
+++ b/src/swap.c
@@ -1162,6 +1162,39 @@ static Unit *swap_following(Unit *u) {
return UNIT(first);
}
+static int swap_following_set(Unit *u, Set **_set) {
+ Swap *s = SWAP(u);
+ Swap *other;
+ Set *set;
+ int r;
+
+ assert(s);
+ assert(_set);
+
+ if (LIST_JUST_US(same_proc_swaps, s)) {
+ *_set = NULL;
+ return 0;
+ }
+
+ if (!(set = set_new(NULL, NULL)))
+ return -ENOMEM;
+
+ LIST_FOREACH_AFTER(same_proc_swaps, other, s)
+ if ((r = set_put(set, other)) < 0)
+ goto fail;
+
+ LIST_FOREACH_BEFORE(same_proc_swaps, other, s)
+ if ((r = set_put(set, other)) < 0)
+ goto fail;
+
+ *_set = set;
+ return 1;
+
+fail:
+ set_free(set);
+ return r;
+}
+
static void swap_shutdown(Manager *m) {
assert(m);
@@ -1319,6 +1352,7 @@ const UnitVTable swap_vtable = {
.bus_invalidating_properties = bus_swap_invalidating_properties,
.following = swap_following,
+ .following_set = swap_following_set,
.enumerate = swap_enumerate,
.shutdown = swap_shutdown