ryantimwilson / rpms / systemd

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