From: Lennart Poettering Date: Tue, 26 Oct 2010 20:05:52 +0000 (+0200) Subject: swap: expose swap exec env proprties via dbus X-Git-Tag: v12~143 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15412f2987c0f0a562f9cf8edcca023f90a5f5bd;p=systemd swap: expose swap exec env proprties via dbus --- diff --git a/TODO b/TODO index 45ef095d..50ad9fa1 100644 --- a/TODO +++ b/TODO @@ -80,7 +80,7 @@ * make description of .swap files nicer: resolve /dev/by-uuid/ symlink -* systemctl status getty@tty1.service +* only add quotacheck deps t .mount units which mention grpquota/usrquota in the mount flags External: diff --git a/src/dbus-mount.c b/src/dbus-mount.c index 92d74cb9..4de00f7f 100644 --- a/src/dbus-mount.c +++ b/src/dbus-mount.c @@ -137,16 +137,16 @@ static int bus_mount_append_type(Manager *n, DBusMessageIter *i, const char *pro DBusHandlerResult bus_mount_message_handler(Unit *u, DBusConnection *c, DBusMessage *message) { const BusProperty properties[] = { BUS_UNIT_PROPERTIES, - { "org.freedesktop.systemd1.Mount", "Where", bus_property_append_string, "s", u->mount.where }, - { "org.freedesktop.systemd1.Mount", "What", bus_mount_append_what, "s", u }, - { "org.freedesktop.systemd1.Mount", "Options", bus_mount_append_options, "s", u }, - { "org.freedesktop.systemd1.Mount", "Type", bus_mount_append_type, "s", u }, - { "org.freedesktop.systemd1.Mount", "TimeoutUSec", bus_property_append_usec, "t", &u->mount.timeout_usec }, + { "org.freedesktop.systemd1.Mount", "Where", bus_property_append_string, "s", u->mount.where }, + { "org.freedesktop.systemd1.Mount", "What", bus_mount_append_what, "s", u }, + { "org.freedesktop.systemd1.Mount", "Options", bus_mount_append_options, "s", u }, + { "org.freedesktop.systemd1.Mount", "Type", bus_mount_append_type, "s", u }, + { "org.freedesktop.systemd1.Mount", "TimeoutUSec", bus_property_append_usec, "t", &u->mount.timeout_usec }, BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Mount", u->mount.exec_command+MOUNT_EXEC_MOUNT, "ExecMount"), BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Mount", u->mount.exec_command+MOUNT_EXEC_UNMOUNT, "ExecUnmount"), BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Mount", u->mount.exec_command+MOUNT_EXEC_REMOUNT, "ExecRemount"), BUS_EXEC_CONTEXT_PROPERTIES("org.freedesktop.systemd1.Mount", u->mount.exec_context), - { "org.freedesktop.systemd1.Mount", "ControlPID", bus_property_append_pid, "u", &u->mount.control_pid }, + { "org.freedesktop.systemd1.Mount", "ControlPID", bus_property_append_pid, "u", &u->mount.control_pid }, { "org.freedesktop.systemd1.Mount", "DirectoryMode", bus_property_append_mode, "u", &u->mount.directory_mode }, { NULL, NULL, NULL, NULL, NULL } }; diff --git a/src/dbus-swap.c b/src/dbus-swap.c index c345d4bc..70cccdca 100644 --- a/src/dbus-swap.c +++ b/src/dbus-swap.c @@ -24,11 +24,17 @@ #include "dbus-unit.h" #include "dbus-swap.h" +#include "dbus-execute.h" #define BUS_SWAP_INTERFACE \ " \n" \ " \n" \ " \n" \ + " \n" \ + BUS_EXEC_COMMAND_INTERFACE("ExecActivate") \ + BUS_EXEC_COMMAND_INTERFACE("ExecDeactivate") \ + BUS_EXEC_CONTEXT_INTERFACE \ + " \n" \ " \n" #define INTROSPECTION \ @@ -46,6 +52,9 @@ const char bus_swap_interface[] = BUS_SWAP_INTERFACE; const char bus_swap_invalidating_properties[] = "What\0" "Priority\0" + "ExecActivate\0" + "ExecDeactivate\0" + "ControlPID\0" "\0"; static int bus_swap_append_priority(Manager *m, DBusMessageIter *i, const char *property, void *data) { @@ -75,8 +84,12 @@ static int bus_swap_append_priority(Manager *m, DBusMessageIter *i, const char * DBusHandlerResult bus_swap_message_handler(Unit *u, DBusConnection *c, DBusMessage *message) { const BusProperty properties[] = { BUS_UNIT_PROPERTIES, - { "org.freedesktop.systemd1.Swap", "What", bus_property_append_string, "s", u->swap.what }, - { "org.freedesktop.systemd1.Swap", "Priority", bus_swap_append_priority, "i", u }, + { "org.freedesktop.systemd1.Swap", "What", bus_property_append_string, "s", u->swap.what }, + { "org.freedesktop.systemd1.Swap", "Priority", bus_swap_append_priority, "i", u }, + BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Swap", u->swap.exec_command+SWAP_EXEC_ACTIVATE, "ExecActivate"), + BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Swap", u->swap.exec_command+SWAP_EXEC_DEACTIVATE, "ExecDeactivate"), + BUS_EXEC_CONTEXT_PROPERTIES("org.freedesktop.systemd1.Swap", u->swap.exec_context), + { "org.freedesktop.systemd1.Swap", "ControlPID", bus_property_append_pid, "u", &u->swap.control_pid }, { NULL, NULL, NULL, NULL, NULL } };