diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-04-29 18:35:10 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-04-29 18:36:25 +0200 |
commit | 190700621f95160d364f8ec1d3e360246c41ce75 (patch) | |
tree | 783c3b43bd6fd93892fada76f5c20112a4e73d7c /src/timedate | |
parent | b53c3c2d24ed1398ee427139cd880b07bc35fa24 (diff) | |
download | systemd-190700621f95160d364f8ec1d3e360246c41ce75.tar.gz |
sd-bus: drop bus parameter from message callback prototype
This should simplify the prototype a bit. The bus parameter is redundant
in most cases, and in the few where it matters it can be derived from
the message via sd_bus_message_get_bus().
Diffstat (limited to 'src/timedate')
-rw-r--r-- | src/timedate/timedated.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c index d48fc822e2..187522e596 100644 --- a/src/timedate/timedated.c +++ b/src/timedate/timedated.c @@ -357,14 +357,13 @@ static int property_get_ntp_sync( return sd_bus_message_append(reply, "b", ntp_synced()); } -static int method_set_timezone(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus_error *error) { +static int method_set_timezone(sd_bus_message *m, void *userdata, sd_bus_error *error) { Context *c = userdata; const char *z; int interactive; char *t; int r; - assert(bus); assert(m); assert(c); @@ -424,18 +423,17 @@ static int method_set_timezone(sd_bus *bus, sd_bus_message *m, void *userdata, s LOG_MESSAGE("Changed time zone to '%s'.", c->zone), NULL); - sd_bus_emit_properties_changed(bus, "/org/freedesktop/timedate1", "org.freedesktop.timedate1", "Timezone", NULL); + (void) sd_bus_emit_properties_changed(sd_bus_message_get_bus(m), "/org/freedesktop/timedate1", "org.freedesktop.timedate1", "Timezone", NULL); return sd_bus_reply_method_return(m, NULL); } -static int method_set_local_rtc(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus_error *error) { +static int method_set_local_rtc(sd_bus_message *m, void *userdata, sd_bus_error *error) { int lrtc, fix_system, interactive; Context *c = userdata; struct timespec ts; int r; - assert(bus); assert(m); assert(c); @@ -514,12 +512,12 @@ static int method_set_local_rtc(sd_bus *bus, sd_bus_message *m, void *userdata, log_info("RTC configured to %s time.", c->local_rtc ? "local" : "UTC"); - sd_bus_emit_properties_changed(bus, "/org/freedesktop/timedate1", "org.freedesktop.timedate1", "LocalRTC", NULL); + (void) sd_bus_emit_properties_changed(sd_bus_message_get_bus(m), "/org/freedesktop/timedate1", "org.freedesktop.timedate1", "LocalRTC", NULL); return sd_bus_reply_method_return(m, NULL); } -static int method_set_time(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus_error *error) { +static int method_set_time(sd_bus_message *m, void *userdata, sd_bus_error *error) { int relative, interactive; Context *c = userdata; int64_t utc; @@ -528,7 +526,6 @@ static int method_set_time(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bu struct tm* tm; int r; - assert(bus); assert(m); assert(c); @@ -605,11 +602,14 @@ static int method_set_time(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bu return sd_bus_reply_method_return(m, NULL); } -static int method_set_ntp(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus_error *error) { +static int method_set_ntp(sd_bus_message *m, void *userdata, sd_bus_error *error) { int enabled, interactive; Context *c = userdata; int r; + assert(m); + assert(c); + r = sd_bus_message_read(m, "bb", &enabled, &interactive); if (r < 0) return r; @@ -630,18 +630,18 @@ static int method_set_ntp(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus if (r == 0) return 1; - r = context_enable_ntp(bus, error, enabled); + r = context_enable_ntp(sd_bus_message_get_bus(m), error, enabled); if (r < 0) return r; - r = context_start_ntp(bus, error, enabled); + r = context_start_ntp(sd_bus_message_get_bus(m), error, enabled); if (r < 0) return r; c->use_ntp = enabled; log_info("Set NTP to %s", enabled ? "enabled" : "disabled"); - sd_bus_emit_properties_changed(bus, "/org/freedesktop/timedate1", "org.freedesktop.timedate1", "NTP", NULL); + (void) sd_bus_emit_properties_changed(sd_bus_message_get_bus(m), "/org/freedesktop/timedate1", "org.freedesktop.timedate1", "NTP", NULL); return sd_bus_reply_method_return(m, NULL); } |