]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logind: rename ActionTableItem → HandleActionData
authorLennart Poettering <lennart@poettering.net>
Tue, 22 Feb 2022 12:19:44 +0000 (13:19 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 9 Mar 2022 15:24:11 +0000 (16:24 +0100)
It stores meta-info about various HandleActions, hence let's name it
after that. The fact that it can be seen as stored inside some form of a
table is an implementation detail of logind-action.c, and should not
leak into other modules, hence let's focus on what it is, not how it is
stored.

src/login/logind-action.c
src/login/logind-action.h
src/login/logind-dbus.c
src/login/logind-dbus.h
src/login/logind.h

index 50feb7e65129f4c35ff1c574805800554c694efa..7d1d4bf68514406c960ddfdc4c40bbdc7862e554 100644 (file)
@@ -18,7 +18,7 @@
 #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,
@@ -113,7 +113,7 @@ static const ActionTableItem action_table[_HANDLE_ACTION_MAX] = {
         },
 };
 
-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));
 
index dc073fe951b250f36ef115a8d2b9fa47cc0b9917..21635376c85f713c32ae4993af6c9b553c8917ea 100644 (file)
@@ -19,7 +19,7 @@ typedef enum HandleAction {
         _HANDLE_ACTION_INVALID = -EINVAL,
 } HandleAction;
 
-typedef struct ActionTableItem ActionTableItem;
+typedef struct HandleActionData HandleActionData;
 
 #include "logind-inhibit.h"
 #include "logind.h"
@@ -29,7 +29,7 @@ static inline bool handle_action_valid(HandleAction a) {
         return a >= 0 && a < _HANDLE_ACTION_MAX;
 }
 
-struct ActionTableItem {
+struct HandleActionData {
         HandleAction handle;
         const char *target;
         InhibitWhat inhibit_what;
@@ -52,7 +52,7 @@ int manager_handle_action(
 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);
index 7f6a6cce183f818ea24dc639e728d5010f79b4d2..e49eb8dec2142ec3a21437c451d7f23320ce7c8c 100644 (file)
@@ -1513,7 +1513,7 @@ static int have_multiple_sessions(
 
 static int bus_manager_log_shutdown(
                 Manager *m,
-                const ActionTableItem *a) {
+                const HandleActionData *a) {
 
         const char *message, *log_message;
 
@@ -1603,7 +1603,7 @@ static int send_prepare_for(Manager *m, InhibitWhat w, bool _active) {
 
 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;
@@ -1699,7 +1699,7 @@ static int manager_inhibit_timeout_handler(
 
 static int delay_shutdown_or_sleep(
                 Manager *m,
-                const ActionTableItem *a) {
+                const HandleActionData *a) {
 
         int r;
 
@@ -1731,7 +1731,7 @@ static int delay_shutdown_or_sleep(
 
 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;
@@ -1773,7 +1773,7 @@ int bus_manager_shutdown_or_sleep_now_or_later(
 static int verify_shutdown_creds(
                 Manager *m,
                 sd_bus_message *message,
-                const ActionTableItem *a,
+                const HandleActionData *a,
                 uint64_t flags,
                 sd_bus_error *error) {
 
@@ -1882,7 +1882,7 @@ static int setup_wall_message_timer(Manager *m, sd_bus_message* message) {
 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) {
 
@@ -2197,7 +2197,7 @@ static int manager_scheduled_shutdown_handler(
                         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;
@@ -2243,7 +2243,7 @@ error:
 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;
@@ -2323,7 +2323,7 @@ fail:
 
 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;
 
@@ -2378,7 +2378,7 @@ static int method_cancel_scheduled_shutdown(sd_bus_message *message, void *userd
 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;
index 1cdfd3eec9346a214128a16372391b3ceb7131af..11eb170d17d22f016337d54dc158ea08feede153 100644 (file)
@@ -15,7 +15,7 @@ int manager_get_seat_from_creds(Manager *m, sd_bus_message *message, const char
 
 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);
index af9af9e4578e14fff7e9f68adde72fdf80bc8bc1..1613daa04e11de73875679bd111fa416db8f9823 100644 (file)
@@ -71,14 +71,14 @@ struct Manager {
         /* 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;