]> git.ipfire.org Git - people/ms/systemd.git/blob - dbus-swap.c
device: allow easy identification of network interfaces without their full sysfs...
[people/ms/systemd.git] / dbus-swap.c
1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
2
3 /***
4 This file is part of systemd.
5
6 Copyright 2010 Lennart Poettering
7 Copyright 2010 Maarten Lankhorst
8
9 systemd is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 systemd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with systemd; If not, see <http://www.gnu.org/licenses/>.
21 ***/
22
23 #include "dbus-unit.h"
24 #include "dbus-swap.h"
25
26 static const char introspection[] =
27 DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
28 "<node>"
29 BUS_UNIT_INTERFACE
30 BUS_PROPERTIES_INTERFACE
31 " <interface name=\"org.freedesktop.systemd1.Swap\">"
32 " <property name=\"What\" type=\"s\" access=\"read\"/>"
33 " <property name=\"Priority\" type=\"i\" access=\"read\"/>"
34 " </interface>"
35 BUS_INTROSPECTABLE_INTERFACE
36 "</node>";
37
38 DBusHandlerResult bus_swap_message_handler(Unit *u, DBusMessage *message) {
39 const BusProperty properties[] = {
40 BUS_UNIT_PROPERTIES,
41 { "org.freedesktop.systemd1.Swap", "What", bus_property_append_string, "s", u->swap.what },
42 { "org.freedesktop.systemd1.Swap", "Priority", bus_property_append_int32, "i", &u->swap.priority },
43 { NULL, NULL, NULL, NULL, NULL }
44 };
45
46 return bus_default_message_handler(u->meta.manager, message, introspection, properties);
47 }