From: Matthew Miller Date: Mon, 30 Aug 2010 22:23:34 +0000 (+0200) Subject: manager: add missing second part of s/maintenance/failed/ X-Git-Tag: v9~27 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fdf20a316035779bbec469e11d73c7544acbf30f;p=systemd manager: add missing second part of s/maintenance/failed/ --- diff --git a/src/dbus-manager.c b/src/dbus-manager.c index 9b0a6002..cffa5476 100644 --- a/src/dbus-manager.c +++ b/src/dbus-manager.c @@ -76,7 +76,7 @@ " \n" \ " \n" \ " \n" \ - " \n" \ + " \n" \ " \n" \ " \n" \ " \n" \ @@ -84,7 +84,7 @@ " \n" \ " \n" \ " \n" \ - " \n" \ + " \n" \ " \n" \ " \n" \ " \n" \ @@ -403,14 +403,14 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, if (!(reply = dbus_message_new_method_return(message))) goto oom; - } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "ResetMaintenance")) { + } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "ResetFailed")) { - manager_reset_maintenance(m); + manager_reset_failed(m); if (!(reply = dbus_message_new_method_return(message))) goto oom; - } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "ResetMaintenanceUnit")) { + } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "ResetFailedUnit")) { const char *name; Unit *u; @@ -426,7 +426,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, return bus_send_error_reply(m, connection, message, &error, -ENOENT); } - unit_reset_maintenance(u); + unit_reset_failed(u); if (!(reply = dbus_message_new_method_return(message))) goto oom; diff --git a/src/dbus-unit.c b/src/dbus-unit.c index eab816ac..b65481d1 100644 --- a/src/dbus-unit.c +++ b/src/dbus-unit.c @@ -367,9 +367,9 @@ static DBusHandlerResult bus_unit_message_dispatch(Unit *u, DBusConnection *conn } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Unit", "ReloadOrTryRestart")) { reload_if_possible = true; job_type = JOB_TRY_RESTART; - } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Unit", "ResetMaintenance")) { + } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Unit", "ResetFailed")) { - unit_reset_maintenance(u); + unit_reset_failed(u); if (!(reply = dbus_message_new_method_return(message))) goto oom; diff --git a/src/dbus-unit.h b/src/dbus-unit.h index 6e3726d7..16a7247d 100644 --- a/src/dbus-unit.h +++ b/src/dbus-unit.h @@ -56,7 +56,7 @@ " \n" \ " \n" \ " \n" \ - " \n" \ + " \n" \ " \n" \ " \n" \ " \n" \ diff --git a/src/job.c b/src/job.c index 98c94e43..7b20987c 100644 --- a/src/job.c +++ b/src/job.c @@ -271,7 +271,7 @@ bool job_type_is_redundant(JobType a, UnitActiveState b) { case JOB_STOP: return b == UNIT_INACTIVE || - b == UNIT_MAINTENANCE; + b == UNIT_FAILED; case JOB_VERIFY_ACTIVE: return @@ -417,7 +417,7 @@ int job_run_and_invalidate(Job *j) { case JOB_RESTART: { UnitActiveState t = unit_active_state(j->unit); - if (t == UNIT_INACTIVE || t == UNIT_MAINTENANCE || t == UNIT_ACTIVATING) { + if (t == UNIT_INACTIVE || t == UNIT_FAILED || t == UNIT_ACTIVATING) { j->type = JOB_START; r = unit_start(j->unit); } else @@ -427,7 +427,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_MAINTENANCE || t == UNIT_DEACTIVATING) + if (t == UNIT_INACTIVE || t == UNIT_FAILED || t == UNIT_DEACTIVATING) r = -ENOEXEC; else if (t == UNIT_ACTIVATING) { j->type = JOB_START; diff --git a/src/manager.c b/src/manager.c index eada82a2..c22aa3ec 100644 --- a/src/manager.c +++ b/src/manager.c @@ -1397,12 +1397,12 @@ static int transaction_add_job_and_dependencies( assert(type < _JOB_TYPE_MAX); assert(unit); - if (unit->meta.load_state != UNIT_LOADED && unit->meta.load_state != UNIT_FAILED) { + if (unit->meta.load_state != UNIT_LOADED && unit->meta.load_state != UNIT_ERROR) { dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s is not loaded properly.", unit->meta.id); return -EINVAL; } - if (type != JOB_STOP && unit->meta.load_state == UNIT_FAILED) { + if (type != JOB_STOP && unit->meta.load_state == UNIT_ERROR) { dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s failed to load: %s. You might find more information in the logs.", unit->meta.id, strerror(-unit->meta.load_error)); @@ -1496,7 +1496,7 @@ static int transaction_add_isolate_jobs(Manager *m) { continue; /* No need to stop inactive jobs */ - if (UNIT_IS_INACTIVE_OR_MAINTENANCE(unit_active_state(u))) + if (UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(u))) continue; /* Is there already something listed for this? */ @@ -2552,14 +2552,14 @@ bool manager_is_booting_or_shutting_down(Manager *m) { return false; } -void manager_reset_maintenance(Manager *m) { +void manager_reset_failed(Manager *m) { Unit *u; Iterator i; assert(m); HASHMAP_FOREACH(u, m->units, i) - unit_reset_maintenance(u); + unit_reset_failed(u); } int manager_set_console(Manager *m, const char *console) { diff --git a/src/manager.h b/src/manager.h index 6186cb23..77c20764 100644 --- a/src/manager.h +++ b/src/manager.h @@ -255,7 +255,7 @@ int manager_reload(Manager *m); bool manager_is_booting_or_shutting_down(Manager *m); -void manager_reset_maintenance(Manager *m); +void manager_reset_failed(Manager *m); void manager_send_unit_audit(Manager *m, Unit *u, int type, bool success); diff --git a/src/mount.c b/src/mount.c index 5d5857f5..2b6274eb 100644 --- a/src/mount.c +++ b/src/mount.c @@ -50,7 +50,7 @@ static const UnitActiveState state_translation_table[_MOUNT_STATE_MAX] = { [MOUNT_REMOUNTING_SIGKILL] = UNIT_RELOADING, [MOUNT_UNMOUNTING_SIGTERM] = UNIT_DEACTIVATING, [MOUNT_UNMOUNTING_SIGKILL] = UNIT_DEACTIVATING, - [MOUNT_MAINTENANCE] = UNIT_MAINTENANCE + [MOUNT_FAILED] = UNIT_FAILED }; static void mount_init(Unit *u) { @@ -468,7 +468,7 @@ static void mount_set_state(Mount *m, MountState state) { state == MOUNT_REMOUNTING_SIGKILL || state == MOUNT_UNMOUNTING_SIGTERM || state == MOUNT_UNMOUNTING_SIGKILL || - state == MOUNT_MAINTENANCE) + state == MOUNT_FAILED) mount_notify_automount(m, -ENODEV); if (state != old_state) @@ -608,7 +608,7 @@ static void mount_enter_dead(Mount *m, bool success) { if (!success) m->failure = true; - mount_set_state(m, m->failure ? MOUNT_MAINTENANCE : MOUNT_DEAD); + mount_set_state(m, m->failure ? MOUNT_FAILED : MOUNT_DEAD); } static void mount_enter_mounted(Mount *m, bool success) { @@ -839,7 +839,7 @@ static int mount_start(Unit *u) { m->state == MOUNT_MOUNTING_SIGKILL) return 0; - assert(m->state == MOUNT_DEAD || m->state == MOUNT_MAINTENANCE); + assert(m->state == MOUNT_DEAD || m->state == MOUNT_FAILED); m->failure = false; mount_enter_mounting(m); @@ -1507,7 +1507,7 @@ void mount_fd_event(Manager *m, int events) { switch (mount->state) { case MOUNT_DEAD: - case MOUNT_MAINTENANCE: + case MOUNT_FAILED: mount_enter_mounted(mount, true); break; @@ -1531,12 +1531,12 @@ void mount_fd_event(Manager *m, int events) { } } -static void mount_reset_maintenance(Unit *u) { +static void mount_reset_failed(Unit *u) { Mount *m = MOUNT(u); assert(m); - if (m->state == MOUNT_MAINTENANCE) + if (m->state == MOUNT_FAILED) mount_set_state(m, MOUNT_DEAD); m->failure = false; @@ -1555,7 +1555,7 @@ static const char* const mount_state_table[_MOUNT_STATE_MAX] = { [MOUNT_REMOUNTING_SIGKILL] = "remounting-sigkill", [MOUNT_UNMOUNTING_SIGTERM] = "unmounting-sigterm", [MOUNT_UNMOUNTING_SIGKILL] = "unmounting-sigkill", - [MOUNT_MAINTENANCE] = "maintenance" + [MOUNT_FAILED] = "failed" }; DEFINE_STRING_TABLE_LOOKUP(mount_state, MountState); @@ -1599,7 +1599,7 @@ const UnitVTable mount_vtable = { .sigchld_event = mount_sigchld_event, .timer_event = mount_timer_event, - .reset_maintenance = mount_reset_maintenance, + .reset_failed = mount_reset_failed, .bus_interface = "org.freedesktop.systemd1.Mount", .bus_message_handler = bus_mount_message_handler, diff --git a/src/mount.h b/src/mount.h index 920a70df..8d8c738b 100644 --- a/src/mount.h +++ b/src/mount.h @@ -39,7 +39,7 @@ typedef enum MountState { MOUNT_REMOUNTING_SIGKILL, MOUNT_UNMOUNTING_SIGTERM, MOUNT_UNMOUNTING_SIGKILL, - MOUNT_MAINTENANCE, + MOUNT_FAILED, _MOUNT_STATE_MAX, _MOUNT_STATE_INVALID = -1 } MountState; diff --git a/src/path.c b/src/path.c index 42c64f3e..7a871246 100644 --- a/src/path.c +++ b/src/path.c @@ -36,7 +36,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_MAINTENANCE + [PATH_FAILED] = UNIT_FAILED }; static void path_done(Unit *u) { @@ -301,7 +301,7 @@ static void path_enter_dead(Path *p, bool success) { if (!success) p->failure = true; - path_set_state(p, p->failure ? PATH_MAINTENANCE : PATH_DEAD); + path_set_state(p, p->failure ? PATH_FAILED : PATH_DEAD); } static void path_enter_running(Path *p) { @@ -383,7 +383,7 @@ static int path_start(Unit *u) { Path *p = PATH(u); assert(p); - assert(p->state == PATH_DEAD || p->state == PATH_MAINTENANCE); + assert(p->state == PATH_DEAD || p->state == PATH_FAILED); if (p->unit->meta.load_state != UNIT_LOADED) return -ENOENT; @@ -556,12 +556,12 @@ fail: log_error("Failed find path unit: %s", strerror(-r)); } -static void path_reset_maintenance(Unit *u) { +static void path_reset_failed(Unit *u) { Path *p = PATH(u); assert(p); - if (p->state == PATH_MAINTENANCE) + if (p->state == PATH_FAILED) path_set_state(p, PATH_DEAD); p->failure = false; @@ -571,7 +571,7 @@ static const char* const path_state_table[_PATH_STATE_MAX] = { [PATH_DEAD] = "dead", [PATH_WAITING] = "waiting", [PATH_RUNNING] = "running", - [PATH_MAINTENANCE] = "maintenance" + [PATH_FAILED] = "failed" }; DEFINE_STRING_TABLE_LOOKUP(path_state, PathState); @@ -605,7 +605,7 @@ const UnitVTable path_vtable = { .fd_event = path_fd_event, - .reset_maintenance = path_reset_maintenance, + .reset_failed = path_reset_failed, .bus_interface = "org.freedesktop.systemd1.Path", .bus_message_handler = bus_path_message_handler diff --git a/src/path.h b/src/path.h index 87fa0d17..ea2331c2 100644 --- a/src/path.h +++ b/src/path.h @@ -31,7 +31,7 @@ typedef enum PathState { PATH_DEAD, PATH_WAITING, PATH_RUNNING, - PATH_MAINTENANCE, + PATH_FAILED, _PATH_STATE_MAX, _PATH_STATE_INVALID = -1 } PathState; diff --git a/src/service.c b/src/service.c index 56c85025..88992eb4 100644 --- a/src/service.c +++ b/src/service.c @@ -95,7 +95,7 @@ static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = { [SERVICE_STOP_POST] = UNIT_DEACTIVATING, [SERVICE_FINAL_SIGTERM] = UNIT_DEACTIVATING, [SERVICE_FINAL_SIGKILL] = UNIT_DEACTIVATING, - [SERVICE_MAINTENANCE] = UNIT_MAINTENANCE, + [SERVICE_FAILED] = UNIT_FAILED, [SERVICE_AUTO_RESTART] = UNIT_ACTIVATING }; @@ -1197,7 +1197,7 @@ static void service_set_state(Service *s, ServiceState state) { state == SERVICE_STOP_POST || state == SERVICE_FINAL_SIGTERM || state == SERVICE_FINAL_SIGKILL || - state == SERVICE_MAINTENANCE || + state == SERVICE_FAILED || state == SERVICE_AUTO_RESTART) service_notify_sockets_dead(s); @@ -1521,7 +1521,7 @@ static void service_enter_dead(Service *s, bool success, bool allow_restart) { service_set_state(s, SERVICE_AUTO_RESTART); } else - service_set_state(s, s->failure ? SERVICE_MAINTENANCE : SERVICE_DEAD); + service_set_state(s, s->failure ? SERVICE_FAILED : SERVICE_DEAD); s->forbid_restart = false; @@ -1966,7 +1966,7 @@ static int service_start(Unit *u) { s->state == SERVICE_START_POST) return 0; - assert(s->state == SERVICE_DEAD || s->state == SERVICE_MAINTENANCE || s->state == SERVICE_AUTO_RESTART); + assert(s->state == SERVICE_DEAD || s->state == SERVICE_FAILED || s->state == SERVICE_AUTO_RESTART); /* Make sure we don't enter a busy loop of some kind. */ if (!ratelimit_test(&s->ratelimit)) { @@ -2520,7 +2520,7 @@ static void service_timer_event(Unit *u, uint64_t elapsed, Watch* w) { break; case SERVICE_FINAL_SIGKILL: - log_warning("%s still around after SIGKILL (2). Entering maintenance mode.", u->meta.id); + log_warning("%s still around after SIGKILL (2). Entering failed mode.", u->meta.id); service_enter_dead(s, false, true); break; @@ -2853,12 +2853,12 @@ int service_set_socket_fd(Service *s, int fd, Socket *sock) { return 0; } -static void service_reset_maintenance(Unit *u) { +static void service_reset_failed(Unit *u) { Service *s = SERVICE(u); assert(s); - if (s->state == SERVICE_MAINTENANCE) + if (s->state == SERVICE_FAILED) service_set_state(s, SERVICE_DEAD); s->failure = false; @@ -2878,7 +2878,7 @@ static const char* const service_state_table[_SERVICE_STATE_MAX] = { [SERVICE_STOP_POST] = "stop-post", [SERVICE_FINAL_SIGTERM] = "final-sigterm", [SERVICE_FINAL_SIGKILL] = "final-sigkill", - [SERVICE_MAINTENANCE] = "maintenance", + [SERVICE_FAILED] = "failed", [SERVICE_AUTO_RESTART] = "auto-restart", }; @@ -2951,7 +2951,7 @@ const UnitVTable service_vtable = { .sigchld_event = service_sigchld_event, .timer_event = service_timer_event, - .reset_maintenance = service_reset_maintenance, + .reset_failed = service_reset_failed, .cgroup_notify_empty = service_cgroup_notify_event, .notify_message = service_notify_message, diff --git a/src/service.h b/src/service.h index 0fdcb62d..f01906ca 100644 --- a/src/service.h +++ b/src/service.h @@ -41,7 +41,7 @@ typedef enum ServiceState { SERVICE_STOP_POST, SERVICE_FINAL_SIGTERM, /* In case the STOP_POST executable hangs, we shoot that down, too */ SERVICE_FINAL_SIGKILL, - SERVICE_MAINTENANCE, + SERVICE_FAILED, SERVICE_AUTO_RESTART, _SERVICE_STATE_MAX, _SERVICE_STATE_INVALID = -1 diff --git a/src/socket.c b/src/socket.c index d0568c9b..c4a95579 100644 --- a/src/socket.c +++ b/src/socket.c @@ -54,7 +54,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_MAINTENANCE + [SOCKET_FAILED] = UNIT_FAILED }; static void socket_init(Unit *u) { @@ -964,7 +964,7 @@ static void socket_enter_dead(Socket *s, bool success) { if (!success) s->failure = true; - socket_set_state(s, s->failure ? SOCKET_MAINTENANCE : SOCKET_DEAD); + socket_set_state(s, s->failure ? SOCKET_FAILED : SOCKET_DEAD); } static void socket_enter_signal(Socket *s, SocketState state, bool success); @@ -1295,12 +1295,12 @@ static int socket_start(Unit *u) { /* If the service is alredy actvie we cannot start the * socket */ if (s->service->state != SERVICE_DEAD && - s->service->state != SERVICE_MAINTENANCE && + s->service->state != SERVICE_FAILED && s->service->state != SERVICE_AUTO_RESTART) return -EBUSY; } - assert(s->state == SOCKET_DEAD || s->state == SOCKET_MAINTENANCE); + assert(s->state == SOCKET_DEAD || s->state == SOCKET_FAILED); s->failure = false; socket_enter_start_pre(s); @@ -1650,7 +1650,7 @@ static void socket_timer_event(Unit *u, uint64_t elapsed, Watch *w) { break; case SOCKET_FINAL_SIGKILL: - log_warning("%s still around after SIGKILL (2). Entering maintenance mode.", u->meta.id); + log_warning("%s still around after SIGKILL (2). Entering failed mode.", u->meta.id); socket_enter_dead(s, false); break; @@ -1719,12 +1719,12 @@ void socket_connection_unref(Socket *s) { log_debug("%s: One connection closed, %u left.", s->meta.id, s->n_connections); } -static void socket_reset_maintenance(Unit *u) { +static void socket_reset_failed(Unit *u) { Socket *s = SOCKET(u); assert(s); - if (s->state == SOCKET_MAINTENANCE) + if (s->state == SOCKET_FAILED) socket_set_state(s, SOCKET_DEAD); s->failure = false; @@ -1742,7 +1742,7 @@ static const char* const socket_state_table[_SOCKET_STATE_MAX] = { [SOCKET_STOP_POST] = "stop-post", [SOCKET_FINAL_SIGTERM] = "final-sigterm", [SOCKET_FINAL_SIGKILL] = "final-sigkill", - [SOCKET_MAINTENANCE] = "maintenance" + [SOCKET_FAILED] = "failed" }; DEFINE_STRING_TABLE_LOOKUP(socket_state, SocketState); @@ -1782,7 +1782,7 @@ const UnitVTable socket_vtable = { .sigchld_event = socket_sigchld_event, .timer_event = socket_timer_event, - .reset_maintenance = socket_reset_maintenance, + .reset_failed = socket_reset_failed, .bus_interface = "org.freedesktop.systemd1.Socket", .bus_message_handler = bus_socket_message_handler, diff --git a/src/socket.h b/src/socket.h index f74f60b4..9dd9f55f 100644 --- a/src/socket.h +++ b/src/socket.h @@ -41,7 +41,7 @@ typedef enum SocketState { SOCKET_STOP_POST, SOCKET_FINAL_SIGTERM, SOCKET_FINAL_SIGKILL, - SOCKET_MAINTENANCE, + SOCKET_FAILED, _SOCKET_STATE_MAX, _SOCKET_STATE_INVALID = -1 } SocketState; diff --git a/src/swap.c b/src/swap.c index 0beb9212..776b707d 100644 --- a/src/swap.c +++ b/src/swap.c @@ -38,7 +38,7 @@ static const UnitActiveState state_translation_table[_SWAP_STATE_MAX] = { [SWAP_DEAD] = UNIT_INACTIVE, [SWAP_ACTIVE] = UNIT_ACTIVE, - [SWAP_MAINTENANCE] = UNIT_MAINTENANCE + [SWAP_FAILED] = UNIT_FAILED }; static void swap_init(Unit *u) { @@ -428,7 +428,7 @@ static void swap_dump(Unit *u, FILE *f, const char *prefix) { static void swap_enter_dead(Swap *s, bool success) { assert(s); - swap_set_state(s, success ? SWAP_DEAD : SWAP_MAINTENANCE); + swap_set_state(s, success ? SWAP_DEAD : SWAP_FAILED); } static int swap_start(Unit *u) { @@ -437,7 +437,7 @@ static int swap_start(Unit *u) { int r; assert(s); - assert(s->state == SWAP_DEAD || s->state == SWAP_MAINTENANCE); + assert(s->state == SWAP_DEAD || s->state == SWAP_FAILED); if (s->from_fragment) priority = s->parameters_fragment.priority; @@ -584,19 +584,19 @@ static int swap_enumerate(Manager *m) { return r; } -static void swap_reset_maintenance(Unit *u) { +static void swap_reset_failed(Unit *u) { Swap *s = SWAP(u); assert(s); - if (s->state == SWAP_MAINTENANCE) + if (s->state == SWAP_FAILED) swap_set_state(s, SWAP_DEAD); } static const char* const swap_state_table[_SWAP_STATE_MAX] = { [SWAP_DEAD] = "dead", [SWAP_ACTIVE] = "active", - [SWAP_MAINTENANCE] = "maintenance" + [SWAP_FAILED] = "failed" }; DEFINE_STRING_TABLE_LOOKUP(swap_state, SwapState); @@ -631,7 +631,7 @@ const UnitVTable swap_vtable = { .bus_message_handler = bus_swap_message_handler, .bus_invalidating_properties = bus_swap_invalidating_properties, - .reset_maintenance = swap_reset_maintenance, + .reset_failed = swap_reset_failed, .enumerate = swap_enumerate, .shutdown = swap_shutdown diff --git a/src/swap.h b/src/swap.h index a180708a..9c249ca4 100644 --- a/src/swap.h +++ b/src/swap.h @@ -30,7 +30,7 @@ typedef struct Swap Swap; typedef enum SwapState { SWAP_DEAD, SWAP_ACTIVE, - SWAP_MAINTENANCE, + SWAP_FAILED, _SWAP_STATE_MAX, _SWAP_STATE_INVALID = -1 } SwapState; diff --git a/src/systemctl.c b/src/systemctl.c index eb7178e2..be1dcc50 100644 --- a/src/systemctl.c +++ b/src/systemctl.c @@ -327,7 +327,7 @@ static int list_units(DBusConnection *bus, char **args, unsigned n) { int a = 0, b = 0; const char *on, *off; - if (streq(u->active_state, "maintenance")) { + if (streq(u->active_state, "failed")) { on = ansi_highlight(true); off = ansi_highlight(false); } else @@ -1557,7 +1557,7 @@ static void print_status_info(UnitStatusInfo *i) { ss = streq_ptr(i->active_state, i->sub_state) ? NULL : i->sub_state; - if (streq_ptr(i->active_state, "maintenance")) { + if (streq_ptr(i->active_state, "failed")) { on = ansi_highlight(true); off = ansi_highlight(false); } else if (streq_ptr(i->active_state, "active") || streq_ptr(i->active_state, "reloading")) { @@ -1581,7 +1581,7 @@ static void print_status_info(UnitStatusInfo *i) { timestamp = (streq_ptr(i->active_state, "active") || streq_ptr(i->active_state, "reloading")) ? i->active_enter_timestamp : (streq_ptr(i->active_state, "inactive") || - streq_ptr(i->active_state, "maintenance")) ? i->inactive_enter_timestamp : + streq_ptr(i->active_state, "failed")) ? i->inactive_enter_timestamp : streq_ptr(i->active_state, "activating") ? i->inactive_exit_timestamp : i->active_exit_timestamp; @@ -2864,7 +2864,7 @@ static int daemon_reload(DBusConnection *bus, char **args, unsigned n) { streq(args[0], "clear-jobs") || streq(args[0], "cancel") ? "ClearJobs" : streq(args[0], "daemon-reexec") ? "Reexecute" : - streq(args[0], "reset-maintenance") ? "ResetMaintenance" : + streq(args[0], "reset-failed") ? "ResetFailed" : streq(args[0], "daemon-exit") ? "Exit" : "Reload"; } @@ -2906,7 +2906,7 @@ finish: return r; } -static int reset_maintenance(DBusConnection *bus, char **args, unsigned n) { +static int reset_failed(DBusConnection *bus, char **args, unsigned n) { DBusMessage *m = NULL, *reply = NULL; unsigned i; int r; @@ -2924,7 +2924,7 @@ static int reset_maintenance(DBusConnection *bus, char **args, unsigned n) { "org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", - "ResetMaintenanceUnit"))) { + "ResetFailedUnit"))) { log_error("Could not allocate message."); r = -ENOMEM; goto finish; @@ -3834,8 +3834,8 @@ static int systemctl_help(void) { " status [NAME...|PID...] Show runtime status of one or more units\n" " show [NAME...|JOB...] Show properties of one or more\n" " units/jobs or the manager\n" - " reset-maintenance [NAME...] Reset maintenance state for all, one,\n" - " or more units\n" + " reset-failed [NAME...] Reset failed state for all, one, or more\n" + " units\n" " enable [NAME...] Enable one or more unit files\n" " disable [NAME...] Disable one or more unit files\n" " is-enabled [NAME...] Check whether unit files are enabled\n" @@ -4677,7 +4677,7 @@ static int systemctl_main(DBusConnection *bus, int argc, char *argv[], DBusError { "default", EQUAL, 1, start_special }, { "rescue", EQUAL, 1, start_special }, { "emergency", EQUAL, 1, start_special }, - { "reset-maintenance", MORE, 1, reset_maintenance }, + { "reset-failed", MORE, 1, reset_failed }, { "enable", MORE, 2, enable_unit }, { "disable", MORE, 2, enable_unit }, { "is-enabled", MORE, 2, enable_unit } diff --git a/src/systemd-interfaces.vala b/src/systemd-interfaces.vala index 9a8c1dcd..b7229cea 100644 --- a/src/systemd-interfaces.vala +++ b/src/systemd-interfaces.vala @@ -62,7 +62,7 @@ public interface Manager : DBus.Object { public abstract ObjectPath reload_or_restart_unit(string name, string mode = "replace") throws DBus.Error; public abstract ObjectPath reload_or_try_restart_unit(string name, string mode = "replace") throws DBus.Error; - public abstract void reset_maintenance_unit(string name = "") throws DBus.Error; + public abstract void reset_failed_unit(string name = "") throws DBus.Error; public abstract void clear_jobs() throws DBus.Error; @@ -140,7 +140,7 @@ public interface Unit : DBus.Object { public abstract ObjectPath reload_or_restart(string mode = "replace") throws DBus.Error; public abstract ObjectPath reload_or_try_restart(string mode = "replace") throws DBus.Error; - public abstract void reset_maintenance() throws DBus.Error; + public abstract void reset_failed() throws DBus.Error; } [DBus (name = "org.freedesktop.systemd1.Job")] diff --git a/src/timer.c b/src/timer.c index 89deb019..ff94b8c8 100644 --- a/src/timer.c +++ b/src/timer.c @@ -33,7 +33,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_MAINTENANCE + [TIMER_FAILED] = UNIT_FAILED }; static void timer_init(Unit *u) { @@ -178,7 +178,7 @@ static void timer_enter_dead(Timer *t, bool success) { if (!success) t->failure = true; - timer_set_state(t, t->failure ? TIMER_MAINTENANCE : TIMER_DEAD); + timer_set_state(t, t->failure ? TIMER_FAILED : TIMER_DEAD); } static void timer_enter_waiting(Timer *t, bool initial) { @@ -293,7 +293,7 @@ static int timer_start(Unit *u) { Timer *t = TIMER(u); assert(t); - assert(t->state == TIMER_DEAD || t->state == TIMER_MAINTENANCE); + assert(t->state == TIMER_DEAD || t->state == TIMER_FAILED); if (t->unit->meta.load_state != UNIT_LOADED) return -ENOENT; @@ -421,7 +421,7 @@ void timer_unit_notify(Unit *u, UnitActiveState new_state) { case TIMER_RUNNING: - if (UNIT_IS_INACTIVE_OR_MAINTENANCE(new_state)) { + if (UNIT_IS_INACTIVE_OR_FAILED(new_state)) { log_debug("%s got notified about unit deactivation.", t->meta.id); timer_enter_waiting(t, false); } @@ -429,7 +429,7 @@ void timer_unit_notify(Unit *u, UnitActiveState new_state) { break; case TIMER_DEAD: - case TIMER_MAINTENANCE: + case TIMER_FAILED: ; default: @@ -443,12 +443,12 @@ fail: log_error("Failed find timer unit: %s", strerror(-r)); } -static void timer_reset_maintenance(Unit *u) { +static void timer_reset_failed(Unit *u) { Timer *t = TIMER(u); assert(t); - if (t->state == TIMER_MAINTENANCE) + if (t->state == TIMER_FAILED) timer_set_state(t, TIMER_DEAD); t->failure = false; @@ -459,7 +459,7 @@ static const char* const timer_state_table[_TIMER_STATE_MAX] = { [TIMER_WAITING] = "waiting", [TIMER_RUNNING] = "running", [TIMER_ELAPSED] = "elapsed", - [TIMER_MAINTENANCE] = "maintenance" + [TIMER_FAILED] = "failed" }; DEFINE_STRING_TABLE_LOOKUP(timer_state, TimerState); @@ -496,7 +496,7 @@ const UnitVTable timer_vtable = { .timer_event = timer_timer_event, - .reset_maintenance = timer_reset_maintenance, + .reset_failed = timer_reset_failed, .bus_interface = "org.freedesktop.systemd1.Timer", .bus_message_handler = bus_timer_message_handler, diff --git a/src/timer.h b/src/timer.h index 814d9b20..62956055 100644 --- a/src/timer.h +++ b/src/timer.h @@ -31,7 +31,7 @@ typedef enum TimerState { TIMER_WAITING, TIMER_RUNNING, TIMER_ELAPSED, - TIMER_MAINTENANCE, + TIMER_FAILED, _TIMER_STATE_MAX, _TIMER_STATE_INVALID = -1 } TimerState; diff --git a/src/unit.c b/src/unit.c index 33696477..bca4d979 100644 --- a/src/unit.c +++ b/src/unit.c @@ -388,7 +388,7 @@ UnitActiveState unit_active_state(Unit *u) { /* After a reload it might happen that a unit is not correctly * loaded but still has a process around. That's why we won't - * shortcut failed loading to UNIT_INACTIVE_MAINTENANCE. */ + * shortcut failed loading to UNIT_INACTIVE_FAILED. */ return UNIT_VTABLE(u)->active_state(u); } @@ -479,13 +479,13 @@ int unit_merge(Unit *u, Unit *other) { return -EINVAL; if (other->meta.load_state != UNIT_STUB && - other->meta.load_state != UNIT_FAILED) + other->meta.load_state != UNIT_ERROR) return -EEXIST; if (other->meta.job) return -EEXIST; - if (!UNIT_IS_INACTIVE_OR_MAINTENANCE(unit_active_state(other))) + if (!UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(other))) return -EEXIST; /* Merge names */ @@ -672,7 +672,7 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) { fprintf(f, "%s\tMerged into: %s\n", prefix, u->meta.merged_into->meta.id); - else if (u->meta.load_state == UNIT_FAILED) + else if (u->meta.load_state == UNIT_ERROR) fprintf(f, "%s\tLoad Error Code: %s\n", prefix, strerror(-u->meta.load_error)); @@ -758,7 +758,7 @@ int unit_load(Unit *u) { return 0; fail: - u->meta.load_state = UNIT_FAILED; + u->meta.load_state = UNIT_ERROR; u->meta.load_error = r; unit_add_to_dbus_queue(u); @@ -830,7 +830,7 @@ int unit_stop(Unit *u) { assert(u); state = unit_active_state(u); - if (UNIT_IS_INACTIVE_OR_MAINTENANCE(state)) + if (UNIT_IS_INACTIVE_OR_FAILED(state)) return -EALREADY; if (!UNIT_VTABLE(u)->stop) @@ -995,9 +995,9 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) { dual_timestamp_get(&ts); - if (UNIT_IS_INACTIVE_OR_MAINTENANCE(os) && !UNIT_IS_INACTIVE_OR_MAINTENANCE(ns)) + if (UNIT_IS_INACTIVE_OR_FAILED(os) && !UNIT_IS_INACTIVE_OR_FAILED(ns)) u->meta.inactive_exit_timestamp = ts; - else if (!UNIT_IS_INACTIVE_OR_MAINTENANCE(os) && UNIT_IS_INACTIVE_OR_MAINTENANCE(ns)) + else if (!UNIT_IS_INACTIVE_OR_FAILED(os) && UNIT_IS_INACTIVE_OR_FAILED(ns)) u->meta.inactive_enter_timestamp = ts; if (!UNIT_IS_ACTIVE_OR_RELOADING(os) && UNIT_IS_ACTIVE_OR_RELOADING(ns)) @@ -1005,7 +1005,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) { else if (UNIT_IS_ACTIVE_OR_RELOADING(os) && !UNIT_IS_ACTIVE_OR_RELOADING(ns)) u->meta.active_exit_timestamp = ts; - if (UNIT_IS_INACTIVE_OR_MAINTENANCE(ns)) + if (UNIT_IS_INACTIVE_OR_FAILED(ns)) cgroup_bonding_trim_list(u->meta.cgroup_bondings, true); timer_unit_notify(u, ns); @@ -1035,8 +1035,8 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) { else if (u->meta.job->state == JOB_RUNNING && ns != UNIT_ACTIVATING) { unexpected = true; - if (UNIT_IS_INACTIVE_OR_MAINTENANCE(ns)) - job_finish_and_invalidate(u->meta.job, ns != UNIT_MAINTENANCE); + if (UNIT_IS_INACTIVE_OR_FAILED(ns)) + job_finish_and_invalidate(u->meta.job, ns != UNIT_FAILED); } break; @@ -1050,8 +1050,8 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) { else if (ns != UNIT_ACTIVATING && ns != UNIT_RELOADING) { unexpected = true; - if (UNIT_IS_INACTIVE_OR_MAINTENANCE(ns)) - job_finish_and_invalidate(u->meta.job, ns != UNIT_MAINTENANCE); + if (UNIT_IS_INACTIVE_OR_FAILED(ns)) + job_finish_and_invalidate(u->meta.job, ns != UNIT_FAILED); } } @@ -1061,7 +1061,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) { case JOB_RESTART: case JOB_TRY_RESTART: - if (UNIT_IS_INACTIVE_OR_MAINTENANCE(ns)) + if (UNIT_IS_INACTIVE_OR_FAILED(ns)) job_finish_and_invalidate(u->meta.job, true); else if (u->meta.job->state == JOB_RUNNING && ns != UNIT_DEACTIVATING) { unexpected = true; @@ -1090,14 +1090,14 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) { retroactively_stop_dependencies(u); } - if (ns != os && ns == UNIT_MAINTENANCE) { + if (ns != os && ns == UNIT_FAILED) { Iterator i; Unit *other; SET_FOREACH(other, u->meta.dependencies[UNIT_ON_FAILURE], i) manager_add_job(u->meta.manager, JOB_START, other, JOB_REPLACE, true, NULL, NULL); - log_notice("Unit %s entered maintenance state.", u->meta.id); + log_notice("Unit %s entered failed state.", u->meta.id); } /* Some names are special */ @@ -1133,8 +1133,8 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) { * asynchronous notification for it anyway. */ if (u->meta.type == UNIT_SERVICE && - UNIT_IS_INACTIVE_OR_MAINTENANCE(ns) && - !UNIT_IS_INACTIVE_OR_MAINTENANCE(os)) { + UNIT_IS_INACTIVE_OR_FAILED(ns) && + !UNIT_IS_INACTIVE_OR_FAILED(os)) { /* Hmm, if there was no start record written * write it now, so that we always have a nice @@ -2109,11 +2109,11 @@ bool unit_need_daemon_reload(Unit *u) { timespec_load(&st.st_mtim) != u->meta.fragment_mtime; } -void unit_reset_maintenance(Unit *u) { +void unit_reset_failed(Unit *u) { assert(u); - if (UNIT_VTABLE(u)->reset_maintenance) - UNIT_VTABLE(u)->reset_maintenance(u); + if (UNIT_VTABLE(u)->reset_failed) + UNIT_VTABLE(u)->reset_failed(u); } Unit *unit_following(Unit *u) { @@ -2128,7 +2128,7 @@ Unit *unit_following(Unit *u) { static const char* const unit_load_state_table[_UNIT_LOAD_STATE_MAX] = { [UNIT_STUB] = "stub", [UNIT_LOADED] = "loaded", - [UNIT_FAILED] = "failed", + [UNIT_ERROR] = "error", [UNIT_MERGED] = "merged" }; @@ -2138,7 +2138,7 @@ static const char* const unit_active_state_table[_UNIT_ACTIVE_STATE_MAX] = { [UNIT_ACTIVE] = "active", [UNIT_RELOADING] = "reloading", [UNIT_INACTIVE] = "inactive", - [UNIT_MAINTENANCE] = "maintenance", + [UNIT_FAILED] = "failed", [UNIT_ACTIVATING] = "activating", [UNIT_DEACTIVATING] = "deactivating" }; diff --git a/src/unit.h b/src/unit.h index e3c0c0f0..15e7fedd 100644 --- a/src/unit.h +++ b/src/unit.h @@ -61,7 +61,7 @@ enum UnitType { enum UnitLoadState { UNIT_STUB, UNIT_LOADED, - UNIT_FAILED, + UNIT_ERROR, UNIT_MERGED, _UNIT_LOAD_STATE_MAX, _UNIT_LOAD_STATE_INVALID = -1 @@ -71,7 +71,7 @@ enum UnitActiveState { UNIT_ACTIVE, UNIT_RELOADING, UNIT_INACTIVE, - UNIT_MAINTENANCE, + UNIT_FAILED, UNIT_ACTIVATING, UNIT_DEACTIVATING, _UNIT_ACTIVE_STATE_MAX, @@ -87,11 +87,11 @@ static inline bool UNIT_IS_ACTIVE_OR_ACTIVATING(UnitActiveState t) { } static inline bool UNIT_IS_INACTIVE_OR_DEACTIVATING(UnitActiveState t) { - return t == UNIT_INACTIVE || t == UNIT_MAINTENANCE || t == UNIT_DEACTIVATING; + return t == UNIT_INACTIVE || t == UNIT_FAILED || t == UNIT_DEACTIVATING; } -static inline bool UNIT_IS_INACTIVE_OR_MAINTENANCE(UnitActiveState t) { - return t == UNIT_INACTIVE || t == UNIT_MAINTENANCE; +static inline bool UNIT_IS_INACTIVE_OR_FAILED(UnitActiveState t) { + return t == UNIT_INACTIVE || t == UNIT_FAILED; } enum UnitDependency { @@ -304,8 +304,8 @@ struct UnitVTable { void (*sigchld_event)(Unit *u, pid_t pid, int code, int status); void (*timer_event)(Unit *u, uint64_t n_elapsed, Watch *w); - /* Reset maintenance state if we are in maintainance state */ - void (*reset_maintenance)(Unit *u); + /* Reset failed state if we are in failed state */ + void (*reset_failed)(Unit *u); /* Called whenever any of the cgroups this unit watches for * ran empty */ @@ -495,7 +495,7 @@ void unit_status_printf(Unit *u, const char *format, ...); bool unit_need_daemon_reload(Unit *u); -void unit_reset_maintenance(Unit *u); +void unit_reset_failed(Unit *u); Unit *unit_following(Unit *u);