803fb7
From 111080b06c79e6bcbe9da4786f9c7229f1fb573e Mon Sep 17 00:00:00 2001
803fb7
From: Jan Synacek <jsynacek@redhat.com>
803fb7
Date: Thu, 20 Oct 2016 14:48:33 +0200
803fb7
Subject: [PATCH] install: introduce UnitFileFlags
803fb7
803fb7
Introduce a new enum to get rid of some boolean arguments of unit_file_*
803fb7
functions. It unifies the code, makes it a bit cleaner and extensible.
803fb7
803fb7
(cherry picked from commit b3796dd8349af4235143889e44522a730c1635c0)
803fb7
Related: #1413041
803fb7
---
de8967
 src/core/dbus-manager.c      | 36 +++++++++++++++------
803fb7
 src/core/main.c              |  2 +-
de8967
 src/shared/install.c         | 61 ++++++++++++++++--------------------
de8967
 src/shared/install.h         | 25 +++++++++------
de8967
 src/systemctl/systemctl.c    | 28 +++++++++++------
de8967
 src/test/test-install-root.c | 58 +++++++++++++++++-----------------
de8967
 src/test/test-install.c      | 38 +++++++++++-----------
803fb7
 7 files changed, 135 insertions(+), 113 deletions(-)
803fb7
803fb7
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
803fb7
index c2067c099..5b40aa20f 100644
803fb7
--- a/src/core/dbus-manager.c
803fb7
+++ b/src/core/dbus-manager.c
803fb7
@@ -41,6 +41,11 @@
803fb7
 #include "dbus-execute.h"
803fb7
 #include "bus-common-errors.h"
803fb7
 
