From ac155bb885f9ea8aac3979a6b2686f0c8a9cc6e3 Mon Sep 17 00:00:00 2001 From: Michal Schmidt Date: Sun, 15 Jan 2012 12:04:08 +0100 Subject: 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. --- src/dbus-path.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/dbus-path.c') diff --git a/src/dbus-path.c b/src/dbus-path.c index f67b5a2b7c..53a5b420d5 100644 --- a/src/dbus-path.c +++ b/src/dbus-path.c @@ -80,24 +80,26 @@ static int bus_path_append_paths(DBusMessageIter *i, const char *property, void static int bus_path_append_unit(DBusMessageIter *i, const char *property, void *data) { Unit *u = data; + Path *p = PATH(u); const char *t; assert(i); assert(property); assert(u); - t = UNIT_DEREF(u->path.unit) ? UNIT_DEREF(u->path.unit)->meta.id : ""; + t = UNIT_DEREF(p->unit) ? UNIT_DEREF(p->unit)->id : ""; return dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, &t) ? 0 : -ENOMEM; } DBusHandlerResult bus_path_message_handler(Unit *u, DBusConnection *c, DBusMessage *message) { + Path *p = PATH(u); const BusProperty properties[] = { BUS_UNIT_PROPERTIES, - { "org.freedesktop.systemd1.Path", "Unit", bus_path_append_unit, "s", u }, - { "org.freedesktop.systemd1.Path", "Paths", bus_path_append_paths, "a(ss)", u }, - { "org.freedesktop.systemd1.Path", "MakeDirectory", bus_property_append_bool, "b", &u->path.make_directory }, - { "org.freedesktop.systemd1.Path", "DirectoryMode", bus_property_append_mode, "u", &u->path.directory_mode }, + { "org.freedesktop.systemd1.Path", "Unit", bus_path_append_unit, "s", u }, + { "org.freedesktop.systemd1.Path", "Paths", bus_path_append_paths, "a(ss)", u }, + { "org.freedesktop.systemd1.Path", "MakeDirectory", bus_property_append_bool, "b", &p->make_directory }, + { "org.freedesktop.systemd1.Path", "DirectoryMode", bus_property_append_mode, "u", &p->directory_mode }, { NULL, NULL, NULL, NULL, NULL } }; -- cgit v1.2.3-54-g00ecf