]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/login/logind-action.h
logind: style fixes
[thirdparty/systemd.git] / src / login / logind-action.h
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
05d3a176 2#pragma once
23406ce5 3
a2106925
LP
4#include "conf-parser.h"
5
23406ce5
LP
6typedef enum HandleAction {
7 HANDLE_IGNORE,
8 HANDLE_POWEROFF,
9 HANDLE_REBOOT,
10 HANDLE_HALT,
11 HANDLE_KEXEC,
12 HANDLE_SUSPEND,
13 HANDLE_HIBERNATE,
14 HANDLE_HYBRID_SLEEP,
e68c79db 15 HANDLE_SUSPEND_THEN_HIBERNATE,
23406ce5 16 HANDLE_LOCK,
836fb00f 17 HANDLE_FACTORY_RESET,
23406ce5 18 _HANDLE_ACTION_MAX,
2d93c20e 19 _HANDLE_ACTION_INVALID = -EINVAL,
23406ce5
LP
20} HandleAction;
21
5ed73478
LN
22typedef struct ActionTableItem ActionTableItem;
23
24#define handle_action_valid(x) (x && (x < _HANDLE_ACTION_MAX))
25
07630cea 26#include "logind-inhibit.h"
71d35b6b 27#include "logind.h"
5ed73478
LN
28#include "sleep-config.h"
29
30struct ActionTableItem {
138224fc 31 HandleAction handle;
5ed73478
LN
32 const char *target;
33 InhibitWhat inhibit_what;
34 const char *polkit_action;
35 const char *polkit_action_multiple_sessions;
36 const char *polkit_action_ignore_inhibit;
37 SleepOperation sleep_operation;
38 const char* message_id;
39 const char* message;
d2fc0ecf 40 const char* log_message;
5ed73478 41};
23406ce5
LP
42
43int manager_handle_action(
44 Manager *m,
45 InhibitWhat inhibit_key,
46 HandleAction handle,
47 bool ignore_inhibited,
48 bool is_edge);
49
44a6b1b6
ZJS
50const char* handle_action_to_string(HandleAction h) _const_;
51HandleAction handle_action_from_string(const char *s) _pure_;
23406ce5 52
5ed73478
LN
53const ActionTableItem* manager_item_for_handle(HandleAction handle);
54HandleAction manager_handle_for_item(const ActionTableItem* a);
a2106925
LP
55
56CONFIG_PARSER_PROTOTYPE(config_parse_handle_action);