diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2012-01-15 12:04:08 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2012-01-16 13:34:42 +0100 |
commit | ac155bb885f9ea8aac3979a6b2686f0c8a9cc6e3 (patch) | |
tree | 6d78545bae4ffd262ddf4fd71d17ded342c530ca /src/dbus-service.c | |
parent | 7d17cfbc46306a106dbda0f3e92fbc0792d1e9e9 (diff) |
unit: remove union Unit
Now that objects of all unit types are allocated the exact amount of
memory they need, the Unit union has lost its purpose. Remove it.
"Unit" is a more natural name for the base unit class than "Meta", so
rename Meta to Unit.
Access to members of the base class gets simplified.
Diffstat (limited to 'src/dbus-service.c')
-rw-r--r-- | src/dbus-service.c | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/src/dbus-service.c b/src/dbus-service.c index 373e3f56b0..2157c2b6fa 100644 --- a/src/dbus-service.c +++ b/src/dbus-service.c @@ -95,36 +95,37 @@ static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_service_append_restart, service_resta static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_service_append_notify_access, notify_access, NotifyAccess); DBusHandlerResult bus_service_message_handler(Unit *u, DBusConnection *connection, DBusMessage *message) { + Service *s = SERVICE(u); const BusProperty properties[] = { BUS_UNIT_PROPERTIES, - { "org.freedesktop.systemd1.Service", "Type", bus_service_append_type, "s", &u->service.type }, - { "org.freedesktop.systemd1.Service", "Restart", bus_service_append_restart, "s", &u->service.restart }, - { "org.freedesktop.systemd1.Service", "PIDFile", bus_property_append_string, "s", u->service.pid_file }, - { "org.freedesktop.systemd1.Service", "NotifyAccess", bus_service_append_notify_access, "s", &u->service.notify_access }, - { "org.freedesktop.systemd1.Service", "RestartUSec", bus_property_append_usec, "t", &u->service.restart_usec }, - { "org.freedesktop.systemd1.Service", "TimeoutUSec", bus_property_append_usec, "t", &u->service.timeout_usec }, - BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Service", u->service.exec_command[SERVICE_EXEC_START_PRE], "ExecStartPre"), - BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Service", u->service.exec_command[SERVICE_EXEC_START], "ExecStart"), - BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Service", u->service.exec_command[SERVICE_EXEC_START_POST], "ExecStartPost"), - BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Service", u->service.exec_command[SERVICE_EXEC_RELOAD], "ExecReload"), - BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Service", u->service.exec_command[SERVICE_EXEC_STOP], "ExecStop"), - BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Service", u->service.exec_command[SERVICE_EXEC_STOP_POST], "ExecStopPost"), - BUS_EXEC_CONTEXT_PROPERTIES("org.freedesktop.systemd1.Service", u->service.exec_context), - { "org.freedesktop.systemd1.Service", "PermissionsStartOnly", bus_property_append_bool, "b", &u->service.permissions_start_only }, - { "org.freedesktop.systemd1.Service", "RootDirectoryStartOnly", bus_property_append_bool, "b", &u->service.root_directory_start_only }, - { "org.freedesktop.systemd1.Service", "RemainAfterExit", bus_property_append_bool, "b", &u->service.remain_after_exit }, - { "org.freedesktop.systemd1.Service", "GuessMainPID", bus_property_append_bool, "b", &u->service.guess_main_pid }, - BUS_EXEC_STATUS_PROPERTIES("org.freedesktop.systemd1.Service", u->service.main_exec_status, "ExecMain"), - { "org.freedesktop.systemd1.Service", "MainPID", bus_property_append_pid, "u", &u->service.main_pid }, - { "org.freedesktop.systemd1.Service", "ControlPID", bus_property_append_pid, "u", &u->service.control_pid }, - { "org.freedesktop.systemd1.Service", "BusName", bus_property_append_string, "s", u->service.bus_name }, - { "org.freedesktop.systemd1.Service", "StatusText", bus_property_append_string, "s", u->service.status_text }, + { "org.freedesktop.systemd1.Service", "Type", bus_service_append_type, "s", &s->type }, + { "org.freedesktop.systemd1.Service", "Restart", bus_service_append_restart, "s", &s->restart }, + { "org.freedesktop.systemd1.Service", "PIDFile", bus_property_append_string, "s", s->pid_file }, + { "org.freedesktop.systemd1.Service", "NotifyAccess", bus_service_append_notify_access, "s", &s->notify_access }, + { "org.freedesktop.systemd1.Service", "RestartUSec", bus_property_append_usec, "t", &s->restart_usec }, + { "org.freedesktop.systemd1.Service", "TimeoutUSec", bus_property_append_usec, "t", &s->timeout_usec }, + BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Service", s->exec_command[SERVICE_EXEC_START_PRE], "ExecStartPre"), + BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Service", s->exec_command[SERVICE_EXEC_START], "ExecStart"), + BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Service", s->exec_command[SERVICE_EXEC_START_POST], "ExecStartPost"), + BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Service", s->exec_command[SERVICE_EXEC_RELOAD], "ExecReload"), + BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Service", s->exec_command[SERVICE_EXEC_STOP], "ExecStop"), + BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Service", s->exec_command[SERVICE_EXEC_STOP_POST], "ExecStopPost"), + BUS_EXEC_CONTEXT_PROPERTIES("org.freedesktop.systemd1.Service", s->exec_context), + { "org.freedesktop.systemd1.Service", "PermissionsStartOnly", bus_property_append_bool, "b", &s->permissions_start_only }, + { "org.freedesktop.systemd1.Service", "RootDirectoryStartOnly", bus_property_append_bool, "b", &s->root_directory_start_only }, + { "org.freedesktop.systemd1.Service", "RemainAfterExit", bus_property_append_bool, "b", &s->remain_after_exit }, + { "org.freedesktop.systemd1.Service", "GuessMainPID", bus_property_append_bool, "b", &s->guess_main_pid }, + BUS_EXEC_STATUS_PROPERTIES("org.freedesktop.systemd1.Service", s->main_exec_status, "ExecMain"), + { "org.freedesktop.systemd1.Service", "MainPID", bus_property_append_pid, "u", &s->main_pid }, + { "org.freedesktop.systemd1.Service", "ControlPID", bus_property_append_pid, "u", &s->control_pid }, + { "org.freedesktop.systemd1.Service", "BusName", bus_property_append_string, "s", s->bus_name }, + { "org.freedesktop.systemd1.Service", "StatusText", bus_property_append_string, "s", s->status_text }, #ifdef HAVE_SYSV_COMPAT - { "org.freedesktop.systemd1.Service", "SysVRunLevels", bus_property_append_string, "s", u->service.sysv_runlevels }, - { "org.freedesktop.systemd1.Service", "SysVStartPriority", bus_property_append_int, "i", &u->service.sysv_start_priority }, - { "org.freedesktop.systemd1.Service", "SysVPath", bus_property_append_string, "s", u->service.sysv_path }, + { "org.freedesktop.systemd1.Service", "SysVRunLevels", bus_property_append_string, "s", s->sysv_runlevels }, + { "org.freedesktop.systemd1.Service", "SysVStartPriority", bus_property_append_int, "i", &s->sysv_start_priority }, + { "org.freedesktop.systemd1.Service", "SysVPath", bus_property_append_string, "s", s->sysv_path }, #endif - { "org.freedesktop.systemd1.Service", "FsckPassNo", bus_property_append_int, "i", &u->service.fsck_passno }, + { "org.freedesktop.systemd1.Service", "FsckPassNo", bus_property_append_int, "i", &s->fsck_passno }, { NULL, NULL, NULL, NULL, NULL } }; |