chiark / gitweb /
service: rename StartLimitAction enum to FailureAction
authorMichael Olbrich <m.olbrich@pengutronix.de>
Thu, 24 Apr 2014 07:35:38 +0000 (09:35 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 24 Apr 2014 18:11:20 +0000 (20:11 +0200)
It's used for the FailureAction property as well.

src/core/dbus-service.c
src/core/load-fragment-gperf.gperf.m4
src/core/load-fragment.c
src/core/load-fragment.h
src/core/service.c
src/core/service.h
src/test/test-tables.c

index 2f9c25a48a1e64f73956260f072d19ff425cfcc0..093289fdf676bd061344daaeea11f3065fb0f446 100644 (file)
@@ -34,7 +34,7 @@ static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_type, service_type, ServiceType
 static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_result, service_result, ServiceResult);
 static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_restart, service_restart, ServiceRestart);
 static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_notify_access, notify_access, NotifyAccess);
-static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_start_limit_action, start_limit_action, StartLimitAction);
+static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_failure_action, failure_action, FailureAction);
 
 const sd_bus_vtable bus_service_vtable[] = {
         SD_BUS_VTABLE_START(0),
@@ -49,9 +49,9 @@ const sd_bus_vtable bus_service_vtable[] = {
         BUS_PROPERTY_DUAL_TIMESTAMP("WatchdogTimestamp", offsetof(Service, watchdog_timestamp), 0),
         SD_BUS_PROPERTY("StartLimitInterval", "t", bus_property_get_usec, offsetof(Service, start_limit.interval), SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_PROPERTY("StartLimitBurst", "u", bus_property_get_unsigned, offsetof(Service, start_limit.burst), SD_BUS_VTABLE_PROPERTY_CONST),
-        SD_BUS_PROPERTY("StartLimitAction", "s", property_get_start_limit_action, offsetof(Service, start_limit_action), SD_BUS_VTABLE_PROPERTY_CONST),
+        SD_BUS_PROPERTY("StartLimitAction", "s", property_get_failure_action, offsetof(Service, start_limit_action), SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_PROPERTY("RebootArgument", "s", NULL, offsetof(Service, reboot_arg), SD_BUS_VTABLE_PROPERTY_CONST),
-        SD_BUS_PROPERTY("FailureAction", "s", property_get_start_limit_action, offsetof(Service, failure_action), SD_BUS_VTABLE_PROPERTY_CONST),
+        SD_BUS_PROPERTY("FailureAction", "s", property_get_failure_action, offsetof(Service, failure_action), SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_PROPERTY("PermissionsStartOnly", "b", bus_property_get_bool, offsetof(Service, permissions_start_only), SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_PROPERTY("RootDirectoryStartOnly", "b", bus_property_get_bool, offsetof(Service, root_directory_start_only), SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_PROPERTY("RemainAfterExit", "b", bus_property_get_bool, offsetof(Service, remain_after_exit), SD_BUS_VTABLE_PROPERTY_CONST),
index da6df5ca3c6b0580e2a234b810b1309d4d5f3f0d..b8d873894fdffda8bdd93b160b01715704f0ddc1 100644 (file)
@@ -179,9 +179,9 @@ Service.TimeoutStopSec,          config_parse_service_timeout,       0,
 Service.WatchdogSec,             config_parse_sec,                   0,                             offsetof(Service, watchdog_usec)
 Service.StartLimitInterval,      config_parse_sec,                   0,                             offsetof(Service, start_limit.interval)
 Service.StartLimitBurst,         config_parse_unsigned,              0,                             offsetof(Service, start_limit.burst)
-Service.StartLimitAction,        config_parse_start_limit_action,    0,                             offsetof(Service, start_limit_action)
+Service.StartLimitAction,        config_parse_failure_action,        0,                             offsetof(Service, start_limit_action)
 Service.RebootArgument,          config_parse_string,                0,                             offsetof(Service, reboot_arg)
-Service.FailureAction,           config_parse_start_limit_action,    0,                             offsetof(Service, failure_action)
+Service.FailureAction,           config_parse_failure_action,        0,                             offsetof(Service, failure_action)
 Service.Type,                    config_parse_service_type,          0,                             offsetof(Service, type)
 Service.Restart,                 config_parse_service_restart,       0,                             offsetof(Service, restart)
 Service.PermissionsStartOnly,    config_parse_bool,                  0,                             offsetof(Service, permissions_start_only)
index c604f9096d0e4d33e48830e90134db6c95802ac9..6c92935d0a7bf23b9017c593ce69b0524de4f772 100644 (file)
@@ -2000,7 +2000,7 @@ int config_parse_unit_condition_null(const char *unit,
 }
 
 DEFINE_CONFIG_PARSE_ENUM(config_parse_notify_access, notify_access, NotifyAccess, "Failed to parse notify access specifier");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_start_limit_action, start_limit_action, StartLimitAction, "Failed to parse start limit action specifier");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_failure_action, failure_action, FailureAction, "Failed to parse failure action specifier");
 
 int config_parse_unit_requires_mounts_for(
                 const char *unit,
@@ -3387,7 +3387,7 @@ void unit_dump_config_items(FILE *f) {
                 { config_parse_unit_slice,            "SLICE" },
                 { config_parse_documentation,         "URL" },
                 { config_parse_service_timeout,       "SECONDS" },
-                { config_parse_start_limit_action,    "ACTION" },
+                { config_parse_failure_action,        "ACTION" },
                 { config_parse_set_status,            "STATUS" },
                 { config_parse_service_sockets,       "SOCKETS" },
                 { config_parse_environ,               "ENVIRON" },
index 35138514f3b6a895d26c4446908ae1f24f0b0d4a..0f3c0c7a77e7b675b972673f4b4327637919a725 100644 (file)
@@ -72,7 +72,7 @@ int config_parse_unit_condition_string(const char *unit, const char *filename, u
 int config_parse_unit_condition_null(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
 int config_parse_kill_mode(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
 int config_parse_notify_access(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_start_limit_action(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
+int config_parse_failure_action(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
 int config_parse_unit_requires_mounts_for(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
 int config_parse_syscall_filter(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
 int config_parse_syscall_archs(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
index 593237a0ad2c144c56d719ab5f3b4111ecb65885..694a2658e9744beeb7ecff0031daa8a72d8c91b9 100644 (file)
@@ -1840,7 +1840,7 @@ static int cgroup_good(Service *s) {
         return !r;
 }
 
-static int service_execute_action(Service *s, StartLimitAction action, const char *reason, bool log_action_none);
+static int service_execute_action(Service *s, FailureAction action, const char *reason, bool log_action_none);
 
 static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart) {
         int r;
@@ -2376,22 +2376,22 @@ fail:
         service_enter_stop(s, SERVICE_FAILURE_RESOURCES);
 }
 
-static int service_execute_action(Service *s, StartLimitAction action, const char *reason, bool log_action_none) {
+static int service_execute_action(Service *s, FailureAction action, const char *reason, bool log_action_none) {
         assert(s);
 
-        if (action == SERVICE_START_LIMIT_REBOOT ||
-            action == SERVICE_START_LIMIT_REBOOT_FORCE)
+        if (action == SERVICE_FAILURE_ACTION_REBOOT ||
+            action == SERVICE_FAILURE_ACTION_REBOOT_FORCE)
                 update_reboot_param_file(s->reboot_arg);
 
         switch (action) {
 
-        case SERVICE_START_LIMIT_NONE:
+        case SERVICE_FAILURE_ACTION_NONE:
                 if (log_action_none)
                         log_warning_unit(UNIT(s)->id,
                                          "%s %s, refusing to start.", UNIT(s)->id, reason);
                 break;
 
-        case SERVICE_START_LIMIT_REBOOT: {
+        case SERVICE_FAILURE_ACTION_REBOOT: {
                 _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
                 int r;
 
@@ -2408,13 +2408,13 @@ static int service_execute_action(Service *s, StartLimitAction action, const cha
                 break;
         }
 
-        case SERVICE_START_LIMIT_REBOOT_FORCE:
+        case SERVICE_FAILURE_ACTION_REBOOT_FORCE:
                 log_warning_unit(UNIT(s)->id,
                                  "%s %s, forcibly rebooting.", UNIT(s)->id, reason);
                 UNIT(s)->manager->exit_code = MANAGER_REBOOT;
                 break;
 
-        case SERVICE_START_LIMIT_REBOOT_IMMEDIATE:
+        case SERVICE_FAILURE_ACTION_REBOOT_IMMEDIATE:
                 log_warning_unit(UNIT(s)->id,
                                  "%s %s, rebooting immediately.", UNIT(s)->id, reason);
                 sync();
@@ -2430,8 +2430,8 @@ static int service_execute_action(Service *s, StartLimitAction action, const cha
 
         default:
                 log_error_unit(UNIT(s)->id,
-                               "start limit action=%i", action);
-                assert_not_reached("Unknown StartLimitAction.");
+                               "failure action=%i", action);
+                assert_not_reached("Unknown FailureAction.");
         }
 
         return -ECANCELED;
@@ -3832,13 +3832,13 @@ static const char* const service_result_table[_SERVICE_RESULT_MAX] = {
 
 DEFINE_STRING_TABLE_LOOKUP(service_result, ServiceResult);
 
-static const char* const start_limit_action_table[_SERVICE_START_LIMIT_MAX] = {
-        [SERVICE_START_LIMIT_NONE] = "none",
-        [SERVICE_START_LIMIT_REBOOT] = "reboot",
-        [SERVICE_START_LIMIT_REBOOT_FORCE] = "reboot-force",
-        [SERVICE_START_LIMIT_REBOOT_IMMEDIATE] = "reboot-immediate"
+static const char* const failure_action_table[_SERVICE_FAILURE_ACTION_MAX] = {
+        [SERVICE_FAILURE_ACTION_NONE] = "none",
+        [SERVICE_FAILURE_ACTION_REBOOT] = "reboot",
+        [SERVICE_FAILURE_ACTION_REBOOT_FORCE] = "reboot-force",
+        [SERVICE_FAILURE_ACTION_REBOOT_IMMEDIATE] = "reboot-immediate"
 };
-DEFINE_STRING_TABLE_LOOKUP(start_limit_action, StartLimitAction);
+DEFINE_STRING_TABLE_LOOKUP(failure_action, FailureAction);
 
 const UnitVTable service_vtable = {
         .object_size = sizeof(Service),
index 13b2b064c0b5458f408a6a943193b2f3675bd748..2254c3e0bf0077baded097b5adbf14c416563f13 100644 (file)
@@ -103,14 +103,14 @@ typedef enum ServiceResult {
         _SERVICE_RESULT_INVALID = -1
 } ServiceResult;
 
-typedef enum StartLimitAction {
-        SERVICE_START_LIMIT_NONE,
-        SERVICE_START_LIMIT_REBOOT,
-        SERVICE_START_LIMIT_REBOOT_FORCE,
-        SERVICE_START_LIMIT_REBOOT_IMMEDIATE,
-        _SERVICE_START_LIMIT_MAX,
-        _SERVICE_START_LIMIT_INVALID = -1
-} StartLimitAction;
+typedef enum FailureAction {
+        SERVICE_FAILURE_ACTION_NONE,
+        SERVICE_FAILURE_ACTION_REBOOT,
+        SERVICE_FAILURE_ACTION_REBOOT_FORCE,
+        SERVICE_FAILURE_ACTION_REBOOT_IMMEDIATE,
+        _SERVICE_FAILURE_ACTION_MAX,
+        _SERVICE_FAILURE_ACTION_INVALID = -1
+} FailureAction;
 
 struct Service {
         Unit meta;
@@ -187,10 +187,10 @@ struct Service {
 
         char *status_text;
 
-        StartLimitAction failure_action;
+        FailureAction failure_action;
 
         RateLimit start_limit;
-        StartLimitAction start_limit_action;
+        FailureAction start_limit_action;
         char *reboot_arg;
 
         UnitRef accept_socket;
@@ -225,5 +225,5 @@ NotifyAccess notify_access_from_string(const char *s) _pure_;
 const char* service_result_to_string(ServiceResult i) _const_;
 ServiceResult service_result_from_string(const char *s) _pure_;
 
-const char* start_limit_action_to_string(StartLimitAction i) _const_;
-StartLimitAction start_limit_action_from_string(const char *s) _pure_;
+const char* failure_action_to_string(FailureAction i) _const_;
+FailureAction failure_action_from_string(const char *s) _pure_;
index dff6431b6dc9ae5b9eff297197aafd795e1d3a93..fb751d13bd94376e629bba969a7fc0280f968aff 100644 (file)
@@ -82,7 +82,7 @@ int main(int argc, char **argv) {
         test_table(socket_exec_command, SOCKET_EXEC_COMMAND);
         test_table(socket_result, SOCKET_RESULT);
         test_table(socket_state, SOCKET_STATE);
-        test_table(start_limit_action, SERVICE_START_LIMIT);
+        test_table(failure_action, SERVICE_FAILURE_ACTION);
         test_table(swap_exec_command, SWAP_EXEC_COMMAND);
         test_table(swap_result, SWAP_RESULT);
         test_table(swap_state, SWAP_STATE);