From 190700621f95160d364f8ec1d3e360246c41ce75 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 29 Apr 2015 18:35:10 +0200 Subject: 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(). --- src/import/importd.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'src/import') diff --git a/src/import/importd.c b/src/import/importd.c index d4da4b29a2..4f3701f5c5 100644 --- a/src/import/importd.c +++ b/src/import/importd.c @@ -719,7 +719,7 @@ static Transfer *manager_find(Manager *m, TransferType type, const char *dkr_ind return NULL; } -static int method_import_tar_or_raw(sd_bus *bus, sd_bus_message *msg, void *userdata, sd_bus_error *error) { +static int method_import_tar_or_raw(sd_bus_message *msg, void *userdata, sd_bus_error *error) { _cleanup_(transfer_unrefp) Transfer *t = NULL; int fd, force, read_only, r; const char *local, *object; @@ -727,6 +727,9 @@ static int method_import_tar_or_raw(sd_bus *bus, sd_bus_message *msg, void *user TransferType type; uint32_t id; + assert(msg); + assert(m); + r = bus_verify_polkit_async( msg, CAP_SYS_ADMIN, @@ -780,7 +783,7 @@ static int method_import_tar_or_raw(sd_bus *bus, sd_bus_message *msg, void *user return sd_bus_reply_method_return(msg, "uo", id, object); } -static int method_export_tar_or_raw(sd_bus *bus, sd_bus_message *msg, void *userdata, sd_bus_error *error) { +static int method_export_tar_or_raw(sd_bus_message *msg, void *userdata, sd_bus_error *error) { _cleanup_(transfer_unrefp) Transfer *t = NULL; int fd, r; const char *local, *object, *format; @@ -788,6 +791,9 @@ static int method_export_tar_or_raw(sd_bus *bus, sd_bus_message *msg, void *user TransferType type; uint32_t id; + assert(msg); + assert(m); + r = bus_verify_polkit_async( msg, CAP_SYS_ADMIN, @@ -841,7 +847,7 @@ static int method_export_tar_or_raw(sd_bus *bus, sd_bus_message *msg, void *user return sd_bus_reply_method_return(msg, "uo", id, object); } -static int method_pull_tar_or_raw(sd_bus *bus, sd_bus_message *msg, void *userdata, sd_bus_error *error) { +static int method_pull_tar_or_raw(sd_bus_message *msg, void *userdata, sd_bus_error *error) { _cleanup_(transfer_unrefp) Transfer *t = NULL; const char *remote, *local, *verify, *object; Manager *m = userdata; @@ -850,7 +856,6 @@ static int method_pull_tar_or_raw(sd_bus *bus, sd_bus_message *msg, void *userda int force, r; uint32_t id; - assert(bus); assert(msg); assert(m); @@ -924,7 +929,7 @@ static int method_pull_tar_or_raw(sd_bus *bus, sd_bus_message *msg, void *userda return sd_bus_reply_method_return(msg, "uo", id, object); } -static int method_pull_dkr(sd_bus *bus, sd_bus_message *msg, void *userdata, sd_bus_error *error) { +static int method_pull_dkr(sd_bus_message *msg, void *userdata, sd_bus_error *error) { _cleanup_(transfer_unrefp) Transfer *t = NULL; const char *index_url, *remote, *tag, *local, *verify, *object; Manager *m = userdata; @@ -932,7 +937,6 @@ static int method_pull_dkr(sd_bus *bus, sd_bus_message *msg, void *userdata, sd_ int force, r; uint32_t id; - assert(bus); assert(msg); assert(m); @@ -1023,14 +1027,13 @@ static int method_pull_dkr(sd_bus *bus, sd_bus_message *msg, void *userdata, sd_ return sd_bus_reply_method_return(msg, "uo", id, object); } -static int method_list_transfers(sd_bus *bus, sd_bus_message *msg, void *userdata, sd_bus_error *error) { +static int method_list_transfers(sd_bus_message *msg, void *userdata, sd_bus_error *error) { _cleanup_bus_message_unref_ sd_bus_message *reply = NULL; Manager *m = userdata; Transfer *t; Iterator i; int r; - assert(bus); assert(msg); assert(m); @@ -1061,14 +1064,13 @@ static int method_list_transfers(sd_bus *bus, sd_bus_message *msg, void *userdat if (r < 0) return r; - return sd_bus_send(bus, reply, NULL); + return sd_bus_send(sd_bus_message_get_bus(msg), reply, NULL); } -static int method_cancel(sd_bus *bus, sd_bus_message *msg, void *userdata, sd_bus_error *error) { +static int method_cancel(sd_bus_message *msg, void *userdata, sd_bus_error *error) { Transfer *t = userdata; int r; - assert(bus); assert(msg); assert(t); @@ -1092,13 +1094,12 @@ static int method_cancel(sd_bus *bus, sd_bus_message *msg, void *userdata, sd_bu return sd_bus_reply_method_return(msg, NULL); } -static int method_cancel_transfer(sd_bus *bus, sd_bus_message *msg, void *userdata, sd_bus_error *error) { +static int method_cancel_transfer(sd_bus_message *msg, void *userdata, sd_bus_error *error) { Manager *m = userdata; Transfer *t; uint32_t id; int r; - assert(bus); assert(msg); assert(m); -- cgit v1.2.3