1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
4 This file is part of systemd.
6 Copyright (C) 2014 David Herrmann <dh.herrmann@gmail.com>
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
28 #include <systemd/sd-bus.h>
29 #include <systemd/sd-event.h>
40 struct sysview_device {
47 struct udev_device *ud;
52 sysview_device *sysview_find_device(sysview_context *c, const char *name);
54 int sysview_device_new(sysview_device **out, sysview_seat *seat, const char *name);
55 sysview_device *sysview_device_free(sysview_device *device);
57 DEFINE_TRIVIAL_CLEANUP_FUNC(sysview_device*, sysview_device_free);
63 struct sysview_session {
69 sd_bus_slot *slot_take_control;
73 bool wants_control : 1;
77 sysview_session *sysview_find_session(sysview_context *c, const char *name);
79 int sysview_session_new(sysview_session **out, sysview_seat *seat, const char *name);
80 sysview_session *sysview_session_free(sysview_session *session);
82 DEFINE_TRIVIAL_CLEANUP_FUNC(sysview_session*, sysview_session_free);
89 sysview_context *context;
100 sysview_seat *sysview_find_seat(sysview_context *c, const char *name);
102 int sysview_seat_new(sysview_seat **out, sysview_context *c, const char *name);
103 sysview_seat *sysview_seat_free(sysview_seat *seat);
105 DEFINE_TRIVIAL_CLEANUP_FUNC(sysview_seat*, sysview_seat_free);
111 struct sysview_context {
118 Hashmap *session_map;
121 sd_event_source *scan_src;
122 sysview_event_fn event_fn;
126 struct udev_monitor *ud_monitor;
127 sd_event_source *ud_monitor_src;
130 sd_bus_slot *ld_slot_manager_signal;
131 sd_bus_slot *ld_slot_list_seats;
132 sd_bus_slot *ld_slot_list_sessions;
134 bool scan_logind : 1;
142 int sysview_context_rescan(sysview_context *c);