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().
This commit is contained in:
+2
-2
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user