]> err.no Git - systemd/commitdiff
unit: shorten active state enums to make systemctl output nicer
authorLennart Poettering <lennart@poettering.net>
Thu, 1 Jul 2010 01:34:15 +0000 (03:34 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 1 Jul 2010 01:34:15 +0000 (03:34 +0200)
fixme
src/automount.c
src/job.c
src/mount.c
src/path.c
src/service.c
src/socket.c
src/swap.c
src/timer.c
src/unit.c
src/unit.h

diff --git a/fixme b/fixme
index 09aba7de0da1619a90860da4f66f4b87afac6f6d..2f0f929c752313d14dacb8c0bf1d935b3af4b47d 100644 (file)
--- a/fixme
+++ b/fixme
 
 * selinux
 
-* systemctl check
-
-* nettere fehlermeldung bei systemctl start foo.service failure
-
-* systemd-install disable sollte den service runterfahren
+* systemd-install disable sollte den service runterfahren, and daemon-reload machen
 
 * systemctl daemon-reload is kaputt
 
-* keinerlei fehlermeldung bei dead symlink muss gefixt werden
-
 External:
 
 * patch /etc/init.d/functions with:
index 84f2d97edae77e8cbb4830674c07929b051ffadb..5e669c5d323a4b657e741176790f77d402b37bec 100644 (file)
@@ -40,7 +40,7 @@ static const UnitActiveState state_translation_table[_AUTOMOUNT_STATE_MAX] = {
         [AUTOMOUNT_DEAD] = UNIT_INACTIVE,
         [AUTOMOUNT_WAITING] = UNIT_ACTIVE,
         [AUTOMOUNT_RUNNING] = UNIT_ACTIVE,
-        [AUTOMOUNT_MAINTENANCE] = UNIT_INACTIVE_MAINTENANCE
+        [AUTOMOUNT_MAINTENANCE] = UNIT_MAINTENANCE
 };
 
 static int open_dev_autofs(Manager *m);
index 8273a39c350c609f280baf49a57a4dd1d92d2171..31e9cfe8d6f937ddf7973548c599f2c0d64283cb 100644 (file)
--- a/src/job.c
+++ b/src/job.c
@@ -275,26 +275,26 @@ bool job_type_is_redundant(JobType a, UnitActiveState b) {
         case JOB_START:
                 return
                         b == UNIT_ACTIVE ||
-                        b == UNIT_ACTIVE_RELOADING;
+                        b == UNIT_RELOADING;
 
         case JOB_STOP:
                 return
                         b == UNIT_INACTIVE ||
-                        b == UNIT_INACTIVE_MAINTENANCE;
+                        b == UNIT_MAINTENANCE;
 
         case JOB_VERIFY_ACTIVE:
                 return
                         b == UNIT_ACTIVE ||
-                        b == UNIT_ACTIVE_RELOADING;
+                        b == UNIT_RELOADING;
 
         case JOB_RELOAD:
                 return
-                        b == UNIT_ACTIVE_RELOADING;
+                        b == UNIT_RELOADING;
 
         case JOB_RELOAD_OR_START:
                 return
                         b == UNIT_ACTIVATING ||
-                        b == UNIT_ACTIVE_RELOADING;
+                        b == UNIT_RELOADING;
 
         case JOB_RESTART:
                 return
@@ -416,7 +416,7 @@ int job_run_and_invalidate(Job *j) {
 
                 case JOB_RESTART: {
                         UnitActiveState t = unit_active_state(j->unit);
-                        if (t == UNIT_INACTIVE || t == UNIT_INACTIVE_MAINTENANCE || t == UNIT_ACTIVATING) {
+                        if (t == UNIT_INACTIVE || t == UNIT_MAINTENANCE || t == UNIT_ACTIVATING) {
                                 j->type = JOB_START;
                                 r = unit_start(j->unit);
                         } else
@@ -426,7 +426,7 @@ int job_run_and_invalidate(Job *j) {
 
                 case JOB_TRY_RESTART: {
                         UnitActiveState t = unit_active_state(j->unit);
-                        if (t == UNIT_INACTIVE || t == UNIT_INACTIVE_MAINTENANCE || t == UNIT_DEACTIVATING)
+                        if (t == UNIT_INACTIVE || t == UNIT_MAINTENANCE || t == UNIT_DEACTIVATING)
                                 r = -ENOEXEC;
                         else if (t == UNIT_ACTIVATING) {
                                 j->type = JOB_START;
index f0336163ace7ffa7f885f58553f2503b6d597938..86c5b0a8cf1b2e474f92d401b35db9ca28703a70 100644 (file)
@@ -42,15 +42,15 @@ static const UnitActiveState state_translation_table[_MOUNT_STATE_MAX] = {
         [MOUNT_MOUNTING] = UNIT_ACTIVATING,
         [MOUNT_MOUNTING_DONE] = UNIT_ACTIVE,
         [MOUNT_MOUNTED] = UNIT_ACTIVE,
-        [MOUNT_REMOUNTING] = UNIT_ACTIVE_RELOADING,
+        [MOUNT_REMOUNTING] = UNIT_RELOADING,
         [MOUNT_UNMOUNTING] = UNIT_DEACTIVATING,
         [MOUNT_MOUNTING_SIGTERM] = UNIT_DEACTIVATING,
         [MOUNT_MOUNTING_SIGKILL] = UNIT_DEACTIVATING,
-        [MOUNT_REMOUNTING_SIGTERM] = UNIT_ACTIVE_RELOADING,
-        [MOUNT_REMOUNTING_SIGKILL] = UNIT_ACTIVE_RELOADING,
+        [MOUNT_REMOUNTING_SIGTERM] = UNIT_RELOADING,
+        [MOUNT_REMOUNTING_SIGKILL] = UNIT_RELOADING,
         [MOUNT_UNMOUNTING_SIGTERM] = UNIT_DEACTIVATING,
         [MOUNT_UNMOUNTING_SIGKILL] = UNIT_DEACTIVATING,
-        [MOUNT_MAINTENANCE] = UNIT_INACTIVE_MAINTENANCE
+        [MOUNT_MAINTENANCE] = UNIT_MAINTENANCE
 };
 
 static void mount_init(Unit *u) {
index 16ea08ddedca3445a3768587180310fe442905d3..80dc3c44d08f42fa3ff7494aad4c5b3bf333dbd1 100644 (file)
@@ -34,7 +34,7 @@ static const UnitActiveState state_translation_table[_PATH_STATE_MAX] = {
         [PATH_DEAD] = UNIT_INACTIVE,
         [PATH_WAITING] = UNIT_ACTIVE,
         [PATH_RUNNING] = UNIT_ACTIVE,
-        [PATH_MAINTENANCE] = UNIT_INACTIVE_MAINTENANCE
+        [PATH_MAINTENANCE] = UNIT_MAINTENANCE
 };
 
 static void path_done(Unit *u) {
index 3102acc0860d3d4516d4fbb18086abc5ac1aad35..d5e681a3f492051fdd70ec4e663828a28446d61d 100644 (file)
@@ -76,14 +76,14 @@ static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = {
         [SERVICE_START_POST] = UNIT_ACTIVATING,
         [SERVICE_RUNNING] = UNIT_ACTIVE,
         [SERVICE_EXITED] = UNIT_ACTIVE,
-        [SERVICE_RELOAD] = UNIT_ACTIVE_RELOADING,
+        [SERVICE_RELOAD] = UNIT_RELOADING,
         [SERVICE_STOP] = UNIT_DEACTIVATING,
         [SERVICE_STOP_SIGTERM] = UNIT_DEACTIVATING,
         [SERVICE_STOP_SIGKILL] = UNIT_DEACTIVATING,
         [SERVICE_STOP_POST] = UNIT_DEACTIVATING,
         [SERVICE_FINAL_SIGTERM] = UNIT_DEACTIVATING,
         [SERVICE_FINAL_SIGKILL] = UNIT_DEACTIVATING,
-        [SERVICE_MAINTENANCE] = UNIT_INACTIVE_MAINTENANCE,
+        [SERVICE_MAINTENANCE] = UNIT_MAINTENANCE,
         [SERVICE_AUTO_RESTART] = UNIT_ACTIVATING
 };
 
index 83f8ebe6ad3fa91d70271593f8ffbb242a5c4cde..7e62dbce9639d59f8ca7c37f07fbb21c9267424b 100644 (file)
@@ -50,7 +50,7 @@ static const UnitActiveState state_translation_table[_SOCKET_STATE_MAX] = {
         [SOCKET_STOP_POST] = UNIT_DEACTIVATING,
         [SOCKET_FINAL_SIGTERM] = UNIT_DEACTIVATING,
         [SOCKET_FINAL_SIGKILL] = UNIT_DEACTIVATING,
-        [SOCKET_MAINTENANCE] = UNIT_INACTIVE_MAINTENANCE
+        [SOCKET_MAINTENANCE] = UNIT_MAINTENANCE
 };
 
 static void socket_init(Unit *u) {
index e2afcc02eb4933c6b639c7062807d619d6dd63dc..2e3e995c3e6c6386185fedbea564b47dabf671ec 100644 (file)
@@ -38,7 +38,7 @@
 static const UnitActiveState state_translation_table[_SWAP_STATE_MAX] = {
         [SWAP_DEAD] = UNIT_INACTIVE,
         [SWAP_ACTIVE] = UNIT_ACTIVE,
-        [SWAP_MAINTENANCE] = UNIT_INACTIVE_MAINTENANCE
+        [SWAP_MAINTENANCE] = UNIT_MAINTENANCE
 };
 
 static void swap_init(Unit *u) {
index 96c6e8e8ed3affd0bbb554de7c97938baf4966b3..f0005f55ce364a9378f0e7d6800a5d39cb010e8d 100644 (file)
@@ -31,7 +31,7 @@ static const UnitActiveState state_translation_table[_TIMER_STATE_MAX] = {
         [TIMER_WAITING] = UNIT_ACTIVE,
         [TIMER_RUNNING] = UNIT_ACTIVE,
         [TIMER_ELAPSED] = UNIT_ACTIVE,
-        [TIMER_MAINTENANCE] = UNIT_INACTIVE_MAINTENANCE
+        [TIMER_MAINTENANCE] = UNIT_MAINTENANCE
 };
 
 static void timer_init(Unit *u) {
index 79b9e2bb8a0f8dc9563a6f6e42439e8bdb03a5fb..9fed5a0f4e81087ea17dc5c98f4af5163f19f0cb 100644 (file)
@@ -819,7 +819,7 @@ int unit_reload(Unit *u) {
                 return -EBADR;
 
         state = unit_active_state(u);
-        if (unit_active_state(u) == UNIT_ACTIVE_RELOADING)
+        if (unit_active_state(u) == UNIT_RELOADING)
                 return -EALREADY;
 
         if (unit_active_state(u) != UNIT_ACTIVE)
@@ -998,7 +998,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) {
                         if (u->meta.job->state == JOB_RUNNING) {
                                 if (ns == UNIT_ACTIVE)
                                         job_finish_and_invalidate(u->meta.job, true);
-                                else if (ns != UNIT_ACTIVATING && ns != UNIT_ACTIVE_RELOADING) {
+                                else if (ns != UNIT_ACTIVATING && ns != UNIT_RELOADING) {
                                         unexpected = true;
                                         job_finish_and_invalidate(u->meta.job, false);
                                 }
@@ -1012,7 +1012,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) {
 
                         if (ns == UNIT_INACTIVE)
                                 job_finish_and_invalidate(u->meta.job, true);
-                        else if (ns == UNIT_INACTIVE_MAINTENANCE)
+                        else if (ns == UNIT_MAINTENANCE)
                                 job_finish_and_invalidate(u->meta.job, false);
                         else if (u->meta.job->state == JOB_RUNNING && ns != UNIT_DEACTIVATING) {
                                 unexpected = true;
@@ -1964,9 +1964,9 @@ DEFINE_STRING_TABLE_LOOKUP(unit_load_state, UnitLoadState);
 
 static const char* const unit_active_state_table[_UNIT_ACTIVE_STATE_MAX] = {
         [UNIT_ACTIVE] = "active",
-        [UNIT_ACTIVE_RELOADING] = "active-reloading",
+        [UNIT_RELOADING] = "reloading",
         [UNIT_INACTIVE] = "inactive",
-        [UNIT_INACTIVE_MAINTENANCE] = "inactive-maintenance",
+        [UNIT_MAINTENANCE] = "maintenance",
         [UNIT_ACTIVATING] = "activating",
         [UNIT_DEACTIVATING] = "deactivating"
 };
index 03031892d0f33f8b5477218d01db5a18a356603e..aa80aadb1b79d2bb88f76c716fcd764ba9b3afe8 100644 (file)
@@ -78,9 +78,9 @@ enum UnitLoadState {
 
 enum UnitActiveState {
         UNIT_ACTIVE,
-        UNIT_ACTIVE_RELOADING,
+        UNIT_RELOADING,
         UNIT_INACTIVE,
-        UNIT_INACTIVE_MAINTENANCE,
+        UNIT_MAINTENANCE,
         UNIT_ACTIVATING,
         UNIT_DEACTIVATING,
         _UNIT_ACTIVE_STATE_MAX,
@@ -88,19 +88,19 @@ enum UnitActiveState {
 };
 
 static inline bool UNIT_IS_ACTIVE_OR_RELOADING(UnitActiveState t) {
-        return t == UNIT_ACTIVE || t == UNIT_ACTIVE_RELOADING;
+        return t == UNIT_ACTIVE || t == UNIT_RELOADING;
 }
 
 static inline bool UNIT_IS_ACTIVE_OR_ACTIVATING(UnitActiveState t) {
-        return t == UNIT_ACTIVE || t == UNIT_ACTIVATING || t == UNIT_ACTIVE_RELOADING;
+        return t == UNIT_ACTIVE || t == UNIT_ACTIVATING || t == UNIT_RELOADING;
 }
 
 static inline bool UNIT_IS_INACTIVE_OR_DEACTIVATING(UnitActiveState t) {
-        return t == UNIT_INACTIVE || t == UNIT_INACTIVE_MAINTENANCE || t == UNIT_DEACTIVATING;
+        return t == UNIT_INACTIVE || t == UNIT_MAINTENANCE || t == UNIT_DEACTIVATING;
 }
 
 static inline bool UNIT_IS_INACTIVE_OR_MAINTENANCE(UnitActiveState t) {
-        return t == UNIT_INACTIVE || t == UNIT_INACTIVE_MAINTENANCE;
+        return t == UNIT_INACTIVE || t == UNIT_MAINTENANCE;
 }
 
 enum UnitDependency {