diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-07-01 02:45:02 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-07-01 02:45:02 +0200 |
commit | d7550a6752be85f98408a86b7ae23a033e9b2983 (patch) | |
tree | 2f0088c426f8f3a091d944a832a3d04a4f84f7ef /src/core | |
parent | 9f2e86af0600e99cff00d1c92f9bb8d38f29896a (diff) |
core: move ControlGroup and Slice properties out of the dbus "Unit" interface
Slice/ControlGroup only really makes sense for unit types which actually
have cgroups attached to them, hence move them out of the generic Unit
interface and into the specific unit type interfaces.
These fields will continue to be part of Unit though, simply because
things are a log easier that way. However, regardless how this looks
internally we should keep things clean and independent of the specific
implementation of the inside.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/dbus-mount.c | 2 | ||||
-rw-r--r-- | src/core/dbus-scope.c | 2 | ||||
-rw-r--r-- | src/core/dbus-service.c | 2 | ||||
-rw-r--r-- | src/core/dbus-slice.c | 2 | ||||
-rw-r--r-- | src/core/dbus-socket.c | 6 | ||||
-rw-r--r-- | src/core/dbus-swap.c | 2 | ||||
-rw-r--r-- | src/core/dbus-unit.c | 7 | ||||
-rw-r--r-- | src/core/dbus-unit.h | 7 |
8 files changed, 24 insertions, 6 deletions
diff --git a/src/core/dbus-mount.c b/src/core/dbus-mount.c index ef55fcb173..72e187063c 100644 --- a/src/core/dbus-mount.c +++ b/src/core/dbus-mount.c @@ -36,6 +36,7 @@ " <property name=\"Options\" type=\"s\" access=\"read\"/>\n" \ " <property name=\"Type\" type=\"s\" access=\"read\"/>\n" \ " <property name=\"TimeoutUSec\" type=\"t\" access=\"read\"/>\n" \ + BUS_UNIT_CGROUP_INTERFACE \ BUS_EXEC_COMMAND_INTERFACE("ExecMount") \ BUS_EXEC_COMMAND_INTERFACE("ExecUnmount") \ BUS_EXEC_COMMAND_INTERFACE("ExecRemount") \ @@ -158,6 +159,7 @@ DBusHandlerResult bus_mount_message_handler(Unit *u, DBusConnection *c, DBusMess const BusBoundProperties bps[] = { { "org.freedesktop.systemd1.Unit", bus_unit_properties, u }, + { "org.freedesktop.systemd1.Mount", bus_unit_cgroup_properties, u }, { "org.freedesktop.systemd1.Mount", bus_mount_properties, m }, { "org.freedesktop.systemd1.Mount", bus_exec_context_properties, &m->exec_context }, { "org.freedesktop.systemd1.Mount", bus_kill_context_properties, &m->kill_context }, diff --git a/src/core/dbus-scope.c b/src/core/dbus-scope.c index 604d147945..30b9c00335 100644 --- a/src/core/dbus-scope.c +++ b/src/core/dbus-scope.c @@ -30,6 +30,7 @@ #define BUS_SCOPE_INTERFACE \ " <interface name=\"org.freedesktop.systemd1.Scope\">\n" \ + BUS_UNIT_CGROUP_INTERFACE \ " <property name=\"TimeoutStopUSec\" type=\"t\" access=\"read\"/>\n" \ BUS_KILL_CONTEXT_INTERFACE \ BUS_CGROUP_CONTEXT_INTERFACE \ @@ -65,6 +66,7 @@ DBusHandlerResult bus_scope_message_handler(Unit *u, DBusConnection *c, DBusMess const BusBoundProperties bps[] = { { "org.freedesktop.systemd1.Unit", bus_unit_properties, u }, + { "org.freedesktop.systemd1.Scope", bus_unit_cgroup_properties, u }, { "org.freedesktop.systemd1.Scope", bus_scope_properties, s }, { "org.freedesktop.systemd1.Scope", bus_cgroup_context_properties, &s->cgroup_context }, { "org.freedesktop.systemd1.Scope", bus_kill_context_properties, &s->kill_context }, diff --git a/src/core/dbus-service.c b/src/core/dbus-service.c index 3bedda6c01..c2e02209be 100644 --- a/src/core/dbus-service.c +++ b/src/core/dbus-service.c @@ -46,6 +46,7 @@ " <property name=\"StartLimitInterval\" type=\"t\" access=\"read\"/>\n" \ " <property name=\"StartLimitBurst\" type=\"u\" access=\"read\"/>\n" \ " <property name=\"StartLimitAction\" type=\"s\" access=\"readwrite\"/>\n" \ + BUS_UNIT_CGROUP_INTERFACE \ BUS_EXEC_COMMAND_INTERFACE("ExecStartPre") \ BUS_EXEC_COMMAND_INTERFACE("ExecStart") \ BUS_EXEC_COMMAND_INTERFACE("ExecStartPost") \ @@ -152,6 +153,7 @@ DBusHandlerResult bus_service_message_handler(Unit *u, DBusConnection *connectio const BusBoundProperties bps[] = { { "org.freedesktop.systemd1.Unit", bus_unit_properties, u }, + { "org.freedesktop.systemd1.Service", bus_unit_cgroup_properties, u }, { "org.freedesktop.systemd1.Service", bus_service_properties, s }, { "org.freedesktop.systemd1.Service", bus_exec_context_properties, &s->exec_context }, { "org.freedesktop.systemd1.Service", bus_kill_context_properties, &s->kill_context }, diff --git a/src/core/dbus-slice.c b/src/core/dbus-slice.c index 3b677792fd..dac9fbdf5f 100644 --- a/src/core/dbus-slice.c +++ b/src/core/dbus-slice.c @@ -29,6 +29,7 @@ #define BUS_SLICE_INTERFACE \ " <interface name=\"org.freedesktop.systemd1.Slice\">\n" \ + BUS_UNIT_CGROUP_INTERFACE \ BUS_CGROUP_CONTEXT_INTERFACE \ " </interface>\n" @@ -53,6 +54,7 @@ DBusHandlerResult bus_slice_message_handler(Unit *u, DBusConnection *c, DBusMess const BusBoundProperties bps[] = { { "org.freedesktop.systemd1.Unit", bus_unit_properties, u }, + { "org.freedesktop.systemd1.Slice", bus_unit_cgroup_properties, u }, { "org.freedesktop.systemd1.Slice", bus_cgroup_context_properties, &s->cgroup_context }, {} }; diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c index a431fa1921..da317edb86 100644 --- a/src/core/dbus-socket.c +++ b/src/core/dbus-socket.c @@ -34,6 +34,7 @@ " <property name=\"BindIPv6Only\" type=\"b\" access=\"read\"/>\n" \ " <property name=\"Backlog\" type=\"u\" access=\"read\"/>\n" \ " <property name=\"TimeoutUSec\" type=\"t\" access=\"read\"/>\n" \ + BUS_UNIT_CGROUP_INTERFACE \ BUS_EXEC_COMMAND_INTERFACE("ExecStartPre") \ BUS_EXEC_COMMAND_INTERFACE("ExecStartPost") \ BUS_EXEC_COMMAND_INTERFACE("ExecStopPre") \ @@ -196,18 +197,19 @@ static const BusProperty bus_socket_properties[] = { { "SmackLabel", bus_property_append_string, "s", offsetof(Socket, smack), true }, { "SmackLabelIPIn", bus_property_append_string, "s", offsetof(Socket, smack_ip_in), true }, { "SmackLabelIPOut",bus_property_append_string, "s", offsetof(Socket, smack_ip_out), true }, - { NULL, } + {} }; DBusHandlerResult bus_socket_message_handler(Unit *u, DBusConnection *c, DBusMessage *message) { Socket *s = SOCKET(u); const BusBoundProperties bps[] = { { "org.freedesktop.systemd1.Unit", bus_unit_properties, u }, + { "org.freedesktop.systemd1.Socket", bus_unit_cgroup_properties, u }, { "org.freedesktop.systemd1.Socket", bus_socket_properties, s }, { "org.freedesktop.systemd1.Socket", bus_exec_context_properties, &s->exec_context }, { "org.freedesktop.systemd1.Socket", bus_kill_context_properties, &s->kill_context }, { "org.freedesktop.systemd1.Socket", bus_cgroup_context_properties, &s->cgroup_context }, - { NULL, } + {} }; SELINUX_UNIT_ACCESS_CHECK(u, c, message, "status"); diff --git a/src/core/dbus-swap.c b/src/core/dbus-swap.c index d854e0fb5e..86fcf16eaf 100644 --- a/src/core/dbus-swap.c +++ b/src/core/dbus-swap.c @@ -35,6 +35,7 @@ " <property name=\"What\" type=\"s\" access=\"read\"/>\n" \ " <property name=\"Priority\" type=\"i\" access=\"read\"/>\n" \ " <property name=\"TimeoutUSec\" type=\"t\" access=\"read\"/>\n" \ + BUS_UNIT_CGROUP_INTERFACE \ BUS_EXEC_COMMAND_INTERFACE("ExecActivate") \ BUS_EXEC_COMMAND_INTERFACE("ExecDeactivate") \ BUS_EXEC_CONTEXT_INTERFACE \ @@ -105,6 +106,7 @@ DBusHandlerResult bus_swap_message_handler(Unit *u, DBusConnection *c, DBusMessa Swap *s = SWAP(u); const BusBoundProperties bps[] = { { "org.freedesktop.systemd1.Unit", bus_unit_properties, u }, + { "org.freedesktop.systemd1.Swap", bus_unit_cgroup_properties, u }, { "org.freedesktop.systemd1.Swap", bus_swap_properties, s }, { "org.freedesktop.systemd1.Swap", bus_exec_context_properties, &s->exec_context }, { "org.freedesktop.systemd1.Swap", bus_kill_context_properties, &s->kill_context }, diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index 36c3abdb97..6273e46274 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -878,7 +878,6 @@ const BusProperty bus_unit_properties[] = { { "Id", bus_property_append_string, "s", offsetof(Unit, id), true }, { "Names", bus_unit_append_names, "as", 0 }, { "Following", bus_unit_append_following, "s", 0 }, - { "Slice", bus_unit_append_slice, "s", 0 }, { "Requires", bus_unit_append_dependencies, "as", offsetof(Unit, dependencies[UNIT_REQUIRES]), true }, { "RequiresOverridable", bus_unit_append_dependencies, "as", offsetof(Unit, dependencies[UNIT_REQUIRES_OVERRIDABLE]), true }, { "Requisite", bus_unit_append_dependencies, "as", offsetof(Unit, dependencies[UNIT_REQUISITE]), true }, @@ -937,7 +936,11 @@ const BusProperty bus_unit_properties[] = { { "ConditionTimestampMonotonic", bus_property_append_usec, "t", offsetof(Unit, condition_timestamp.monotonic) }, { "ConditionResult", bus_property_append_bool, "b", offsetof(Unit, condition_result) }, { "LoadError", bus_unit_append_load_error, "(ss)", 0 }, - { "ControlGroup", bus_property_append_string, "s", offsetof(Unit, cgroup_path), true }, { "Transient", bus_property_append_bool, "b", offsetof(Unit, transient) }, { NULL, } }; + +const BusProperty bus_unit_cgroup_properties[] = { + { "Slice", bus_unit_append_slice, "s", 0 }, + { "ControlGroup", bus_property_append_string, "s", offsetof(Unit, cgroup_path), true }, +}; diff --git a/src/core/dbus-unit.h b/src/core/dbus-unit.h index 18f7c4f088..d3f7ec621e 100644 --- a/src/core/dbus-unit.h +++ b/src/core/dbus-unit.h @@ -68,7 +68,6 @@ " <property name=\"Id\" type=\"s\" access=\"read\"/>\n" \ " <property name=\"Names\" type=\"as\" access=\"read\"/>\n" \ " <property name=\"Following\" type=\"s\" access=\"read\"/>\n" \ - " <property name=\"Slice\" type=\"s\" access=\"read\"/>\n" \ " <property name=\"Requires\" type=\"as\" access=\"read\"/>\n" \ " <property name=\"RequiresOverridable\" type=\"as\" access=\"read\"/>\n" \ " <property name=\"Requisite\" type=\"as\" access=\"read\"/>\n" \ @@ -127,15 +126,19 @@ " <property name=\"ConditionTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \ " <property name=\"ConditionResult\" type=\"b\" access=\"read\"/>\n" \ " <property name=\"LoadError\" type=\"(ss)\" access=\"read\"/>\n" \ - " <property name=\"ControlGroup\" type=\"s\" access=\"read\"/>\n" \ " <property name=\"Transient\" type=\"b\" access=\"read\"/>\n" \ " </interface>\n" +#define BUS_UNIT_CGROUP_INTERFACE \ + " <property name=\"Slice\" type=\"s\" access=\"read\"/>\n" \ + " <property name=\"ControlGroup\" type=\"s\" access=\"read\"/>\n" + #define BUS_UNIT_INTERFACES_LIST \ BUS_GENERIC_INTERFACES_LIST \ "org.freedesktop.systemd1.Unit\0" extern const BusProperty bus_unit_properties[]; +extern const BusProperty bus_unit_cgroup_properties[]; void bus_unit_send_change_signal(Unit *u); void bus_unit_send_removed_signal(Unit *u); |