mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-23 17:34:00 +03:00
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.
This commit is contained in:
parent
9f2e86af06
commit
d7550a6752
@ -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 },
|
||||
|
@ -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 },
|
||||
|
@ -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 },
|
||||
|
@ -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 },
|
||||
{}
|
||||
};
|
||||
|
@ -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");
|
||||
|
@ -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 },
|
||||
|
@ -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 },
|
||||
};
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user