]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
login: Remove circular header dependencies
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 18 Apr 2025 21:53:19 +0000 (23:53 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 23 Apr 2025 08:33:37 +0000 (10:33 +0200)
35 files changed:
src/login/logind-action.c
src/login/logind-action.h
src/login/logind-brightness.h
src/login/logind-button.c
src/login/logind-button.h
src/login/logind-core.c
src/login/logind-dbus.c
src/login/logind-dbus.h
src/login/logind-device.c
src/login/logind-device.h
src/login/logind-gperf.gperf
src/login/logind-inhibit.c
src/login/logind-inhibit.h
src/login/logind-polkit.c
src/login/logind-polkit.h
src/login/logind-seat-dbus.c
src/login/logind-seat-dbus.h
src/login/logind-seat.c
src/login/logind-seat.h
src/login/logind-session-dbus.c
src/login/logind-session-dbus.h
src/login/logind-session-device.c
src/login/logind-session-device.h
src/login/logind-session.c
src/login/logind-session.h
src/login/logind-user-dbus.h
src/login/logind-user.c
src/login/logind-user.h
src/login/logind-utmp.c
src/login/logind-utmp.h
src/login/logind-varlink.c
src/login/logind-varlink.h
src/login/logind.c
src/login/logind.h
src/login/test-login-tables.c

index c663d2493d7389514bb0db715159be296a4ac3ab..9d1e392d7bcc07c42aabec5da9ea9358f837f90d 100644 (file)
@@ -11,6 +11,7 @@
 #include "bus-util.h"
 #include "conf-parser.h"
 #include "format-util.h"
+#include "logind.h"
 #include "logind-action.h"
 #include "logind-dbus.h"
 #include "logind-seat-dbus.h"
index 800f4e830997c12f951a4befc2448c99183b625a..e251701a8d2f85e0586b9f94088aff6fecdcec2c 100644 (file)
@@ -2,6 +2,8 @@
 #pragma once
 
 #include "conf-parser.h"
+#include "logind-inhibit.h"
+#include "sleep-config.h"
 
 typedef enum HandleAction {
         HANDLE_IGNORE,
@@ -41,10 +43,6 @@ typedef enum HandleActionSleepMask {
 
 #define HANDLE_ACTION_SLEEP_MASK_DEFAULT (HANDLE_SLEEP_SUSPEND_THEN_HIBERNATE_MASK|HANDLE_SLEEP_SUSPEND_MASK|HANDLE_SLEEP_HIBERNATE_MASK)
 
-#include "logind-inhibit.h"
-#include "logind.h"
-#include "sleep-config.h"
-
 static inline bool handle_action_valid(HandleAction a) {
         return a >= 0 && a < _HANDLE_ACTION_MAX;
 }
index f1c77757a88f59e18baa7c0834522433b4f7643f..d0e8580032c9da8dfa4e3bdfcd41c57b3d6d80c0 100644 (file)
@@ -4,6 +4,6 @@
 #include "sd-bus.h"
 #include "sd-device.h"
 
-#include "logind.h"
+typedef struct Manager Manager;
 
 int manager_write_brightness(Manager *m, sd_device *device, uint32_t brightness, sd_bus_message *message);
index 2b6b1dc4638d05d33c46067e86273afbfb77c9cb..4d4853b570a6a290a3800304600ef74e0428c442 100644 (file)
@@ -11,6 +11,7 @@
 #include "alloc-util.h"
 #include "async.h"
 #include "fd-util.h"
+#include "logind.h"
 #include "logind-button.h"
 #include "logind-dbus.h"
 #include "string-util.h"
index 125e49dd086464355f05b8d8b9643d407efe13a4..4af54cb33d8ae3151a36f9fe283fc36d962fa0b3 100644 (file)
@@ -1,9 +1,11 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-typedef struct Button Button;
+#include <stdbool.h>
 
-#include "logind.h"
+#include "sd-event.h"
+
+typedef struct Manager Manager;
 
 typedef enum ButtonModifierMask {
         BUTTON_MODIFIER_NONE        = 0,
@@ -19,7 +21,7 @@ typedef enum ButtonModifierMask {
 #define BUTTON_MODIFIER_HAS_CTRL(modifier) (((modifier) & (BUTTON_MODIFIER_LEFT_CTRL|BUTTON_MODIFIER_RIGHT_CTRL)) != 0)
 #define BUTTON_MODIFIER_HAS_ALT(modifier) (((modifier) & (BUTTON_MODIFIER_LEFT_ALT|BUTTON_MODIFIER_RIGHT_ALT)) != 0)
 
-struct Button {
+typedef struct Button {
         Manager *manager;
 
         sd_event_source *io_event_source;
@@ -33,7 +35,7 @@ struct Button {
 
         bool lid_closed;
         bool docked;
-};
+} Button;
 
 Button* button_new(Manager *m, const char *name);
 Button *button_free(Button *b);
index 1619276520638731bac1720e017e957c0cf344f5..80e777b505478ead87186dc3aecda39e6e6eb256 100644 (file)
 #include "fd-util.h"
 #include "limits-util.h"
 #include "logind.h"
+#include "logind-button.h"
+#include "logind-device.h"
+#include "logind-seat.h"
+#include "logind-session.h"
+#include "logind-user.h"
 #include "logind-utmp.h"
 #include "parse-util.h"
 #include "path-util.h"
index 37eb842e20a0b69b9d32e3f8ae83cb535796a51d..c6eac67c0ab093d5caaedc2c5cc11340c34ef077 100644 (file)
 #include "fileio.h"
 #include "format-util.h"
 #include "fs-util.h"
+#include "login-util.h"
 #include "logind.h"
 #include "logind-action.h"
 #include "logind-dbus.h"
 #include "logind-polkit.h"
+#include "logind-seat.h"
 #include "logind-seat-dbus.h"
 #include "logind-session-dbus.h"
+#include "logind-user.h"
 #include "logind-user-dbus.h"
 #include "logind-utmp.h"
 #include "mkdir-label.h"
index afbf523edec3b593014f88728c2f195e9dcf1671..0cf39c4ae5c485da402a7704a508a31de85fd458 100644 (file)
@@ -4,10 +4,13 @@
 #include "sd-bus.h"
 
 #include "bus-object.h"
-#include "logind-action.h"
 #include "logind-session.h"
-#include "logind-user.h"
-#include "logind.h"
+#include "macro.h"
+
+typedef struct Manager Manager;
+typedef struct User User;
+typedef struct Seat Seat;
+typedef struct HandleActionData HandleActionData;
 
 int manager_get_session_from_creds(Manager *m, sd_bus_message *message, const char *name, sd_bus_error *error, Session **ret);
 int manager_get_user_from_creds(Manager *m, sd_bus_message *message, uid_t uid, sd_bus_error *error, User **ret);
index 376cd0d42fd8b46c0a6198b6e28da3d2b8daaf06..5f6b58b84022814c37277ef308943c70241ce444 100644 (file)
@@ -3,8 +3,11 @@
 #include <string.h>
 
 #include "alloc-util.h"
+#include "logind.h"
 #include "logind-device.h"
+#include "logind-seat.h"
 #include "logind-seat-dbus.h"
+#include "logind-session-device.h"
 
 Device* device_new(Manager *m, const char *sysfs, bool master) {
         Device *d;
index f96c4dbfb69aac4e6c876d2051f557e499473cc2..e6afe378a230e19dc62a0c3fda07f426815a9ca1 100644 (file)
@@ -1,11 +1,13 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-typedef struct Device Device;
-
 #include "list.h"
-#include "logind-seat.h"
-#include "logind-session-device.h"
+#include "time-util.h"
+
+typedef struct Device Device;
+typedef struct Manager Manager;
+typedef struct Seat Seat;
+typedef struct SessionDevice SessionDevice;
 
 struct Device {
         Manager *manager;
index f09387e6a804bef47453c7ae9a9bae0ea6c3d024..bd64b8352ed20fd75d335fd0aefaa541914a675b 100644 (file)
@@ -7,6 +7,7 @@ _Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"")
 #include <stddef.h>
 #include "conf-parser.h"
 #include "logind.h"
+#include "logind-user.h"
 %}
 struct ConfigPerfItem;
 %null_strings
index c0ae173783af2d763047df9525ffa50f5986ef8d..86bae8f0b7cedf7c6277e0d6c392adfed3ba7206 100644 (file)
@@ -17,6 +17,7 @@
 #include "format-util.h"
 #include "fs-util.h"
 #include "io-util.h"
+#include "logind.h"
 #include "logind-dbus.h"
 #include "logind-inhibit.h"
 #include "mkdir-label.h"
index ae91e2d402efb09549b623a8ae8a6f09fa782c7b..1f115410f14afc3db3967a70c0ecff446dbab92b 100644 (file)
@@ -1,9 +1,13 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
+#include "sd-event.h"
+
 #include "pidref.h"
+#include "time-util.h"
 
 typedef struct Inhibitor Inhibitor;
+typedef struct Manager Manager;
 
 typedef enum InhibitWhat {
         INHIBIT_SHUTDOWN             = 1 << 0,
@@ -26,8 +30,6 @@ typedef enum InhibitMode {
         _INHIBIT_MODE_INVALID = -EINVAL,
 } InhibitMode;
 
-#include "logind.h"
-
 struct Inhibitor {
         Manager *manager;
 
index 5b6c256a0853dc918b3d13a6aaa8c2b400792dae..1aa76e225d689f0c116229a2ee1f4abae97e0549 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include "bus-polkit.h"
+#include "logind.h"
 #include "logind-polkit.h"
 #include "user-util.h"
 
index 9ec01a3c45a9c398815ddcd8e8d3582baee8c900..7619ce2d90ffb162f3992142e70d2d6d8df4c30d 100644 (file)
@@ -4,6 +4,7 @@
 #include "sd-bus.h"
 
 #include "bus-object.h"
-#include "logind.h"
+
+typedef struct Manager Manager;
 
 int check_polkit_chvt(sd_bus_message *message, Manager *manager, sd_bus_error *error);
index 18acbf25b4f717d5cdeb58c18a0846d2ea3c5df5..3c027e8fe1b4fe0062a5c2b6c278bfa70882aaee 100644 (file)
@@ -13,6 +13,7 @@
 #include "logind-seat-dbus.h"
 #include "logind-seat.h"
 #include "logind-session-dbus.h"
+#include "logind-user.h"
 #include "logind.h"
 #include "strv.h"
 #include "user-util.h"
index f4bd78e24bd342e371858909f4135fab98af9f51..782ee01c60a1f3b2c642bfc4ec1a1bf6e8ab5062 100644 (file)
@@ -4,7 +4,9 @@
 #include "sd-bus.h"
 
 #include "bus-object.h"
-#include "logind-seat.h"
+#include "macro.h"
+
+typedef struct Seat Seat;
 
 extern const BusObjectImplementation seat_object;
 
index 50c2b21b47eca18909289ccd3d3d289d07a1cecd..06f32ecec5a3df75ae24f7960e254279620a391a 100644 (file)
 #include "fileio.h"
 #include "format-util.h"
 #include "fs-util.h"
+#include "logind.h"
+#include "logind-device.h"
 #include "logind-seat-dbus.h"
 #include "logind-seat.h"
+#include "logind-session.h"
 #include "logind-session-dbus.h"
+#include "logind-session-device.h"
+#include "logind-user.h"
 #include "mkdir-label.h"
 #include "parse-util.h"
 #include "path-util.h"
index 76a69e6517b7babf2797b1ae53591471125e78fe..4c4a6fa6bd5f176d00d118c5161dd8015958ff7d 100644 (file)
@@ -1,10 +1,15 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-typedef struct Seat Seat;
-
 #include "list.h"
-#include "logind-session.h"
+#include "memory-util.h"
+#include "string-util.h"
+#include "time-util.h"
+
+typedef struct Device Device;
+typedef struct Manager Manager;
+typedef struct Seat Seat;
+typedef struct Session Session;
 
 struct Seat {
         Manager *manager;
index dbbadfedf7e9c4756f80d8c9e357e85d985c178f..af5e04bce4e5365444b1f0fcf5ca816eacbb2faf 100644 (file)
 #include "logind-brightness.h"
 #include "logind-dbus.h"
 #include "logind-polkit.h"
+#include "logind-seat.h"
 #include "logind-seat-dbus.h"
 #include "logind-session-dbus.h"
 #include "logind-session-device.h"
 #include "logind-session.h"
+#include "logind-user.h"
 #include "logind-user-dbus.h"
 #include "logind.h"
 #include "path-util.h"
index 091ad26292fa562d7437be8a9466b390e3ba5b1e..175e29a93fcf5036cdcb0c66a1d51d4f3e9eb572 100644 (file)
@@ -4,7 +4,10 @@
 #include "sd-bus.h"
 
 #include "bus-object.h"
-#include "logind-session.h"
+#include "macro.h"
+
+typedef struct Manager Manager;
+typedef struct Session Session;
 
 extern const BusObjectImplementation session_object;
 
index 1a22a77e8ea9a1e91d6ab43e3017834107728ca5..984c1c1eeb69476ea277fb67f490f410fbe3b60c 100644 (file)
 #include "daemon-util.h"
 #include "device-util.h"
 #include "fd-util.h"
+#include "logind.h"
+#include "logind-device.h"
+#include "logind-seat.h"
+#include "logind-session.h"
 #include "logind-session-dbus.h"
 #include "logind-session-device.h"
 #include "missing_drm.h"
index 1c6f12f21b1bddd20160ce70974bbed7c9af4e2f..52cea0f74c9634b6899c6293bb5b5b852882aa59 100644 (file)
@@ -1,18 +1,19 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-typedef enum DeviceType DeviceType;
-typedef struct SessionDevice SessionDevice;
-
 #include "list.h"
-#include "logind.h"
+#include "memory-util.h"
 
-enum DeviceType {
+typedef struct Device Device;
+typedef struct Session Session;
+typedef struct SessionDevice SessionDevice;
+
+typedef enum DeviceType {
         DEVICE_TYPE_UNKNOWN,
         DEVICE_TYPE_DRM,
         DEVICE_TYPE_EVDEV,
         DEVICE_TYPE_HIDRAW,
-};
+} DeviceType;
 
 struct SessionDevice {
         Session *session;
index 7def7237233eda6aade59d293d887b8a5bf5f033..75ceb650a4a9d67c40b0eecacc7f0d9b998f6415 100644 (file)
 #include "format-util.h"
 #include "fs-util.h"
 #include "io-util.h"
+#include "login-util.h"
+#include "logind.h"
 #include "logind-dbus.h"
+#include "logind-seat.h"
 #include "logind-seat-dbus.h"
 #include "logind-session-dbus.h"
+#include "logind-session-device.h"
 #include "logind-session.h"
+#include "logind-user.h"
 #include "logind-user-dbus.h"
 #include "logind-varlink.h"
 #include "mkdir-label.h"
index 56ca70da848720a7b78bb25568a99319c891069e..923723479ccb3035cfe58ae97ea697dab49b4193 100644 (file)
@@ -1,14 +1,20 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-typedef struct Session Session;
-typedef enum KillWhom KillWhom;
+#include "sd-bus.h"
+#include "sd-event.h"
+#include "sd-varlink.h"
 
+#include "hashmap.h"
 #include "list.h"
-#include "login-util.h"
-#include "logind-user.h"
 #include "pidref.h"
 #include "string-util.h"
+#include "time-util.h"
+
+typedef struct Manager Manager;
+typedef struct Seat Seat;
+typedef struct Session Session;
+typedef struct User User;
 
 typedef enum SessionState {
         SESSION_OPENING,  /* Session scope is being created */
@@ -85,12 +91,12 @@ typedef enum SessionType {
 
 #define SESSION_TYPE_IS_GRAPHICAL(type) IN_SET(type, SESSION_X11, SESSION_WAYLAND, SESSION_MIR)
 
-enum KillWhom {
+typedef enum KillWhom {
         KILL_LEADER,
         KILL_ALL,
         _KILL_WHOM_MAX,
         _KILL_WHOM_INVALID = -EINVAL,
-};
+} KillWhom;
 
 typedef enum TTYValidity {
         TTY_FROM_PAM,
index ba530bede294a5de3c63f62a15d649921773c467..33f810f7f5409c241c562ddc650d811fbd9bc97c 100644 (file)
@@ -3,7 +3,10 @@
 
 #include "sd-bus.h"
 
-#include "logind-user.h"
+#include "bus-object.h"
+#include "macro.h"
+
+typedef struct User User;
 
 extern const BusObjectImplementation user_object;
 
index 276d5b86f583ee9e2247140cc265ff10e83f70ff..1ef321882633e67c4f89572f86cd1f06889c0f36 100644 (file)
@@ -19,7 +19,9 @@
 #include "hashmap.h"
 #include "label-util.h"
 #include "limits-util.h"
+#include "logind.h"
 #include "logind-dbus.h"
+#include "logind-seat.h"
 #include "logind-user-dbus.h"
 #include "logind-user.h"
 #include "mkdir-label.h"
index 5c82f490f2d9509da498675509928bc222496e79..88b5d06bdfa44b8cfc66394f4b36e2550cb777cc 100644 (file)
@@ -1,13 +1,16 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-typedef struct User User;
+#include "sd-event.h"
 
 #include "conf-parser.h"
 #include "list.h"
-#include "logind.h"
 #include "user-record.h"
 
+typedef struct Manager Manager;
+typedef struct Session Session;
+typedef struct User User;
+
 typedef enum UserState {
         USER_OFFLINE,    /* Not logged in at all */
         USER_OPENING,    /* Is logging in */
index 47a293914baeeadb133d197be811d32b378a77c7..228bcf97d11d1c2163a28e3991fc66f9b83eef53 100644 (file)
@@ -1,5 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "log.h"
+#include "logind.h"
+#include "logind-session.h"
 #include "logind-utmp.h"
 #include "path-util.h"
 #include "process-util.h"
index 1358e27840ffca4349f359906be5b83b822ac0cf..5309132c7780282d233f3ae380933c0dd5b092fb 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "logind.h"
+typedef struct Manager Manager;
 
 int manager_read_utmp(Manager *m);
 void manager_connect_utmp(Manager *m);
index ce2b48cdc14d70c2d3ccd69b9ecd3e0a5c359857..b8181c76f994a7f956a3db31d968fa9e39078e93 100644 (file)
@@ -6,7 +6,9 @@
 #include "json-util.h"
 #include "logind.h"
 #include "logind-dbus.h"
+#include "logind-seat.h"
 #include "logind-session-dbus.h"
+#include "logind-user.h"
 #include "logind-varlink.h"
 #include "terminal-util.h"
 #include "user-util.h"
index bcf2af4feddb04129c89eac153dbccf9664f25c3..3a8e43d9d9cb99e098358826fb5a49c7300f14e0 100644 (file)
@@ -3,8 +3,8 @@
 
 #include "sd-bus.h"
 
-#include "logind.h"
-#include "logind-session.h"
+typedef struct Manager Manager;
+typedef struct Session Session;
 
 int manager_varlink_init(Manager *m);
 void manager_varlink_done(Manager *m);
index f1e2ea3c46165154c5baf334165f12212e7180e3..e07b9e52965bea9795180be50be668a07affa1bc 100644 (file)
 #include "format-util.h"
 #include "fs-util.h"
 #include "logind.h"
+#include "logind-button.h"
 #include "logind-dbus.h"
+#include "logind-device.h"
+#include "logind-seat.h"
 #include "logind-seat-dbus.h"
 #include "logind-session-dbus.h"
+#include "logind-session-device.h"
+#include "logind-user.h"
 #include "logind-user-dbus.h"
 #include "logind-utmp.h"
 #include "logind-varlink.h"
index 35d4e9c257c8b44b5e8dd7037eb98f3fe96d4e8c..7ae30c5b63b1d5442e78b91ef58caadb91f99c39 100644 (file)
 #include "conf-parser.h"
 #include "hashmap.h"
 #include "list.h"
+#include "logind-action.h"
 #include "set.h"
 #include "time-util.h"
 #include "user-record.h"
 
-typedef struct Manager Manager;
-
-#include "logind-action.h"
-#include "logind-button.h"
-#include "logind-device.h"
-#include "logind-inhibit.h"
+typedef struct Button Button;
+typedef struct Device Device;
+typedef struct Seat Seat;
+typedef struct Session Session;
+typedef struct User User;
 
-struct Manager {
+typedef struct Manager {
         sd_event *event;
         sd_bus *bus;
 
@@ -150,7 +150,7 @@ struct Manager {
         dual_timestamp init_ts;
 
         sd_varlink_server *varlink_server;
-};
+} Manager;
 
 void manager_reset_config(Manager *m);
 int manager_parse_config_file(Manager *m);
index 9be781ce2dc1c1c3e2f4d3bcaa237059bea93dcb..76b62aa621e08934a91ace61e7c92acd7d131e85 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "logind-action.h"
 #include "logind-session.h"
+#include "logind-user.h"
 #include "sleep-config.h"
 #include "test-tables.h"
 #include "tests.h"