803fb7
+static UnitFileFlags unit_file_bools_to_flags(bool runtime, bool force) {
803fb7
+        return (runtime ? UNIT_FILE_RUNTIME : 0) |
803fb7
+               (force   ? UNIT_FILE_FORCE   : 0);
803fb7
+}
803fb7
+
803fb7
 static int property_get_version(
803fb7
                 sd_bus *bus,
803fb7
                 const char *path,
803fb7
@@ -1647,7 +1652,7 @@ static int method_enable_unit_files_generic(
803fb7
                 sd_bus_message *message,
803fb7
                 Manager *m,
803fb7
                 const char *verb,
803fb7
-                int (*call)(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], bool force, UnitFileChange **changes, unsigned *n_changes),
803fb7
+                int (*call)(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, char *files[], UnitFileChange **changes, unsigned *n_changes),
803fb7
                 bool carries_install_info,
803fb7
                 sd_bus_error *error) {
803fb7
 
803fb7
@@ -1655,6 +1660,7 @@ static int method_enable_unit_files_generic(
803fb7
         UnitFileChange *changes = NULL;
803fb7
         unsigned n_changes = 0;
803fb7
         UnitFileScope scope;
803fb7
+        UnitFileFlags flags;
803fb7
         int runtime, force, r;
803fb7
 
803fb7
         assert(bus);
803fb7
@@ -1676,12 +1682,13 @@ static int method_enable_unit_files_generic(
803fb7
                 return r;
803fb7
 
803fb7
         r = mac_selinux_unit_access_check_strv(l, message, m, verb, error);
803fb7
+        flags = unit_file_bools_to_flags(runtime, force);
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
         scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
803fb7
 
803fb7
-        r = call(scope, runtime, NULL, l, force, &changes, &n_changes);
803fb7
+        r = call(scope, flags, NULL, l, &changes, &n_changes);
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
@@ -1700,8 +1707,8 @@ static int method_link_unit_files(sd_bus *bus, sd_bus_message *message, void *us
803fb7
         return method_enable_unit_files_generic(bus, message, userdata, "enable", unit_file_link, false, error);
803fb7
 }
803fb7
 
803fb7
-static int unit_file_preset_without_mode(UnitFileScope scope, bool runtime, const char *root_dir, char **files, bool force, UnitFileChange **changes, unsigned *n_changes) {
803fb7
-        return unit_file_preset(scope, runtime, root_dir, files, UNIT_FILE_PRESET_FULL, force, changes, n_changes);
803fb7
+static int unit_file_preset_without_mode(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, char **files, UnitFileChange **changes, unsigned *n_changes) {
803fb7
+        return unit_file_preset(scope, flags, root_dir, files, UNIT_FILE_PRESET_FULL, changes, n_changes);
803fb7
 }
803fb7
 
803fb7
 static int method_preset_unit_files(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
803fb7
@@ -1721,6 +1728,7 @@ static int method_preset_unit_files_with_mode(sd_bus *bus, sd_bus_message *messa
803fb7
         UnitFilePresetMode mm;
803fb7
         UnitFileScope scope;
803fb7
         int runtime, force, r;
803fb7
+        UnitFileFlags flags;
803fb7
         const char *mode;
803fb7
 
803fb7
         assert(bus);
803fb7
@@ -1741,6 +1749,8 @@ static int method_preset_unit_files_with_mode(sd_bus *bus, sd_bus_message *messa
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
+        flags = unit_file_bools_to_flags(runtime, force);
803fb7
+
803fb7
         if (isempty(mode))
803fb7
                 mm = UNIT_FILE_PRESET_FULL;
803fb7
         else {
803fb7
@@ -1755,7 +1765,7 @@ static int method_preset_unit_files_with_mode(sd_bus *bus, sd_bus_message *messa
803fb7
 
803fb7
         scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
803fb7
 
803fb7
-        r = unit_file_preset(scope, runtime, NULL, l, mm, force, &changes, &n_changes);
803fb7
+        r = unit_file_preset(scope, flags, NULL, l, mm, &changes, &n_changes);
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
@@ -1767,7 +1777,7 @@ static int method_disable_unit_files_generic(
803fb7
                 sd_bus_message *message,
803fb7
                 Manager *m, const
803fb7
                 char *verb,
803fb7
-                int (*call)(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], UnitFileChange **changes, unsigned *n_changes),
803fb7
+                int (*call)(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, char *files[], UnitFileChange **changes, unsigned *n_changes),
803fb7
                 sd_bus_error *error) {
803fb7
 
803fb7
         _cleanup_strv_free_ char **l = NULL;
803fb7
@@ -1800,7 +1810,7 @@ static int method_disable_unit_files_generic(
803fb7
 
803fb7
         scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
803fb7
 
803fb7
-        r = call(scope, runtime, NULL, l, &changes, &n_changes);
803fb7
+        r = call(scope, runtime ? UNIT_FILE_RUNTIME : 0, NULL, l, &changes, &n_changes);
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
@@ -1843,7 +1853,7 @@ static int method_set_default_target(sd_bus *bus, sd_bus_message *message, void
803fb7
 
803fb7
         scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
803fb7
 
803fb7
-        r = unit_file_set_default(scope, NULL, name, force, &changes, &n_changes);
803fb7
+        r = unit_file_set_default(scope, force ? UNIT_FILE_FORCE : 0, NULL, name, &changes, &n_changes);
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
@@ -1857,6 +1867,7 @@ static int method_preset_all_unit_files(sd_bus *bus, sd_bus_message *message, vo
803fb7
         UnitFilePresetMode mm;
803fb7
         UnitFileScope scope;
803fb7
         const char *mode;
803fb7
+        UnitFileFlags flags;
803fb7
         int force, runtime, r;
803fb7
 
803fb7
         assert(bus);
803fb7
@@ -1877,6 +1888,8 @@ static int method_preset_all_unit_files(sd_bus *bus, sd_bus_message *message, vo
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
+        flags = unit_file_bools_to_flags(runtime, force);
803fb7
+
803fb7
         if (isempty(mode))
803fb7
                 mm = UNIT_FILE_PRESET_FULL;
803fb7
         else {
803fb7
@@ -1887,7 +1900,7 @@ static int method_preset_all_unit_files(sd_bus *bus, sd_bus_message *message, vo
803fb7
 
803fb7
         scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
803fb7
 
803fb7
-        r = unit_file_preset_all(scope, runtime, NULL, mm, force, &changes, &n_changes);
803fb7
+        r = unit_file_preset_all(scope, flags, NULL, mm, &changes, &n_changes);
803fb7
         if (r < 0) {
803fb7
                 unit_file_changes_free(changes, n_changes);
803fb7
                 return r;
803fb7
@@ -1906,6 +1919,7 @@ static int method_add_dependency_unit_files(sd_bus *bus, sd_bus_message *message
803fb7
         char *target;
803fb7
         char *type;
803fb7
         UnitDependency dep;
803fb7
+        UnitFileFlags flags;
803fb7
 
803fb7
         assert(bus);
803fb7
         assert(message);
803fb7
@@ -1925,6 +1939,8 @@ static int method_add_dependency_unit_files(sd_bus *bus, sd_bus_message *message
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
+        flags = unit_file_bools_to_flags(runtime, force);
803fb7
+
803fb7
         dep = unit_dependency_from_string(type);
803fb7
         if (dep < 0)
803fb7
                 return -EINVAL;
803fb7
@@ -1935,7 +1951,7 @@ static int method_add_dependency_unit_files(sd_bus *bus, sd_bus_message *message
803fb7
 
803fb7
         scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
803fb7
 
803fb7
-        r = unit_file_add_dependency(scope, runtime, NULL, l, target, dep, force, &changes, &n_changes);
803fb7
+        r = unit_file_add_dependency(scope, flags, NULL, l, target, dep, &changes, &n_changes);
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
diff --git a/src/core/main.c b/src/core/main.c
803fb7
index 820cbc3e5..a0df1e5ce 100644
803fb7
--- a/src/core/main.c
803fb7
+++ b/src/core/main.c
803fb7
@@ -1658,7 +1658,7 @@ int main(int argc, char *argv[]) {
803fb7
                 bump_rlimit_nofile(&saved_rlimit_nofile);
803fb7
 
803fb7
                 if (empty_etc) {
803fb7
-                        r = unit_file_preset_all(UNIT_FILE_SYSTEM, false, NULL, UNIT_FILE_PRESET_FULL, false, NULL, 0);
803fb7
+                        r = unit_file_preset_all(UNIT_FILE_SYSTEM, 0, NULL, UNIT_FILE_PRESET_FULL, NULL, 0);
803fb7
                         if (r < 0)
803fb7
                                 log_warning_errno(r, "Failed to populate /etc with preset unit settings, ignoring: %m");
803fb7
                         else
803fb7
diff --git a/src/shared/install.c b/src/shared/install.c
803fb7
index 62bdf674c..b3df6b35c 100644
803fb7
--- a/src/shared/install.c
803fb7
+++ b/src/shared/install.c
803fb7
@@ -1549,10 +1549,9 @@ static int install_context_mark_for_removal(
803fb7
 
803fb7
 int unit_file_mask(
803fb7
                 UnitFileScope scope,
803fb7
-                bool runtime,
803fb7
+                UnitFileFlags flags,
803fb7
                 const char *root_dir,
803fb7
                 char **files,
803fb7
-                bool force,
803fb7
                 UnitFileChange **changes,
803fb7
                 unsigned *n_changes) {
803fb7
 
803fb7
@@ -1567,7 +1566,7 @@ int unit_file_mask(
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
-        r = get_config_path(scope, runtime, root_dir, &prefix);
803fb7
+        r = get_config_path(scope, flags & UNIT_FILE_RUNTIME, root_dir, &prefix);
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
@@ -1584,7 +1583,7 @@ int unit_file_mask(
803fb7
                 if (!path)
803fb7
                         return -ENOMEM;
803fb7
 
803fb7
-                q = create_symlink("/dev/null", path, force, changes, n_changes);
803fb7
+                q = create_symlink("/dev/null", path, !!(flags & UNIT_FILE_FORCE), changes, n_changes);
803fb7
                 if (q < 0 && r >= 0)
803fb7
                         r = q;
803fb7
         }
803fb7
@@ -1594,7 +1593,7 @@ int unit_file_mask(
803fb7
 
803fb7
 int unit_file_unmask(
803fb7
                 UnitFileScope scope,
803fb7
-                bool runtime,
803fb7
+                UnitFileFlags flags,
803fb7
                 const char *root_dir,
803fb7
                 char **files,
803fb7
                 UnitFileChange **changes,
803fb7
@@ -1614,7 +1613,7 @@ int unit_file_unmask(
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
-        r = get_config_path(scope, runtime, root_dir, &config_path);
803fb7
+        r = get_config_path(scope, flags & UNIT_FILE_RUNTIME, root_dir, &config_path);
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
@@ -1677,10 +1676,9 @@ int unit_file_unmask(
803fb7
 
803fb7
 int unit_file_link(
803fb7
                 UnitFileScope scope,
803fb7
-                bool runtime,
803fb7
+                UnitFileFlags flags,
803fb7
                 const char *root_dir,
803fb7
                 char **files,
803fb7
-                bool force,
803fb7
                 UnitFileChange **changes,
803fb7
                 unsigned *n_changes) {
803fb7
 
803fb7
@@ -1702,7 +1700,7 @@ int unit_file_link(
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
-        r = get_config_path(scope, runtime, root_dir, &config_path);
803fb7
+        r = get_config_path(scope, flags & UNIT_FILE_RUNTIME, root_dir, &config_path);
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
@@ -1757,7 +1755,7 @@ int unit_file_link(
803fb7
                 if (!path)
803fb7
                         return -ENOMEM;
803fb7
 
803fb7
-                q = create_symlink(*i, path, force, changes, n_changes);
803fb7
+                q = create_symlink(*i, path, !!(flags & UNIT_FILE_FORCE), changes, n_changes);
803fb7
                 if (q < 0 && r >= 0)
803fb7
                         r = q;
803fb7
         }
803fb7
@@ -1767,12 +1765,11 @@ int unit_file_link(
803fb7
 
803fb7
 int unit_file_add_dependency(
803fb7
                 UnitFileScope scope,
803fb7
-                bool runtime,
803fb7
+                UnitFileFlags flags,
803fb7
                 const char *root_dir,
803fb7
                 char **files,
803fb7
                 const char *target,
803fb7
                 UnitDependency dep,
803fb7
-                bool force,
803fb7
                 UnitFileChange **changes,
803fb7
                 unsigned *n_changes) {
803fb7
 
803fb7
@@ -1801,7 +1798,7 @@ int unit_file_add_dependency(
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
-        r = get_config_path(scope, runtime, root_dir, &config_path);
803fb7
+        r = get_config_path(scope, flags & UNIT_FILE_RUNTIME, root_dir, &config_path);
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
@@ -1839,16 +1836,15 @@ int unit_file_add_dependency(
803fb7
                         return -ENOMEM;
803fb7
          }
803fb7
 
803fb7
-        return install_context_apply(scope, &c, &paths, config_path, root_dir, force, SEARCH_FOLLOW_CONFIG_SYMLINKS, changes, n_changes);
803fb7
+        return install_context_apply(scope, &c, &paths, config_path, root_dir, !!(flags & UNIT_FILE_FORCE), SEARCH_FOLLOW_CONFIG_SYMLINKS, changes, n_changes);
803fb7
 }
803fb7
 
803fb7
 
803fb7
 int unit_file_enable(
803fb7
                 UnitFileScope scope,
803fb7
-                bool runtime,
803fb7
+                UnitFileFlags flags,
803fb7
                 const char *root_dir,
803fb7
                 char **files,
803fb7
-                bool force,
803fb7
                 UnitFileChange **changes,
803fb7
                 unsigned *n_changes) {
803fb7
 
803fb7
@@ -1870,7 +1866,7 @@ int unit_file_enable(
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
-        r = get_config_path(scope, runtime, root_dir, &config_path);
803fb7
+        r = get_config_path(scope, flags & UNIT_FILE_RUNTIME, root_dir, &config_path);
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
@@ -1889,12 +1885,12 @@ int unit_file_enable(
803fb7
         useful to determine whether the passed files had any
803fb7
         installation data at all. */
803fb7
 
803fb7
-        return install_context_apply(scope, &c, &paths, config_path, root_dir, force, SEARCH_LOAD, changes, n_changes);
803fb7
+        return install_context_apply(scope, &c, &paths, config_path, root_dir, !!(flags & UNIT_FILE_FORCE), SEARCH_LOAD, changes, n_changes);
803fb7
 }
803fb7
 
803fb7
 int unit_file_disable(
803fb7
                 UnitFileScope scope,
803fb7
-                bool runtime,
803fb7
+                UnitFileFlags flags,
803fb7
                 const char *root_dir,
803fb7
                 char **files,
803fb7
                 UnitFileChange **changes,
803fb7
@@ -1918,7 +1914,7 @@ int unit_file_disable(
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
-        r = get_config_path(scope, runtime, root_dir, &config_path);
803fb7
+        r = get_config_path(scope, flags & UNIT_FILE_RUNTIME, root_dir, &config_path);
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
@@ -1940,10 +1936,9 @@ int unit_file_disable(
803fb7
 
803fb7
 int unit_file_reenable(
803fb7
                 UnitFileScope scope,
803fb7
-                bool runtime,
803fb7
+                UnitFileFlags flags,
803fb7
                 const char *root_dir,
803fb7
                 char **files,
803fb7
-                bool force,
803fb7
                 UnitFileChange **changes,
803fb7
                 unsigned *n_changes) {
803fb7
 
803fb7
@@ -1958,19 +1953,19 @@ int unit_file_reenable(
803fb7
                 n[i] = basename(files[i]);
803fb7
         n[i] = NULL;
803fb7
 
803fb7
-        r = unit_file_disable(scope, runtime, root_dir, n, changes, n_changes);
803fb7
+        r = unit_file_disable(scope, flags, root_dir, n, changes, n_changes);
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
         /* But the enable command with the full name */
803fb7
-        return unit_file_enable(scope, runtime, root_dir, files, force, changes, n_changes);
803fb7
+        return unit_file_enable(scope, flags, root_dir, files, changes, n_changes);
803fb7
 }
803fb7
 
803fb7
 int unit_file_set_default(
803fb7
                 UnitFileScope scope,
803fb7
+                UnitFileFlags flags,
803fb7
                 const char *root_dir,
803fb7
                 const char *name,
803fb7
-                bool force,
803fb7
                 UnitFileChange **changes,
803fb7
                 unsigned *n_changes) {
803fb7
 
803fb7
@@ -2010,7 +2005,7 @@ int unit_file_set_default(
803fb7
 
803fb7
         path = strjoina(config_path, "/" SPECIAL_DEFAULT_TARGET);
803fb7
 
803fb7
-        return create_symlink(i->path, path, force, changes, n_changes);
803fb7
+        return create_symlink(i->path, path, !!(flags & UNIT_FILE_FORCE), changes, n_changes);
803fb7
 }
803fb7
 
803fb7
 int unit_file_get_default(
803fb7
@@ -2311,11 +2306,10 @@ static int preset_prepare_one(
803fb7
 
803fb7
 int unit_file_preset(
803fb7
                 UnitFileScope scope,
803fb7
-                bool runtime,
803fb7
+                UnitFileFlags flags,
803fb7
                 const char *root_dir,
803fb7
                 char **files,
803fb7
                 UnitFilePresetMode mode,
803fb7
-                bool force,
803fb7
                 UnitFileChange **changes,
803fb7
                 unsigned *n_changes) {
803fb7
 
803fb7
@@ -2337,7 +2331,7 @@ int unit_file_preset(
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
-        r = get_config_path(scope, runtime, root_dir, &config_path);
803fb7
+        r = get_config_path(scope, flags & UNIT_FILE_RUNTIME, root_dir, &config_path);
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
@@ -2350,15 +2344,14 @@ int unit_file_preset(
803fb7
                         return r;
803fb7
         }
803fb7
 
803fb7
-        return execute_preset(scope, &plus, &minus, &paths, config_path, root_dir, files, mode, force, changes, n_changes);
803fb7
+        return execute_preset(scope, &plus, &minus, &paths, config_path, root_dir, files, mode, !!(flags & UNIT_FILE_FORCE), changes, n_changes);
803fb7
 }
803fb7
 
803fb7
 int unit_file_preset_all(
803fb7
                 UnitFileScope scope,
803fb7
-                bool runtime,
803fb7
+                UnitFileFlags flags,
803fb7
                 const char *root_dir,
803fb7
                 UnitFilePresetMode mode,
803fb7
-                bool force,
803fb7
                 UnitFileChange **changes,
803fb7
                 unsigned *n_changes) {
803fb7
 
803fb7
@@ -2380,7 +2373,7 @@ int unit_file_preset_all(
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
-        r = get_config_path(scope, runtime, root_dir, &config_path);
803fb7
+        r = get_config_path(scope, flags & UNIT_FILE_RUNTIME, root_dir, &config_path);
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
 
803fb7
@@ -2434,7 +2427,7 @@ int unit_file_preset_all(
803fb7
                 }
803fb7
         }
803fb7
 
803fb7
-        return execute_preset(scope, &plus, &minus, &paths, config_path, root_dir, NULL, mode, force, changes, n_changes);
803fb7
+        return execute_preset(scope, &plus, &minus, &paths, config_path, root_dir, NULL, mode, !!(flags & UNIT_FILE_FORCE), changes, n_changes);
803fb7
 }
803fb7
 
803fb7
 static void unit_file_list_free_one(UnitFileList *f) {
803fb7
diff --git a/src/shared/install.h b/src/shared/install.h
803fb7
index 7e40445d3..c961b53d0 100644
803fb7
--- a/src/shared/install.h
803fb7
+++ b/src/shared/install.h
803fb7
@@ -66,6 +66,11 @@ typedef enum UnitFileChangeType {
803fb7
         _UNIT_FILE_CHANGE_TYPE_INVALID = -1
803fb7
 } UnitFileChangeType;
803fb7
 
803fb7
+typedef enum UnitFileFlags {
803fb7
+        UNIT_FILE_RUNTIME = 1,
803fb7
+        UNIT_FILE_FORCE = 1 << 1
803fb7
+} UnitFileFlags;
803fb7
+
803fb7
 static inline bool unit_file_change_is_modification(UnitFileChangeType type) {
803fb7
         return IN_SET(type, UNIT_FILE_SYMLINK, UNIT_FILE_UNLINK);
803fb7
 }
803fb7
@@ -120,17 +125,17 @@ static inline bool UNIT_FILE_INSTALL_INFO_HAS_ALSO(InstallInfo *i) {
803fb7
         return !strv_isempty(i->also);
803fb7
 }
803fb7
 
803fb7
-int unit_file_enable(UnitFileScope scope, bool runtime, const char *root_dir, char **files, bool force, UnitFileChange **changes, unsigned *n_changes);
803fb7
-int unit_file_disable(UnitFileScope scope, bool runtime, const char *root_dir, char **files, UnitFileChange **changes, unsigned *n_changes);
803fb7
-int unit_file_reenable(UnitFileScope scope, bool runtime, const char *root_dir, char **files, bool force, UnitFileChange **changes, unsigned *n_changes);
803fb7
-int unit_file_link(UnitFileScope scope, bool runtime, const char *root_dir, char **files, bool force, UnitFileChange **changes, unsigned *n_changes);
803fb7
-int unit_file_preset(UnitFileScope scope, bool runtime, const char *root_dir, char **files, UnitFilePresetMode mode, bool force, UnitFileChange **changes, unsigned *n_changes);
803fb7
-int unit_file_preset_all(UnitFileScope scope, bool runtime, const char *root_dir, UnitFilePresetMode mode, bool force, UnitFileChange **changes, unsigned *n_changes);
803fb7
-int unit_file_mask(UnitFileScope scope, bool runtime, const char *root_dir, char **files, bool force, UnitFileChange **changes, unsigned *n_changes);
803fb7
-int unit_file_unmask(UnitFileScope scope, bool runtime, const char *root_dir, char **files, UnitFileChange **changes, unsigned *n_changes);
803fb7
-int unit_file_set_default(UnitFileScope scope, const char *root_dir, const char *file, bool force, UnitFileChange **changes, unsigned *n_changes);
803fb7
+int unit_file_enable(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, char **files, UnitFileChange **changes, unsigned *n_changes);
803fb7
+int unit_file_disable(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, char **files, UnitFileChange **changes, unsigned *n_changes);
803fb7
+int unit_file_reenable(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, char **files, UnitFileChange **changes, unsigned *n_changes);
803fb7
+int unit_file_link(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, char **files, UnitFileChange **changes, unsigned *n_changes);
803fb7
+int unit_file_preset(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, char **files, UnitFilePresetMode mode, UnitFileChange **changes, unsigned *n_changes);
803fb7
+int unit_file_preset_all(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, UnitFilePresetMode mode, UnitFileChange **changes, unsigned *n_changes);
803fb7
+int unit_file_mask(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, char **files, UnitFileChange **changes, unsigned *n_changes);
803fb7
+int unit_file_unmask(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, char **files, UnitFileChange **changes, unsigned *n_changes);
803fb7
+int unit_file_set_default(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, const char *file, UnitFileChange **changes, unsigned *n_changes);
803fb7
 int unit_file_get_default(UnitFileScope scope, const char *root_dir, char **name);
803fb7
-int unit_file_add_dependency(UnitFileScope scope, bool runtime, const char *root_dir, char **files, const char *target, UnitDependency dep, bool force, UnitFileChange **changes, unsigned *n_changes);
803fb7
+int unit_file_add_dependency(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, char **files, const char *target, UnitDependency dep, UnitFileChange **changes, unsigned *n_changes);
803fb7
 
803fb7
 int unit_file_lookup_state(UnitFileScope scope, const char *root_dir,const LookupPaths *paths, const char *name, UnitFileState *ret);
803fb7
 int unit_file_get_state(UnitFileScope scope, const char *root_dir, const char *filename, UnitFileState *ret);
803fb7
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
803fb7
index 1e1009f38..e0dbf0fda 100644
803fb7
--- a/src/systemctl/systemctl.c
803fb7
+++ b/src/systemctl/systemctl.c
803fb7
@@ -165,6 +165,11 @@ static int daemon_reload(sd_bus *bus, char **args);
803fb7
 static int halt_now(enum action a);
803fb7
 static int check_one_unit(sd_bus *bus, const char *name, const char *good_states, bool quiet);
803fb7
 
803fb7
+static UnitFileFlags args_to_flags(void) {
803fb7
+        return (arg_runtime ? UNIT_FILE_RUNTIME : 0) |
803fb7
+               (arg_force   ? UNIT_FILE_FORCE   : 0);
803fb7
+}
803fb7
+
803fb7
 static char** strv_skip_first(char **strv) {
803fb7
         if (strv_length(strv) > 0)
803fb7
                 return strv + 1;
803fb7
@@ -1974,7 +1979,7 @@ static int set_default(sd_bus *bus, char **args) {
803fb7
                 return log_oom();
803fb7
 
803fb7
         if (!bus || avoid_bus()) {
803fb7
-                r = unit_file_set_default(arg_scope, arg_root, unit, true, &changes, &n_changes);
803fb7
+                r = unit_file_set_default(arg_scope, UNIT_FILE_FORCE, arg_root, unit, &changes, &n_changes);
803fb7
                 if (r < 0)
803fb7
                         return log_error_errno(r, "Failed to set default target: %m");
803fb7
 
803fb7
@@ -5407,22 +5412,25 @@ static int enable_unit(sd_bus *bus, char **args) {
803fb7
         }
803fb7
 
803fb7
         if (!bus || avoid_bus()) {
803fb7
+                UnitFileFlags flags;
803fb7
+
803fb7
+                flags = args_to_flags();
803fb7
                 if (streq(verb, "enable")) {
803fb7
-                        r = unit_file_enable(arg_scope, arg_runtime, arg_root, names, arg_force, &changes, &n_changes);
803fb7
+                        r = unit_file_enable(arg_scope, flags, arg_root, names, &changes, &n_changes);
803fb7
                         carries_install_info = r;
803fb7
                 } else if (streq(verb, "disable"))
803fb7
-                        r = unit_file_disable(arg_scope, arg_runtime, arg_root, names, &changes, &n_changes);
803fb7
+                        r = unit_file_disable(arg_scope, flags, arg_root, names, &changes, &n_changes);
803fb7
                 else if (streq(verb, "reenable")) {
803fb7
-                        r = unit_file_reenable(arg_scope, arg_runtime, arg_root, names, arg_force, &changes, &n_changes);
803fb7
+                        r = unit_file_reenable(arg_scope, flags, arg_root, names, &changes, &n_changes);
803fb7
                         carries_install_info = r;
803fb7
                 } else if (streq(verb, "link"))
803fb7
-                        r = unit_file_link(arg_scope, arg_runtime, arg_root, names, arg_force, &changes, &n_changes);
803fb7
+                        r = unit_file_link(arg_scope, flags, arg_root, names, &changes, &n_changes);
803fb7
                 else if (streq(verb, "preset")) {
803fb7
-                        r = unit_file_preset(arg_scope, arg_runtime, arg_root, names, arg_preset_mode, arg_force, &changes, &n_changes);
803fb7
+                        r = unit_file_preset(arg_scope, flags, arg_root, names, arg_preset_mode, &changes, &n_changes);
803fb7
                 } else if (streq(verb, "mask"))
803fb7
-                        r = unit_file_mask(arg_scope, arg_runtime, arg_root, names, arg_force, &changes, &n_changes);
803fb7
+                        r = unit_file_mask(arg_scope, flags, arg_root, names, &changes, &n_changes);
803fb7
                 else if (streq(verb, "unmask"))
803fb7
-                        r = unit_file_unmask(arg_scope, arg_runtime, arg_root, names, &changes, &n_changes);
803fb7
+                        r = unit_file_unmask(arg_scope, flags, arg_root, names, &changes, &n_changes);
803fb7
                 else
803fb7
                         assert_not_reached("Unknown verb");
803fb7
 
803fb7
@@ -5588,7 +5596,7 @@ static int add_dependency(sd_bus *bus, char **args) {
803fb7
                 UnitFileChange *changes = NULL;
803fb7
                 unsigned n_changes = 0;
803fb7
 
803fb7
-                r = unit_file_add_dependency(arg_scope, arg_runtime, arg_root, names, target, dep, arg_force, &changes, &n_changes);
803fb7
+                r = unit_file_add_dependency(arg_scope, args_to_flags(), arg_root, names, target, dep, &changes, &n_changes);
803fb7
 
803fb7
                 if (r < 0)
803fb7
                         return log_error_errno(r, "Can't add dependency: %m");
803fb7
@@ -5652,7 +5660,7 @@ static int preset_all(sd_bus *bus, char **args) {
803fb7
 
803fb7
         if (!bus || avoid_bus()) {
803fb7
 
803fb7
-                r = unit_file_preset_all(arg_scope, arg_runtime, arg_root, arg_preset_mode, arg_force, &changes, &n_changes);
803fb7
+                r = unit_file_preset_all(arg_scope, args_to_flags(), arg_root, arg_preset_mode, &changes, &n_changes);
803fb7
                 if (r < 0) {
803fb7
                         log_error_errno(r, "Operation failed: %m");
803fb7
                         goto finish;
803fb7
diff --git a/src/test/test-install-root.c b/src/test/test-install-root.c
803fb7
index 667c3748c..cb417d4c1 100644
803fb7
--- a/src/test/test-install-root.c
803fb7
+++ b/src/test/test-install-root.c
803fb7
@@ -62,7 +62,7 @@ static void test_basic_mask_and_enable(const char *root) {
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "d.service", NULL) >= 0);
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "d.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
803fb7
 
803fb7
-        assert_se(unit_file_mask(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("a.service"), false, &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_mask(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 1);
803fb7
         assert_se(changes[0].type == UNIT_FILE_SYMLINK);
803fb7
         assert_se(streq(changes[0].source, "/dev/null"));
803fb7
@@ -78,11 +78,11 @@ static void test_basic_mask_and_enable(const char *root) {
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "d.service", &state) >= 0 && state == UNIT_FILE_MASKED);
803fb7
 
803fb7
         /* Enabling a masked unit should fail! */
803fb7
-        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("a.service"), false, &changes, &n_changes) == -ESHUTDOWN);
803fb7
+        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) == -ESHUTDOWN);
803fb7
         unit_file_changes_free(changes, n_changes);
803fb7
         changes = NULL; n_changes = 0;
803fb7
 
803fb7
-        assert_se(unit_file_unmask(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_unmask(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 1);
803fb7
         assert_se(changes[0].type == UNIT_FILE_UNLINK);
803fb7
         p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/a.service");
803fb7
@@ -90,7 +90,7 @@ static void test_basic_mask_and_enable(const char *root) {
803fb7
         unit_file_changes_free(changes, n_changes);
803fb7
         changes = NULL; n_changes = 0;
803fb7
 
803fb7
-        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("a.service"), false, &changes, &n_changes) == 1);
803fb7
+        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) == 1);
803fb7
         assert_se(n_changes == 1);
803fb7
         assert_se(changes[0].type == UNIT_FILE_SYMLINK);
803fb7
         assert_se(streq(changes[0].source, "/usr/lib/systemd/system/a.service"));
803fb7
@@ -105,12 +105,12 @@ static void test_basic_mask_and_enable(const char *root) {
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "d.service", &state) >= 0 && state == UNIT_FILE_ENABLED);
803fb7
 
803fb7
         /* Enabling it again should succeed but be a NOP */
803fb7
-        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("a.service"), false, &changes, &n_changes) == 1);
803fb7
+        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) == 1);
803fb7
         assert_se(n_changes == 0);
803fb7
         unit_file_changes_free(changes, n_changes);
803fb7
         changes = NULL; n_changes = 0;
803fb7
 
803fb7
-        assert_se(unit_file_disable(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_disable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 1);
803fb7
         assert_se(changes[0].type == UNIT_FILE_UNLINK);
803fb7
         p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/a.service");
803fb7
@@ -124,13 +124,13 @@ static void test_basic_mask_and_enable(const char *root) {
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "d.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
803fb7
 
803fb7
         /* Disabling a disabled unit must suceed but be a NOP */
803fb7
-        assert_se(unit_file_disable(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_disable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 0);
803fb7
         unit_file_changes_free(changes, n_changes);
803fb7
         changes = NULL; n_changes = 0;
803fb7
 
803fb7
         /* Let's enable this indirectly via a symlink */
803fb7
-        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("d.service"), false, &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("d.service"), &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 1);
803fb7
         assert_se(changes[0].type == UNIT_FILE_SYMLINK);
803fb7
         assert_se(streq(changes[0].source, "/usr/lib/systemd/system/a.service"));
803fb7
@@ -146,7 +146,7 @@ static void test_basic_mask_and_enable(const char *root) {
803fb7
 
803fb7
         /* Let's try to reenable */
803fb7
 
803fb7
-        assert_se(unit_file_reenable(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("b.service"), false, &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_reenable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("b.service"), &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 2);
803fb7
         assert_se(changes[0].type == UNIT_FILE_UNLINK);
803fb7
         p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/a.service");
803fb7
@@ -215,7 +215,7 @@ static void test_linked_units(const char *root) {
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "linked3.service", &state) >= 0 && state == UNIT_FILE_LINKED);
803fb7
 
803fb7
         /* First, let's link the unit into the search path */
803fb7
-        assert_se(unit_file_link(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("/opt/linked.service"), false, &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_link(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("/opt/linked.service"), &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 1);
803fb7
         assert_se(changes[0].type == UNIT_FILE_SYMLINK);
803fb7
         assert_se(streq(changes[0].source, "/opt/linked.service"));
803fb7
@@ -227,7 +227,7 @@ static void test_linked_units(const char *root) {
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "linked.service", &state) >= 0 && state == UNIT_FILE_LINKED);
803fb7
 
803fb7
         /* Let's unlink it from the search path again */
803fb7
-        assert_se(unit_file_disable(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("linked.service"), &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_disable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("linked.service"), &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 1);
803fb7
         assert_se(changes[0].type == UNIT_FILE_UNLINK);
803fb7
         p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/linked.service");
803fb7
@@ -238,7 +238,7 @@ static void test_linked_units(const char *root) {
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "linked.service", NULL) == -ENOENT);
803fb7
 
803fb7
         /* Now, let's not just link it, but also enable it */
803fb7
-        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("/opt/linked.service"), false, &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("/opt/linked.service"), &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 2);
803fb7
         p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/linked.service");
803fb7
         q = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/linked.service");
803fb7
@@ -260,7 +260,7 @@ static void test_linked_units(const char *root) {
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "linked.service", &state) >= 0 && state == UNIT_FILE_ENABLED);
803fb7
 
803fb7
         /* And let's unlink it again */
803fb7
-        assert_se(unit_file_disable(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("linked.service"), &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_disable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("linked.service"), &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 2);
803fb7
         p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/linked.service");
803fb7
         q = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/linked.service");
803fb7
@@ -280,7 +280,7 @@ static void test_linked_units(const char *root) {
803fb7
 
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "linked.service", NULL) == -ENOENT);
803fb7
 
803fb7
-        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("linked2.service"), false, &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("linked2.service"), &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 2);
803fb7
         p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/linked2.service");
803fb7
         q = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/linked2.service");
803fb7
@@ -299,7 +299,7 @@ static void test_linked_units(const char *root) {
803fb7
         unit_file_changes_free(changes, n_changes);
803fb7
         changes = NULL; n_changes = 0;
803fb7
 
803fb7
-        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("linked3.service"), false, &changes, &n_changes) == -ELOOP);
803fb7
+        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("linked3.service"), &changes, &n_changes) == -ELOOP);
803fb7
         unit_file_changes_free(changes, n_changes);
803fb7
         changes = NULL; n_changes = 0;
803fb7
 }
803fb7
@@ -318,14 +318,14 @@ static void test_default(const char *root) {
803fb7
 
803fb7
         assert_se(unit_file_get_default(UNIT_FILE_SYSTEM, root, &def) == -ENOENT);
803fb7
 
803fb7
-        assert_se(unit_file_set_default(UNIT_FILE_SYSTEM, root, "idontexist.target", false, &changes, &n_changes) == -ENOENT);
803fb7
+        assert_se(unit_file_set_default(UNIT_FILE_SYSTEM, 0, root, "idontexist.target", &changes, &n_changes) == -ENOENT);
803fb7
         assert_se(n_changes == 0);
803fb7
         unit_file_changes_free(changes, n_changes);
803fb7
         changes = NULL; n_changes = 0;
803fb7
 
803fb7
         assert_se(unit_file_get_default(UNIT_FILE_SYSTEM, root, &def) == -ENOENT);
803fb7
 
803fb7
-        assert_se(unit_file_set_default(UNIT_FILE_SYSTEM, root, "test-default.target", false, &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_set_default(UNIT_FILE_SYSTEM, 0, root, "test-default.target", &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 1);
803fb7
         assert_se(changes[0].type == UNIT_FILE_SYMLINK);
803fb7
         assert_se(streq(changes[0].source, "/usr/lib/systemd/system/test-default-real.target"));
803fb7
@@ -355,7 +355,7 @@ static void test_add_dependency(const char *root) {
803fb7
         p = strjoina(root, "/usr/lib/systemd/system/add-dependency-test-service.service");
803fb7
         assert_se(symlink("real-add-dependency-test-service.service", p) >= 0);
803fb7
 
803fb7
-        assert_se(unit_file_add_dependency(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("add-dependency-test-service.service"), "add-dependency-test-target.target", UNIT_WANTS, false, &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_add_dependency(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("add-dependency-test-service.service"), "add-dependency-test-target.target", UNIT_WANTS, &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 1);
803fb7
         assert_se(changes[0].type == UNIT_FILE_SYMLINK);
803fb7
         assert_se(streq(changes[0].source, "/usr/lib/systemd/system/real-add-dependency-test-service.service"));
803fb7
@@ -392,7 +392,7 @@ static void test_template_enable(const char *root) {
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "template-symlink@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "template-symlink@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
803fb7
 
803fb7
-        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("template@.service"), false, &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("template@.service"), &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 1);
803fb7
         assert_se(changes[0].type == UNIT_FILE_SYMLINK);
803fb7
         assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service"));
803fb7
@@ -408,7 +408,7 @@ static void test_template_enable(const char *root) {
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "template-symlink@def.service", &state) >= 0 && state == UNIT_FILE_ENABLED);
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "template-symlink@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
803fb7
 
803fb7
-        assert_se(unit_file_disable(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("template@.service"), &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_disable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("template@.service"), &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 1);
803fb7
         assert_se(changes[0].type == UNIT_FILE_UNLINK);
803fb7
         assert_se(streq(changes[0].path, p));
803fb7
@@ -422,7 +422,7 @@ static void test_template_enable(const char *root) {
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "template-symlink@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "template-symlink@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
803fb7
 
803fb7
-        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("template@foo.service"), false, &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("template@foo.service"), &changes, &n_changes) >= 0);
803fb7
         assert_se(changes[0].type == UNIT_FILE_SYMLINK);
803fb7
         assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service"));
803fb7
         p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/template@foo.service");
803fb7
@@ -437,7 +437,7 @@ static void test_template_enable(const char *root) {
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "template-symlink@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "template-symlink@foo.service", &state) >= 0 && state == UNIT_FILE_ENABLED);
803fb7
 
803fb7
-        assert_se(unit_file_disable(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("template@foo.service"), &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_disable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("template@foo.service"), &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 1);
803fb7
         assert_se(changes[0].type == UNIT_FILE_UNLINK);
803fb7
         assert_se(streq(changes[0].path, p));
803fb7
@@ -453,7 +453,7 @@ static void test_template_enable(const char *root) {
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "template-symlink@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "template-symlink@quux.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
803fb7
 
803fb7
-        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("template-symlink@quux.service"), false, &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("template-symlink@quux.service"), &changes, &n_changes) >= 0);
803fb7
         assert_se(changes[0].type == UNIT_FILE_SYMLINK);
803fb7
         assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service"));
803fb7
         p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/template@quux.service");
803fb7
@@ -498,7 +498,7 @@ static void test_indirect(const char *root) {
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "indirectb.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "indirectc.service", &state) >= 0 && state == UNIT_FILE_INDIRECT);
803fb7
 
803fb7
-        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("indirectc.service"), false, &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_enable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("indirectc.service"), &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 1);
803fb7
         assert_se(changes[0].type == UNIT_FILE_SYMLINK);
803fb7
         assert_se(streq(changes[0].source, "/usr/lib/systemd/system/indirectb.service"));
803fb7
@@ -511,7 +511,7 @@ static void test_indirect(const char *root) {
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "indirectb.service", &state) >= 0 && state == UNIT_FILE_ENABLED);
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "indirectc.service", &state) >= 0 && state == UNIT_FILE_INDIRECT);
803fb7
 
803fb7
-        assert_se(unit_file_disable(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("indirectc.service"), &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_disable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("indirectc.service"), &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 1);
803fb7
         assert_se(changes[0].type == UNIT_FILE_UNLINK);
803fb7
         p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/indirectb.service");
803fb7
@@ -551,7 +551,7 @@ static void test_preset_and_list(const char *root) {
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "preset-yes.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "preset-no.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
803fb7
 
803fb7
-        assert_se(unit_file_preset(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("preset-yes.service"), UNIT_FILE_PRESET_FULL, false, &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_preset(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("preset-yes.service"), UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 1);
803fb7
         assert_se(changes[0].type == UNIT_FILE_SYMLINK);
803fb7
         assert_se(streq(changes[0].source, "/usr/lib/systemd/system/preset-yes.service"));
803fb7
@@ -563,7 +563,7 @@ static void test_preset_and_list(const char *root) {
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "preset-yes.service", &state) >= 0 && state == UNIT_FILE_ENABLED);
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "preset-no.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
803fb7
 
803fb7
-        assert_se(unit_file_disable(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("preset-yes.service"), &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_disable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("preset-yes.service"), &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 1);
803fb7
         assert_se(changes[0].type == UNIT_FILE_UNLINK);
803fb7
         p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/preset-yes.service");
803fb7
@@ -574,7 +574,7 @@ static void test_preset_and_list(const char *root) {
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "preset-yes.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "preset-no.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
803fb7
 
803fb7
-        assert_se(unit_file_preset(UNIT_FILE_SYSTEM, false, root, STRV_MAKE("preset-no.service"), UNIT_FILE_PRESET_FULL, false, &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_preset(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("preset-no.service"), UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0);
803fb7
         assert_se(n_changes == 0);
803fb7
         unit_file_changes_free(changes, n_changes);
803fb7
         changes = NULL; n_changes = 0;
803fb7
@@ -582,7 +582,7 @@ static void test_preset_and_list(const char *root) {
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "preset-yes.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
803fb7
         assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "preset-no.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
803fb7
 
803fb7
-        assert_se(unit_file_preset_all(UNIT_FILE_SYSTEM, false, root, UNIT_FILE_PRESET_FULL, false, &changes, &n_changes) >= 0);
803fb7
+        assert_se(unit_file_preset_all(UNIT_FILE_SYSTEM, 0, root, UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0);
803fb7
 
803fb7
         assert_se(n_changes > 0);
803fb7
 
803fb7
diff --git a/src/test/test-install.c b/src/test/test-install.c
803fb7
index 08a1faf2c..0cae0e794 100644
803fb7
--- a/src/test/test-install.c
803fb7
+++ b/src/test/test-install.c
803fb7
@@ -73,12 +73,12 @@ int main(int argc, char* argv[]) {
803fb7
 
803fb7
         log_error("enable");
803fb7
 
803fb7
-        r = unit_file_enable(UNIT_FILE_SYSTEM, false, NULL, (char**) files, false, &changes, &n_changes);
803fb7
+        r = unit_file_enable(UNIT_FILE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes);
803fb7
         assert_se(r >= 0);
803fb7
 
803fb7
         log_error("enable2");
803fb7
 
803fb7
-        r = unit_file_enable(UNIT_FILE_SYSTEM, false, NULL, (char**) files, false, &changes, &n_changes);
803fb7
+        r = unit_file_enable(UNIT_FILE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes);
803fb7
         assert_se(r >= 0);
803fb7
 
803fb7
         dump_changes(changes, n_changes);
803fb7
@@ -93,7 +93,7 @@ int main(int argc, char* argv[]) {
803fb7
         changes = NULL;
803fb7
         n_changes = 0;
803fb7
 
803fb7
-        r = unit_file_disable(UNIT_FILE_SYSTEM, false, NULL, (char**) files, &changes, &n_changes);
803fb7
+        r = unit_file_disable(UNIT_FILE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes);
803fb7
         assert_se(r >= 0);
803fb7
 
803fb7
         dump_changes(changes, n_changes);
803fb7
@@ -107,10 +107,10 @@ int main(int argc, char* argv[]) {
803fb7
         changes = NULL;
803fb7
         n_changes = 0;
803fb7
 
803fb7
-        r = unit_file_mask(UNIT_FILE_SYSTEM, false, NULL, (char**) files, false, &changes, &n_changes);
803fb7
+        r = unit_file_mask(UNIT_FILE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes);
803fb7
         assert_se(r >= 0);
803fb7
         log_error("mask2");
803fb7
-        r = unit_file_mask(UNIT_FILE_SYSTEM, false, NULL, (char**) files, false, &changes, &n_changes);
803fb7
+        r = unit_file_mask(UNIT_FILE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes);
803fb7
         assert_se(r >= 0);
803fb7
 
803fb7
         dump_changes(changes, n_changes);
803fb7
@@ -124,10 +124,10 @@ int main(int argc, char* argv[]) {
803fb7
         changes = NULL;
803fb7
         n_changes = 0;
803fb7
 
803fb7
-        r = unit_file_unmask(UNIT_FILE_SYSTEM, false, NULL, (char**) files, &changes, &n_changes);
803fb7
+        r = unit_file_unmask(UNIT_FILE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes);
803fb7
         assert_se(r >= 0);
803fb7
         log_error("unmask2");
803fb7
-        r = unit_file_unmask(UNIT_FILE_SYSTEM, false, NULL, (char**) files, &changes, &n_changes);
803fb7
+        r = unit_file_unmask(UNIT_FILE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes);
803fb7
         assert_se(r >= 0);
803fb7
 
803fb7
         dump_changes(changes, n_changes);
803fb7
@@ -141,7 +141,7 @@ int main(int argc, char* argv[]) {
803fb7
         changes = NULL;
803fb7
         n_changes = 0;
803fb7
 
803fb7
-        r = unit_file_mask(UNIT_FILE_SYSTEM, false, NULL, (char**) files, false, &changes, &n_changes);
803fb7
+        r = unit_file_mask(UNIT_FILE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes);
803fb7
         assert_se(r >= 0);
803fb7
 
803fb7
         dump_changes(changes, n_changes);
803fb7
@@ -155,10 +155,10 @@ int main(int argc, char* argv[]) {
803fb7
         changes = NULL;
803fb7
         n_changes = 0;
803fb7
 
803fb7
-        r = unit_file_disable(UNIT_FILE_SYSTEM, false, NULL, (char**) files, &changes, &n_changes);
803fb7
+        r = unit_file_disable(UNIT_FILE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes);
803fb7
         assert_se(r >= 0);
803fb7
         log_error("disable2");
803fb7
-        r = unit_file_disable(UNIT_FILE_SYSTEM, false, NULL, (char**) files, &changes, &n_changes);
803fb7
+        r = unit_file_disable(UNIT_FILE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes);
803fb7
         assert_se(r >= 0);
803fb7
 
803fb7
         dump_changes(changes, n_changes);
803fb7
@@ -172,7 +172,7 @@ int main(int argc, char* argv[]) {
803fb7
         changes = NULL;
803fb7
         n_changes = 0;
803fb7
 
803fb7
-        r = unit_file_unmask(UNIT_FILE_SYSTEM, false, NULL, (char**) files, &changes, &n_changes);
803fb7
+        r = unit_file_unmask(UNIT_FILE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes);
803fb7
         assert_se(r >= 0);
803fb7
 
803fb7
         dump_changes(changes, n_changes);
803fb7
@@ -186,7 +186,7 @@ int main(int argc, char* argv[]) {
803fb7
         changes = NULL;
803fb7
         n_changes = 0;
803fb7
 
803fb7
-        r = unit_file_enable(UNIT_FILE_SYSTEM, false, NULL, (char**) files2, false, &changes, &n_changes);
803fb7
+        r = unit_file_enable(UNIT_FILE_SYSTEM, 0, NULL, (char**) files2, &changes, &n_changes);
803fb7
         assert_se(r >= 0);
803fb7
 
803fb7
         dump_changes(changes, n_changes);
803fb7
@@ -200,7 +200,7 @@ int main(int argc, char* argv[]) {
803fb7
         changes = NULL;
803fb7
         n_changes = 0;
803fb7
 
803fb7
-        r = unit_file_disable(UNIT_FILE_SYSTEM, false, NULL, STRV_MAKE(basename(files2[0])), &changes, &n_changes);
803fb7
+        r = unit_file_disable(UNIT_FILE_SYSTEM, 0, NULL, STRV_MAKE(basename(files2[0])), &changes, &n_changes);
803fb7
         assert_se(r >= 0);
803fb7
 
803fb7
         dump_changes(changes, n_changes);
803fb7
@@ -213,7 +213,7 @@ int main(int argc, char* argv[]) {
803fb7
         changes = NULL;
803fb7
         n_changes = 0;
803fb7
 
803fb7
-        r = unit_file_link(UNIT_FILE_SYSTEM, false, NULL, (char**) files2, false, &changes, &n_changes);
803fb7
+        r = unit_file_link(UNIT_FILE_SYSTEM, 0, NULL, (char**) files2, &changes, &n_changes);
803fb7
         assert_se(r >= 0);
803fb7
 
803fb7
         dump_changes(changes, n_changes);
803fb7
@@ -227,7 +227,7 @@ int main(int argc, char* argv[]) {
803fb7
         changes = NULL;
803fb7
         n_changes = 0;
803fb7
 
803fb7
-        r = unit_file_disable(UNIT_FILE_SYSTEM, false, NULL, STRV_MAKE(basename(files2[0])), &changes, &n_changes);
803fb7
+        r = unit_file_disable(UNIT_FILE_SYSTEM, 0, NULL, STRV_MAKE(basename(files2[0])), &changes, &n_changes);
803fb7
         assert_se(r >= 0);
803fb7
 
803fb7
         dump_changes(changes, n_changes);
803fb7
@@ -240,7 +240,7 @@ int main(int argc, char* argv[]) {
803fb7
         changes = NULL;
803fb7
         n_changes = 0;
803fb7
 
803fb7
-        r = unit_file_link(UNIT_FILE_SYSTEM, false, NULL, (char**) files2, false, &changes, &n_changes);
803fb7
+        r = unit_file_link(UNIT_FILE_SYSTEM, 0, NULL, (char**) files2, &changes, &n_changes);
803fb7
         assert_se(r >= 0);
803fb7
 
803fb7
         dump_changes(changes, n_changes);
803fb7
@@ -254,7 +254,7 @@ int main(int argc, char* argv[]) {
803fb7
         changes = NULL;
803fb7
         n_changes = 0;
803fb7
 
803fb7
-        r = unit_file_reenable(UNIT_FILE_SYSTEM, false, NULL, (char**) files2, false, &changes, &n_changes);
803fb7
+        r = unit_file_reenable(UNIT_FILE_SYSTEM, 0, NULL, (char**) files2, &changes, &n_changes);
803fb7
         assert_se(r >= 0);
803fb7
 
803fb7
         dump_changes(changes, n_changes);
803fb7
@@ -268,7 +268,7 @@ int main(int argc, char* argv[]) {
803fb7
         changes = NULL;
803fb7
         n_changes = 0;
803fb7
 
803fb7
-        r = unit_file_disable(UNIT_FILE_SYSTEM, false, NULL, STRV_MAKE(basename(files2[0])), &changes, &n_changes);
803fb7
+        r = unit_file_disable(UNIT_FILE_SYSTEM, 0, NULL, STRV_MAKE(basename(files2[0])), &changes, &n_changes);
803fb7
         assert_se(r >= 0);
803fb7
 
803fb7
         dump_changes(changes, n_changes);
803fb7
@@ -280,7 +280,7 @@ int main(int argc, char* argv[]) {
803fb7
         changes = NULL;
803fb7
         n_changes = 0;
803fb7
 
803fb7
-        r = unit_file_preset(UNIT_FILE_SYSTEM, false, NULL, (char**) files, UNIT_FILE_PRESET_FULL, false, &changes, &n_changes);
803fb7
+        r = unit_file_preset(UNIT_FILE_SYSTEM, 0, NULL, (char**) files, UNIT_FILE_PRESET_FULL, &changes, &n_changes);
803fb7
         assert_se(r >= 0);
803fb7
 
803fb7
         dump_changes(changes, n_changes);