summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2014-04-24 09:35:38 +0200
committerLennart Poettering <lennart@poettering.net>2014-04-24 20:11:20 +0200
commitbf500566323bbc2240d1fdd1165a8c908faf4098 (patch)
tree98925b366ca0b6972194ef81e707cc114c9d9c4b /src
parent93ae25e6fd62b2f87c3dd9ad3e81934eecc48057 (diff)
service: rename StartLimitAction enum to FailureAction
It's used for the FailureAction property as well.
Diffstat (limited to 'src')
-rw-r--r--src/core/dbus-service.c6
-rw-r--r--src/core/load-fragment-gperf.gperf.m44
-rw-r--r--src/core/load-fragment.c4
-rw-r--r--src/core/load-fragment.h2
-rw-r--r--src/core/service.c32
-rw-r--r--src/core/service.h24
-rw-r--r--src/test/test-tables.c2
7 files changed, 37 insertions, 37 deletions
diff --git a/src/core/dbus-service.c b/src/core/dbus-service.c
index 2f9c25a48a..093289fdf6 100644
--- a/src/core/dbus-service.c
+++ b/src/core/dbus-service.c
@@ -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),
diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4
index da6df5ca3c..b8d873894f 100644
--- a/src/core/load-fragment-gperf.gperf.m4
+++ b/src/core/load-fragment-gperf.gperf.m4
@@ -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)
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index c604f9096d..6c92935d0a 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -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" },
diff --git a/src/core/load-fragment.h b/src/core/load-fragment.h
index 35138514f3..0f3c0c7a77 100644
--- a/src/core/load-fragment.h
+++ b/src/core/load-fragment.h
@@ -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);
diff --git a/src/core/service.c b/src/core/service.c
index 593237a0ad..694a2658e9 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -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),
diff --git a/src/core/service.h b/src/core/service.h
index 13b2b064c0..2254c3e0bf 100644
--- a/src/core/service.h
+++ b/src/core/service.h
@@ -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_;
diff --git a/src/test/test-tables.c b/src/test/test-tables.c
index dff6431b6d..fb751d13bd 100644
--- a/src/test/test-tables.c
+++ b/src/test/test-tables.c
@@ -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);