]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Move UnitActiveState to basic/
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 28 Sep 2015 17:22:02 +0000 (13:22 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 28 Sep 2015 19:09:34 +0000 (15:09 -0400)
Preparation to allow systemctl to query the list of unit states.

src/basic/unit-name.c
src/basic/unit-name.h
src/core/unit.c
src/core/unit.h

index 8742ee757f26c3b7c5362d7b89ff2da9006b44a5..d132dcd1739eea4a226ace4e140ff08ef625d54d 100644 (file)
@@ -839,6 +839,17 @@ static const char* const unit_load_state_table[_UNIT_LOAD_STATE_MAX] = {
 
 DEFINE_STRING_TABLE_LOOKUP(unit_load_state, UnitLoadState);
 
+static const char* const unit_active_state_table[_UNIT_ACTIVE_STATE_MAX] = {
+        [UNIT_ACTIVE] = "active",
+        [UNIT_RELOADING] = "reloading",
+        [UNIT_INACTIVE] = "inactive",
+        [UNIT_FAILED] = "failed",
+        [UNIT_ACTIVATING] = "activating",
+        [UNIT_DEACTIVATING] = "deactivating"
+};
+
+DEFINE_STRING_TABLE_LOOKUP(unit_active_state, UnitActiveState);
+
 static const char* const unit_dependency_table[_UNIT_DEPENDENCY_MAX] = {
         [UNIT_REQUIRES] = "Requires",
         [UNIT_REQUIRES_OVERRIDABLE] = "RequiresOverridable",
index 28b3a555f3693354962315bd1ca0bdac2737a3e6..b6835975276c32016d46d23ab403d2a2be07eea7 100644 (file)
@@ -29,6 +29,7 @@
 
 typedef enum UnitType UnitType;
 typedef enum UnitLoadState UnitLoadState;
+typedef enum UnitActiveState UnitActiveState;
 typedef enum UnitDependency UnitDependency;
 
 enum UnitType {
@@ -60,6 +61,17 @@ enum UnitLoadState {
         _UNIT_LOAD_STATE_INVALID = -1
 };
 
+enum UnitActiveState {
+        UNIT_ACTIVE,
+        UNIT_RELOADING,
+        UNIT_INACTIVE,
+        UNIT_FAILED,
+        UNIT_ACTIVATING,
+        UNIT_DEACTIVATING,
+        _UNIT_ACTIVE_STATE_MAX,
+        _UNIT_ACTIVE_STATE_INVALID = -1
+};
+
 enum UnitDependency {
         /* Positive dependencies */
         UNIT_REQUIRES,
@@ -176,5 +188,8 @@ UnitType unit_type_from_string(const char *s) _pure_;
 const char *unit_load_state_to_string(UnitLoadState i) _const_;
 UnitLoadState unit_load_state_from_string(const char *s) _pure_;
 
+const char *unit_active_state_to_string(UnitActiveState i) _const_;
+UnitActiveState unit_active_state_from_string(const char *s) _pure_;
+
 const char *unit_dependency_to_string(UnitDependency i) _const_;
 UnitDependency unit_dependency_from_string(const char *s) _pure_;
index 3a6313e4a28afc270a6bce4a47e92128ef6bef68..9cc48a89823f12c75b2ab89cdced1bf2e5cc939f 100644 (file)
@@ -3729,14 +3729,3 @@ int unit_fail_if_symlink(Unit *u, const char* where) {
 
         return -ELOOP;
 }
-
-static const char* const unit_active_state_table[_UNIT_ACTIVE_STATE_MAX] = {
-        [UNIT_ACTIVE] = "active",
-        [UNIT_RELOADING] = "reloading",
-        [UNIT_INACTIVE] = "inactive",
-        [UNIT_FAILED] = "failed",
-        [UNIT_ACTIVATING] = "activating",
-        [UNIT_DEACTIVATING] = "deactivating"
-};
-
-DEFINE_STRING_TABLE_LOOKUP(unit_active_state, UnitActiveState);
index c868d75c7932b28cc34fdd1d9c36640ddab4920e..e8d5f86eca03d5ed7bdb8de05bc01f96a6824b58 100644 (file)
@@ -27,7 +27,6 @@
 
 typedef struct Unit Unit;
 typedef struct UnitVTable UnitVTable;
-typedef enum UnitActiveState UnitActiveState;
 typedef struct UnitRef UnitRef;
 typedef struct UnitStatusMessageFormats UnitStatusMessageFormats;
 
@@ -37,17 +36,6 @@ typedef struct UnitStatusMessageFormats UnitStatusMessageFormats;
 #include "unit-name.h"
 #include "failure-action.h"
 
-enum UnitActiveState {
-        UNIT_ACTIVE,
-        UNIT_RELOADING,
-        UNIT_INACTIVE,
-        UNIT_FAILED,
-        UNIT_ACTIVATING,
-        UNIT_DEACTIVATING,
-        _UNIT_ACTIVE_STATE_MAX,
-        _UNIT_ACTIVE_STATE_INVALID = -1
-};
-
 typedef enum KillOperation {
         KILL_TERMINATE,
         KILL_KILL,
@@ -617,9 +605,6 @@ static inline bool unit_supported(Unit *u) {
 void unit_warn_if_dir_nonempty(Unit *u, const char* where);
 int unit_fail_if_symlink(Unit *u, const char* where);
 
-const char *unit_active_state_to_string(UnitActiveState i) _const_;
-UnitActiveState unit_active_state_from_string(const char *s) _pure_;
-
 /* Macros which append UNIT= or USER_UNIT= to the message */
 
 #define log_unit_full(unit, level, error, ...)                          \