]> err.no Git - systemd/commitdiff
unit: rename 'banned' load state to 'masked'
authorLennart Poettering <lennart@poettering.net>
Fri, 8 Oct 2010 16:21:52 +0000 (18:21 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 8 Oct 2010 16:21:52 +0000 (18:21 +0200)
man/systemd.unit.xml
src/bus-errors.h
src/load-fragment.c
src/main.c
src/manager.c
src/unit.c
src/unit.h

index c3c9561f2fb1412a43a11dd6454969f9696ce36d..e59c1a16c4d828d4530b50bcd8322509c168a012 100644 (file)
                 string before the @, i.e. "getty" in the example
                 above, where "tty3" is the instance name.</para>
 
+                <para>If a unit file is empty (i.e. has the file size
+                0) or is symlinked to <filename>/dev/null</filename>
+                its configuration will not be loaded and it appears
+                with a load state of <literal>masked</literal>, and
+                cannot be activated. Use this as an effective way to
+                fully disable a unit, making it impossible to start it
+                even manually.</para>
+
                 <para>The unit file format is covered by the
                 <ulink
                 url="http://www.freedesktop.org/wiki/Software/systemd/InterfaceStabilityPromise">Interface
index 8f5c4eb7f3f1dbe48b2e1500ef2c977c056c3baa..d6ccd7407f8ca92c6cbe6927871fe570ab9f6f4c 100644 (file)
@@ -37,7 +37,7 @@
 #define BUS_ERROR_ONLY_BY_DEPENDENCY "org.freedesktop.systemd1.OnlyByDependency"
 #define BUS_ERROR_NO_ISOLATION "org.freedesktop.systemd1.NoIsolation"
 #define BUS_ERROR_LOAD_FAILED "org.freedesktop.systemd1.LoadFailed"
-#define BUS_ERROR_BANNED "org.freedesktop.systemd1.Banned"
+#define BUS_ERROR_MASKED "org.freedesktop.systemd1.Masked"
 #define BUS_ERROR_JOB_TYPE_NOT_APPLICABLE "org.freedesktop.systemd1.JobTypeNotApplicable"
 #define BUS_ERROR_TRANSACTION_IS_DESTRUCTIVE "org.freedesktop.systemd1.TransactionIsDestructive"
 #define BUS_ERROR_TRANSACTION_JOBS_CONFLICTING "org.freedesktop.systemd1.TransactionJobsConflicting"
index b22955b4244687bc9c3009bdc879275d50319c38..eb9861802b21da0ca226f0549d3efa3d509e11b5 100644 (file)
@@ -1885,7 +1885,7 @@ static int load_from_path(Unit *u, const char *path) {
         }
 
         if (null_or_empty(&st))
-                u->meta.load_state = UNIT_BANNED;
+                u->meta.load_state = UNIT_MASKED;
         else {
                 /* Now, parse the file contents */
                 if ((r = config_parse(filename, f, sections, items, false, u)) < 0)
index d6f5c56c2a79372f7ff8daae42639c29cdd0aee7..fa306d6aad3bf18a1b07162e06d77993edf04fb5 100644 (file)
@@ -1062,8 +1062,8 @@ int main(int argc, char *argv[]) {
                         dbus_error_free(&error);
                 } else if (target->meta.load_state == UNIT_ERROR)
                         log_error("Failed to load default target: %s", strerror(-target->meta.load_error));
-                else if (target->meta.load_state == UNIT_BANNED)
-                        log_error("Default target banned.");
+                else if (target->meta.load_state == UNIT_MASKED)
+                        log_error("Default target masked.");
 
                 if (!target || target->meta.load_state != UNIT_LOADED) {
                         log_info("Trying to load rescue target...");
@@ -1075,8 +1075,8 @@ int main(int argc, char *argv[]) {
                         } else if (target->meta.load_state == UNIT_ERROR) {
                                 log_error("Failed to load rescue target: %s", strerror(-target->meta.load_error));
                                 goto finish;
-                        } else if (target->meta.load_state == UNIT_BANNED) {
-                                log_error("Rescue target banned.");
+                        } else if (target->meta.load_state == UNIT_MASKED) {
+                                log_error("Rescue target masked.");
                                 goto finish;
                         }
                 }
index 7e9075aad6231fe3c7ab3b72a5e32c79b3d9981b..537ff2e39d3742968517e433d601e72a6d373b39 100644 (file)
@@ -1400,7 +1400,7 @@ static int transaction_add_job_and_dependencies(
 
         if (unit->meta.load_state != UNIT_LOADED &&
             unit->meta.load_state != UNIT_ERROR &&
-            unit->meta.load_state != UNIT_BANNED) {
+            unit->meta.load_state != UNIT_MASKED) {
                 dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s is not loaded properly.", unit->meta.id);
                 return -EINVAL;
         }
@@ -1414,8 +1414,8 @@ static int transaction_add_job_and_dependencies(
                 return -EINVAL;
         }
 
-        if (type != JOB_STOP && unit->meta.load_state == UNIT_BANNED) {
-                dbus_set_error(e, BUS_ERROR_BANNED, "Unit %s is banned.", unit->meta.id);
+        if (type != JOB_STOP && unit->meta.load_state == UNIT_MASKED) {
+                dbus_set_error(e, BUS_ERROR_MASKED, "Unit %s is masked.", unit->meta.id);
                 return -EINVAL;
         }
 
index d45fe91560513b1ea8988404cc29ca65554f2f5a..a45a1f7725015cf84b7834adb8f3633eef8fd89d 100644 (file)
@@ -2237,7 +2237,7 @@ static const char* const unit_load_state_table[_UNIT_LOAD_STATE_MAX] = {
         [UNIT_LOADED] = "loaded",
         [UNIT_ERROR] = "error",
         [UNIT_MERGED] = "merged",
-        [UNIT_BANNED] = "banned"
+        [UNIT_MASKED] = "masked"
 };
 
 DEFINE_STRING_TABLE_LOOKUP(unit_load_state, UnitLoadState);
index aa818d4f2115d405300553c3b98882f8f9ef144e..605fa3774d8944ec4c27a0d5514dcc408efecfa7 100644 (file)
@@ -62,7 +62,7 @@ enum UnitLoadState {
         UNIT_LOADED,
         UNIT_ERROR,
         UNIT_MERGED,
-        UNIT_BANNED,
+        UNIT_MASKED,
         _UNIT_LOAD_STATE_MAX,
         _UNIT_LOAD_STATE_INVALID = -1
 };