summaryrefslogtreecommitdiff
path: root/src/core/slice.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-06-05 18:26:45 +0200
committerLennart Poettering <lennart@poettering.net>2018-06-07 15:29:17 +0200
commit04eb582acc203eab0bc5c2cc5e13986f16e09df0 (patch)
tree8dc0978b7a02e28b9433b0d8af7a2381642798cc /src/core/slice.c
parent244f80554940a6a08b6aafea033b5547eae74db4 (diff)
downloadsystemd-04eb582acc203eab0bc5c2cc5e13986f16e09df0.tar.gz
core: enumerate perpetual units in a separate per-unit-type method
Previously the enumerate() callback defined for each unit type would do two things: 1. It would create perpetual units (i.e. -.slice, system.slice, -.mount and init.scope) 2. It would enumerate units from /proc/self/mountinfo, /proc/swaps and the udev database With this change these two parts are split into two seperate methods: enumerate() now only does #2, while enumerate_perpetual() is responsible for #1. Why make this change? Well, perpetual units should have a slightly different effect that those found through enumeration: as perpetual units should be up unconditionally, perpetually and thus never change state, they should also not pull in deps by their state changing, not even when the state is first set to active. Thus, their state is generally initialized through the per-device coldplug() method in similar fashion to the deserialized state from a previous run would be put into place. OTOH units found through regular enumeration should result in state changes (and thus pull in deps due to state changes), hence their state should be put in effect in the catchup() method instead. Hence, given this difference, let's also separate the functions, so that the rule is: 1. What is created in enumerate_perpetual() should be started in coldplug() 2. What is created in enumerate() should be started in catchup().
Diffstat (limited to 'src/core/slice.c')
-rw-r--r--src/core/slice.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/slice.c b/src/core/slice.c
index 71614e4b89..e8a7c9a585 100644
--- a/src/core/slice.c
+++ b/src/core/slice.c
@@ -326,7 +326,7 @@ static int slice_make_perpetual(Manager *m, const char *name, Unit **ret) {
return 0;
}
-static void slice_enumerate(Manager *m) {
+static void slice_enumerate_perpetual(Manager *m) {
Unit *u;
int r;
@@ -383,7 +383,7 @@ const UnitVTable slice_vtable = {
.bus_set_property = bus_slice_set_property,
.bus_commit_properties = bus_slice_commit_properties,
- .enumerate = slice_enumerate,
+ .enumerate_perpetual = slice_enumerate_perpetual,
.status_message_formats = {
.finished_start_job = {