manager: move various fields that declare unit defaults into a new structure UnitDefaults

This adds a new structure UnitDefaults which embedds the various default
settings for units we maintain. We so far maintained two sets of
variables for this, one in main.c as static variables and one in the
Manager structure. This moves them into a common structure.

This is most just search/replace, i.e. very dumb refactoring.

The fact that we now use a common structure for this allows us further
refactorings later.

Inspired by the discussions on #27890
This commit is contained in:
Lennart Poettering
2023-09-08 14:19:45 +02:00
parent b8f18c3089
commit c9e120e06f
16 changed files with 309 additions and 306 deletions
+6 -6
View File
@@ -53,12 +53,12 @@ TEST_RET(cgroup_mask, .sd_booted = true) {
/* Turn off all kinds of default accounting, so that we can
* verify the masks resulting of our configuration and nothing
* else. */
m->default_cpu_accounting =
m->default_memory_accounting =
m->default_blockio_accounting =
m->default_io_accounting =
m->default_tasks_accounting = false;
m->default_tasks_max = TASKS_MAX_UNSET;
m->defaults.cpu_accounting =
m->defaults.memory_accounting =
m->defaults.blockio_accounting =
m->defaults.io_accounting =
m->defaults.tasks_accounting = false;
m->defaults.tasks_max = TASKS_MAX_UNSET;
assert_se(manager_startup(m, NULL, NULL, NULL) >= 0);
+1 -1
View File
@@ -1259,7 +1259,7 @@ static void run_tests(RuntimeScope scope, char **patterns) {
return (void) log_tests_skipped_errno(r, "manager_new");
assert_se(r >= 0);
m->default_std_output = EXEC_OUTPUT_NULL; /* don't rely on host journald */
m->defaults.std_output = EXEC_OUTPUT_NULL; /* don't rely on host journald */
assert_se(manager_startup(m, NULL, NULL, NULL) >= 0);
/* Uncomment below if you want to make debugging logs stored to journal. */