]> err.no Git - systemd/commitdiff
logind: split up logind.h
authorLennart Poettering <lennart@poettering.net>
Mon, 23 May 2011 22:19:22 +0000 (00:19 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 21 Jun 2011 17:29:44 +0000 (19:29 +0200)
src/logind-device.c
src/logind-device.h [new file with mode: 0644]
src/logind-seat.c
src/logind-seat.h [new file with mode: 0644]
src/logind-session.c
src/logind-session.h [new file with mode: 0644]
src/logind-user.c
src/logind-user.h [new file with mode: 0644]
src/logind.h

index 9084b5fb4ed4901e115188abcf4701fb331d59cf..4e076c20b63c7728e278aca8d31457cc69c3b35c 100644 (file)
@@ -22,7 +22,7 @@
 #include <assert.h>
 #include <string.h>
 
-#include "logind.h"
+#include "logind-device.h"
 #include "util.h"
 
 Device* device_new(Manager *m, const char *sysfs) {
diff --git a/src/logind-device.h b/src/logind-device.h
new file mode 100644 (file)
index 0000000..e25a534
--- /dev/null
@@ -0,0 +1,48 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#ifndef foologinddevicehfoo
+#define foologinddevicehfoo
+
+/***
+  This file is part of systemd.
+
+  Copyright 2011 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+typedef struct Device Device;
+
+#include "list.h"
+#include "util.h"
+#include "logind.h"
+#include "logind-seat.h"
+
+struct Device {
+        Manager *manager;
+
+        char *sysfs;
+        Seat *seat;
+
+        dual_timestamp timestamp;
+
+        LIST_FIELDS(struct Device, devices);
+};
+
+Device* device_new(Manager *m, const char *sysfs);
+void device_free(Device *d);
+void device_attach(Device *d, Seat *s);
+void device_detach(Device *d);
+
+#endif
index dcf1c7107be8e98685b84163e20c6a0eaed26369..315490043df53d52c61e79c69686f617df598cb5 100644 (file)
@@ -26,7 +26,7 @@
 #include <sys/ioctl.h>
 #include <linux/vt.h>
 
-#include "logind.h"
+#include "logind-seat.h"
 #include "util.h"
 
 Seat *seat_new(Manager *m, const char *id) {
diff --git a/src/logind-seat.h b/src/logind-seat.h
new file mode 100644 (file)
index 0000000..2fe7949
--- /dev/null
@@ -0,0 +1,54 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#ifndef foologindseathfoo
+#define foologindseathfoo
+
+/***
+  This file is part of systemd.
+
+  Copyright 2011 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+typedef struct Seat Seat;
+
+#include "list.h"
+#include "util.h"
+#include "logind.h"
+#include "logind-device.h"
+#include "logind-session.h"
+
+struct Seat {
+        Manager *manager;
+        char *id;
+
+        char *state_file;
+
+        LIST_HEAD(Device, devices);
+
+        Session *active;
+        LIST_HEAD(Session, sessions);
+};
+
+Seat *seat_new(Manager *m, const char *id);
+void seat_free(Seat *s);
+int seat_preallocate_vts(Seat *s);
+void seat_active_vt_changed(Seat *s, int vtnr);
+int seat_apply_acls(Seat *s);
+int seat_stop(Seat *s);
+int seat_save(Seat *s);
+int seat_load(Seat *s);
+
+#endif
index 9af99d054a788f416c296a8db8aea2b00814545d..7bdf487e8d67dda84b582ec99aab04f1e900b46b 100644 (file)
@@ -23,7 +23,7 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "logind.h"
+#include "logind-session.h"
 #include "strv.h"
 #include "util.h"
 #include "cgroup-util.h"
diff --git a/src/logind-session.h b/src/logind-session.h
new file mode 100644 (file)
index 0000000..b3f0b5f
--- /dev/null
@@ -0,0 +1,88 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#ifndef foologindsessionhfoo
+#define foologindsessionhfoo
+
+/***
+  This file is part of systemd.
+
+  Copyright 2011 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+typedef struct Session Session;
+
+#include "list.h"
+#include "util.h"
+#include "logind.h"
+#include "logind-seat.h"
+#include "logind-user.h"
+
+typedef enum SessionType {
+        SESSION_TERMINAL,
+        SESSION_X11,
+        _SESSION_TYPE_MAX,
+        _SESSION_TYPE_INVALID = -1
+} SessionType;
+
+struct Session {
+        Manager *manager;
+
+        char *id;
+        SessionType type;
+
+        char *state_file;
+
+        User *user;
+
+        dual_timestamp timestamp;
+
+        char *tty;
+        char *display;
+
+        bool remote;
+        char *remote_host;
+
+        int vtnr;
+        Seat *seat;
+
+        pid_t leader;
+        uint64_t audit_id;
+
+        int pipe_fd;
+
+        char *cgroup_path;
+        char **controllers, **reset_controllers;
+
+        bool kill_processes;
+
+        LIST_FIELDS(Session, sessions_by_user);
+        LIST_FIELDS(Session, sessions_by_seat);
+};
+
+Session *session_new(Manager *m, User *u, const char *id);
+void session_free(Session *s);
+int session_activate(Session *s);
+bool session_is_active(Session *s);
+int session_check_gc(Session *s);
+int session_start(Session *s);
+int session_stop(Session *s);
+int session_save(Session *s);
+int session_load(Session *s);
+
+const char* session_type_to_string(SessionType t);
+SessionType session_type_from_string(const char *s);
+
+#endif
index 1292eed3e2e6d3bec71cb2330e5203b27c04d2b9..e0a38425461347a5df49ac9a69b213cc5a60fe43 100644 (file)
@@ -23,7 +23,7 @@
 #include <unistd.h>
 #include <errno.h>
 
-#include "logind.h"
+#include "logind-user.h"
 #include "util.h"
 #include "cgroup-util.h"
 #include "hashmap.h"
diff --git a/src/logind-user.h b/src/logind-user.h
new file mode 100644 (file)
index 0000000..04392e0
--- /dev/null
@@ -0,0 +1,72 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#ifndef foologinduserhfoo
+#define foologinduserhfoo
+
+/***
+  This file is part of systemd.
+
+  Copyright 2011 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+typedef struct User User;
+
+#include "list.h"
+#include "util.h"
+#include "logind.h"
+#include "logind-session.h"
+
+typedef enum UserState {
+        USER_OFFLINE,
+        USER_LINGERING,
+        USER_ONLINE,
+        USER_ACTIVE,
+        _USER_STATE_MAX,
+        _USER_STATE_INVALID = -1
+} UserState;
+
+struct User {
+        Manager *manager;
+
+        uid_t uid;
+        gid_t gid;
+        char *name;
+
+        char *state_file;
+        char *runtime_path;
+        char *service;
+        char *cgroup_path;
+
+        Session *display;
+
+        dual_timestamp timestamp;
+
+        LIST_HEAD(Session, sessions);
+};
+
+User* user_new(Manager *m, uid_t uid, gid_t gid, const char *name);
+void user_free(User *u);
+int user_start(User *u);
+int user_stop(User *u);
+int user_check_gc(User *u);
+UserState user_get_state(User *u);
+int user_save(User *u);
+int user_load(User *u);
+
+const char* user_state_to_string(UserState s);
+UserState user_state_from_string(const char *s);
+
+#endif
index 5e69a71b021f15e560fc737c2ac2664bd57d32f1..0d3bd899b282087e324fd22c0caf287d50bd5b35 100644 (file)
  */
 
 typedef struct Manager Manager;
-typedef struct Device Device;
-typedef struct Seat Seat;
-typedef struct Session Session;
-typedef struct User User;
 
-struct Device {
-        Manager *manager;
-
-        char *sysfs;
-        Seat *seat;
-
-        dual_timestamp timestamp;
-
-        LIST_FIELDS(struct Device, devices);
-};
-
-struct Seat {
-        Manager *manager;
-        char *id;
-
-        char *state_file;
-
-        LIST_HEAD(Device, devices);
-
-        Session *active;
-        LIST_HEAD(Session, sessions);
-};
-
-typedef enum SessionType {
-        SESSION_TERMINAL,
-        SESSION_X11,
-        _SESSION_TYPE_MAX,
-        _SESSION_TYPE_INVALID = -1
-} SessionType;
-
-struct Session {
-        Manager *manager;
-
-        char *id;
-        SessionType type;
-
-        char *state_file;
-
-        User *user;
-
-        dual_timestamp timestamp;
-
-        char *tty;
-        char *display;
-
-        bool remote;
-        char *remote_host;
-
-        int vtnr;
-        Seat *seat;
-
-        pid_t leader;
-        uint64_t audit_id;
-
-        int pipe_fd;
-
-        char *cgroup_path;
-        char **controllers, **reset_controllers;
-
-        bool kill_processes;
-
-        LIST_FIELDS(Session, sessions_by_user);
-        LIST_FIELDS(Session, sessions_by_seat);
-};
-
-typedef enum UserState {
-        USER_OFFLINE,
-        USER_LINGERING,
-        USER_ONLINE,
-        USER_ACTIVE,
-        _USER_STATE_MAX,
-        _USER_STATE_INVALID = -1
-} UserState;
-
-struct User {
-        Manager *manager;
-
-        uid_t uid;
-        gid_t gid;
-        char *name;
-
-        char *state_file;
-        char *runtime_path;
-        char *service;
-        char *cgroup_path;
-
-        Session *display;
-
-        dual_timestamp timestamp;
-
-        LIST_HEAD(Session, sessions);
-};
+#include "logind-device.h"
+#include "logind-seat.h"
+#include "logind-session.h"
+#include "logind-user.h"
 
 struct Manager {
         DBusConnection *bus;
@@ -170,39 +78,6 @@ struct Manager {
         bool kill_user_processes;
 };
 
-Device* device_new(Manager *m, const char *sysfs);
-void device_free(Device *d);
-void device_attach(Device *d, Seat *s);
-void device_detach(Device *d);
-
-Seat *seat_new(Manager *m, const char *id);
-void seat_free(Seat *s);
-int seat_preallocate_vts(Seat *s);
-void seat_active_vt_changed(Seat *s, int vtnr);
-int seat_apply_acls(Seat *s);
-int seat_stop(Seat *s);
-int seat_save(Seat *s);
-int seat_load(Seat *s);
-
-Session *session_new(Manager *m, User *u, const char *id);
-void session_free(Session *s);
-int session_activate(Session *s);
-bool session_is_active(Session *s);
-int session_check_gc(Session *s);
-int session_start(Session *s);
-int session_stop(Session *s);
-int session_save(Session *s);
-int session_load(Session *s);
-
-User* user_new(Manager *m, uid_t uid, gid_t gid, const char *name);
-void user_free(User *u);
-int user_start(User *u);
-int user_stop(User *u);
-int user_check_gc(User *u);
-UserState user_get_state(User *u);
-int user_save(User *u);
-int user_load(User *u);
-
 Manager *manager_new(void);
 void manager_free(Manager *m);
 int manager_add_device(Manager *m, const char *sysfs, Device **_device);
@@ -224,12 +99,6 @@ int manager_startup(Manager *m);
 int manager_run(Manager *m);
 int manager_spawn_autovt(Manager *m, int vtnr);
 
-const char* session_type_to_string(SessionType t);
-SessionType session_type_from_string(const char *s);
-
-const char* user_state_to_string(UserState s);
-UserState user_state_from_string(const char *s);
-
 bool x11_display_is_local(const char *display);
 
 #endif