#include "terminal-util.h"
#include "user-util.h"
-static const ActionTableItem action_table[_HANDLE_ACTION_MAX] = {
+static const HandleActionData action_table[_HANDLE_ACTION_MAX] = {
[HANDLE_POWEROFF] = {
.handle = HANDLE_POWEROFF,
.target = SPECIAL_POWEROFF_TARGET,
},
};
-const ActionTableItem* manager_item_for_handle(HandleAction handle) {
+const HandleActionData* manager_item_for_handle(HandleAction handle) {
assert(handle >= 0);
assert(handle < (ssize_t) ELEMENTSOF(action_table));
_HANDLE_ACTION_INVALID = -EINVAL,
} HandleAction;
-typedef struct ActionTableItem ActionTableItem;
+typedef struct HandleActionData HandleActionData;
#include "logind-inhibit.h"
#include "logind.h"
return a >= 0 && a < _HANDLE_ACTION_MAX;
}
-struct ActionTableItem {
+struct HandleActionData {
HandleAction handle;
const char *target;
InhibitWhat inhibit_what;
const char* handle_action_to_string(HandleAction h) _const_;
HandleAction handle_action_from_string(const char *s) _pure_;
-const ActionTableItem* manager_item_for_handle(HandleAction handle);
-HandleAction manager_handle_for_item(const ActionTableItem* a);
+const HandleActionData* manager_item_for_handle(HandleAction handle);
+HandleAction manager_handle_for_item(const HandleActionData* a);
CONFIG_PARSER_PROTOTYPE(config_parse_handle_action);
static int bus_manager_log_shutdown(
Manager *m,
- const ActionTableItem *a) {
+ const HandleActionData *a) {
const char *message, *log_message;
static int execute_shutdown_or_sleep(
Manager *m,
- const ActionTableItem *a,
+ const HandleActionData *a,
sd_bus_error *error) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
static int delay_shutdown_or_sleep(
Manager *m,
- const ActionTableItem *a) {
+ const HandleActionData *a) {
int r;
int bus_manager_shutdown_or_sleep_now_or_later(
Manager *m,
- const ActionTableItem *a,
+ const HandleActionData *a,
sd_bus_error *error) {
_cleanup_free_ char *load_state = NULL;
static int verify_shutdown_creds(
Manager *m,
sd_bus_message *message,
- const ActionTableItem *a,
+ const HandleActionData *a,
uint64_t flags,
sd_bus_error *error) {
static int method_do_shutdown_or_sleep(
Manager *m,
sd_bus_message *message,
- const ActionTableItem *a,
+ const HandleActionData *a,
bool with_flags,
sd_bus_error *error) {
uint64_t usec,
void *userdata) {
- const ActionTableItem *a = NULL;
+ const HandleActionData *a = NULL;
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
Manager *m = userdata;
int r;
static int method_schedule_shutdown(sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
HandleAction handle;
- const ActionTableItem *a;
+ const HandleActionData *a;
uint64_t elapse;
char *type;
int r;
static int method_cancel_scheduled_shutdown(sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
- const ActionTableItem *a;
+ const HandleActionData *a;
bool cancelled;
int r;
static int method_can_shutdown_or_sleep(
Manager *m,
sd_bus_message *message,
- const ActionTableItem *a,
+ const HandleActionData *a,
sd_bus_error *error) {
_cleanup_(sd_bus_creds_unrefp) sd_bus_creds *creds = NULL;
int manager_dispatch_delayed(Manager *manager, bool timeout);
-int bus_manager_shutdown_or_sleep_now_or_later(Manager *m, const ActionTableItem *a, sd_bus_error *error);
+int bus_manager_shutdown_or_sleep_now_or_later(Manager *m, const HandleActionData *a, sd_bus_error *error);
int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *error);
int match_unit_removed(sd_bus_message *message, void *userdata, sd_bus_error *error);
/* If a shutdown/suspend was delayed due to an inhibitor this
contains the action we are supposed to start after the
delay is over */
- const ActionTableItem *delayed_action;
+ const HandleActionData *delayed_action;
/* If a shutdown/suspend is currently executed, then this is
* the job of it */
char *action_job;
sd_event_source *inhibit_timeout_source;
- const ActionTableItem *scheduled_shutdown_type;
+ const HandleActionData *scheduled_shutdown_type;
usec_t scheduled_shutdown_timeout;
sd_event_source *scheduled_shutdown_timeout_source;
uid_t scheduled_shutdown_uid;