X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fdbus-job.c;h=ab6d610243ef12ce54b284276c4afe5312b83a4a;hp=2308be34fd09a2eb028e3747095b581148e45c04;hb=0071d9f1db6dc9a1035cf5afb81455b67ed462f6;hpb=bfebab7f69cb23f3a488f02bc2be9c8309808221 diff --git a/src/dbus-job.c b/src/dbus-job.c index 2308be34f..ab6d61024 100644 --- a/src/dbus-job.c +++ b/src/dbus-job.c @@ -71,7 +71,7 @@ static int bus_job_append_unit(DBusMessageIter *i, const char *property, void *d if (!(p = unit_dbus_path(j->unit))) return -ENOMEM; - if (!dbus_message_iter_append_basic(&sub, DBUS_TYPE_STRING, &j->unit->meta.id) || + if (!dbus_message_iter_append_basic(&sub, DBUS_TYPE_STRING, &j->unit->id) || !dbus_message_iter_append_basic(&sub, DBUS_TYPE_OBJECT_PATH, &p)) { free(p); return -ENOMEM; @@ -85,15 +85,15 @@ static int bus_job_append_unit(DBusMessageIter *i, const char *property, void *d return 0; } -static DBusHandlerResult bus_job_message_dispatch(Job *j, DBusConnection *connection, DBusMessage *message) { - const BusProperty properties[] = { - { "org.freedesktop.systemd1.Job", "Id", bus_property_append_uint32, "u", &j->id }, - { "org.freedesktop.systemd1.Job", "State", bus_job_append_state, "s", &j->state }, - { "org.freedesktop.systemd1.Job", "JobType", bus_job_append_type, "s", &j->type }, - { "org.freedesktop.systemd1.Job", "Unit", bus_job_append_unit, "(so)", j }, - { NULL, NULL, NULL, NULL, NULL } - }; +static const BusProperty bus_job_properties[] = { + { "Id", bus_property_append_uint32, "u", offsetof(Job, id) }, + { "State", bus_job_append_state, "s", offsetof(Job, state) }, + { "JobType", bus_job_append_type, "s", offsetof(Job, type) }, + { "Unit", bus_job_append_unit, "(so)", 0 }, + { NULL, } +}; +static DBusHandlerResult bus_job_message_dispatch(Job *j, DBusConnection *connection, DBusMessage *message) { DBusMessage *reply = NULL; if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Job", "Cancel")) { @@ -102,8 +102,13 @@ static DBusHandlerResult bus_job_message_dispatch(Job *j, DBusConnection *connec job_finish_and_invalidate(j, JOB_CANCELED); - } else - return bus_default_message_handler(connection, message, INTROSPECTION, INTERFACES_LIST, properties); + } else { + const BusBoundProperties bps[] = { + { "org.freedesktop.systemd1.Job", bus_job_properties, j }, + { NULL, } + }; + return bus_default_message_handler(connection, message, INTROSPECTION, INTERFACES_LIST, bps); + } if (reply) { if (!dbus_connection_send(connection, reply, NULL))