diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-11-21 01:51:16 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-11-21 02:07:35 +0100 |
commit | df2d202e6ed4001a21c6512c244acad5d4706c87 (patch) | |
tree | 904e30d8bb07a8430b238d26276d7c2d82d2c1ba /src/libsystemd-bus | |
parent | 28383ba18963cdedd98ced271b3425f7321119b7 (diff) |
bus: let's simplify things by getting rid of unnecessary bus parameters
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r-- | src/libsystemd-bus/bus-convenience.c | 46 | ||||
-rw-r--r-- | src/libsystemd-bus/bus-introspect.c | 2 | ||||
-rw-r--r-- | src/libsystemd-bus/bus-kernel.c | 3 | ||||
-rw-r--r-- | src/libsystemd-bus/bus-message.c | 29 | ||||
-rw-r--r-- | src/libsystemd-bus/bus-message.h | 2 | ||||
-rw-r--r-- | src/libsystemd-bus/bus-objects.c | 24 | ||||
-rw-r--r-- | src/libsystemd-bus/bus-socket.c | 3 | ||||
-rw-r--r-- | src/libsystemd-bus/sd-bus.c | 8 | ||||
-rw-r--r-- | src/libsystemd-bus/test-bus-chat.c | 14 | ||||
-rw-r--r-- | src/libsystemd-bus/test-bus-kernel-benchmark.c | 4 | ||||
-rw-r--r-- | src/libsystemd-bus/test-bus-marshal.c | 2 | ||||
-rw-r--r-- | src/libsystemd-bus/test-bus-objects.c | 10 | ||||
-rw-r--r-- | src/libsystemd-bus/test-bus-server.c | 4 |
13 files changed, 71 insertions, 80 deletions
diff --git a/src/libsystemd-bus/bus-convenience.c b/src/libsystemd-bus/bus-convenience.c index 9bf2e2cbe5..6446874713 100644 --- a/src/libsystemd-bus/bus-convenience.c +++ b/src/libsystemd-bus/bus-convenience.c @@ -91,24 +91,22 @@ _public_ int sd_bus_call_method( } _public_ int sd_bus_reply_method_return( - sd_bus *bus, sd_bus_message *call, const char *types, ...) { _cleanup_bus_message_unref_ sd_bus_message *m = NULL; int r; - assert_return(bus, -EINVAL); assert_return(call, -EINVAL); assert_return(call->sealed, -EPERM); assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); - assert_return(!bus_pid_changed(bus), -ECHILD); + assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(call->bus), -ECHILD); if (call->header->flags & SD_BUS_MESSAGE_NO_REPLY_EXPECTED) return 0; - r = sd_bus_message_new_method_return(bus, call, &m); + r = sd_bus_message_new_method_return(call, &m); if (r < 0) return r; @@ -122,37 +120,34 @@ _public_ int sd_bus_reply_method_return( return r; } - return sd_bus_send(bus, m, NULL); + return sd_bus_send(call->bus, m, NULL); } _public_ int sd_bus_reply_method_error( - sd_bus *bus, sd_bus_message *call, const sd_bus_error *e) { _cleanup_bus_message_unref_ sd_bus_message *m = NULL; int r; - assert_return(bus, -EINVAL); assert_return(call, -EINVAL); assert_return(call->sealed, -EPERM); assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL); assert_return(sd_bus_error_is_set(e), -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); - assert_return(!bus_pid_changed(bus), -ECHILD); + assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(call->bus), -ECHILD); if (call->header->flags & SD_BUS_MESSAGE_NO_REPLY_EXPECTED) return 0; - r = sd_bus_message_new_method_error(bus, call, e, &m); + r = sd_bus_message_new_method_error(call, e, &m); if (r < 0) return r; - return sd_bus_send(bus, m, NULL); + return sd_bus_send(call->bus, m, NULL); } _public_ int sd_bus_reply_method_errorf( - sd_bus *bus, sd_bus_message *call, const char *name, const char *format, @@ -162,12 +157,11 @@ _public_ int sd_bus_reply_method_errorf( va_list ap; int r; - assert_return(bus, -EINVAL); assert_return(call, -EINVAL); assert_return(call->sealed, -EPERM); assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); - assert_return(!bus_pid_changed(bus), -ECHILD); + assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(call->bus), -ECHILD); if (call->header->flags & SD_BUS_MESSAGE_NO_REPLY_EXPECTED) return 0; @@ -179,37 +173,34 @@ _public_ int sd_bus_reply_method_errorf( if (r < 0) return r; - return sd_bus_reply_method_error(bus, call, &error); + return sd_bus_reply_method_error(call, &error); } _public_ int sd_bus_reply_method_errno( - sd_bus *bus, sd_bus_message *call, int error, const sd_bus_error *p) { _cleanup_bus_error_free_ sd_bus_error berror = SD_BUS_ERROR_NULL; - assert_return(bus, -EINVAL); assert_return(call, -EINVAL); assert_return(call->sealed, -EPERM); assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); - assert_return(!bus_pid_changed(bus), -ECHILD); + assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(call->bus), -ECHILD); if (call->header->flags & SD_BUS_MESSAGE_NO_REPLY_EXPECTED) return 0; if (sd_bus_error_is_set(p)) - return sd_bus_reply_method_error(bus, call, p); + return sd_bus_reply_method_error(call, p); sd_bus_error_set_errno(&berror, error); - return sd_bus_reply_method_error(bus, call, &berror); + return sd_bus_reply_method_error(call, &berror); } _public_ int sd_bus_reply_method_errnof( - sd_bus *bus, sd_bus_message *call, int error, const char *format, @@ -218,12 +209,11 @@ _public_ int sd_bus_reply_method_errnof( _cleanup_bus_error_free_ sd_bus_error berror = SD_BUS_ERROR_NULL; va_list ap; - assert_return(bus, -EINVAL); assert_return(call, -EINVAL); assert_return(call->sealed, -EPERM); assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); - assert_return(!bus_pid_changed(bus), -ECHILD); + assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(call->bus), -ECHILD); if (call->header->flags & SD_BUS_MESSAGE_NO_REPLY_EXPECTED) return 0; @@ -232,7 +222,7 @@ _public_ int sd_bus_reply_method_errnof( bus_error_set_errnofv(&berror, error, format, ap); va_end(ap); - return sd_bus_reply_method_error(bus, call, &berror); + return sd_bus_reply_method_error(call, &berror); } _public_ int sd_bus_get_property( diff --git a/src/libsystemd-bus/bus-introspect.c b/src/libsystemd-bus/bus-introspect.c index 4c6031729a..1965364cd0 100644 --- a/src/libsystemd-bus/bus-introspect.c +++ b/src/libsystemd-bus/bus-introspect.c @@ -169,7 +169,7 @@ int introspect_finish(struct introspect *i, sd_bus *bus, sd_bus_message *m, sd_b if (ferror(i->f)) return -ENOMEM; - r = sd_bus_message_new_method_return(bus, m, &q); + r = sd_bus_message_new_method_return(m, &q); if (r < 0) return r; diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c index bf8de04ab6..da9474dc51 100644 --- a/src/libsystemd-bus/bus-kernel.c +++ b/src/libsystemd-bus/bus-kernel.c @@ -485,7 +485,7 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k, sd_bus_mess if (n_bytes != total) return -EBADMSG; - r = bus_message_from_header(h, sizeof(struct bus_header), fds, n_fds, NULL, seclabel, 0, &m); + r = bus_message_from_header(bus, h, sizeof(struct bus_header), fds, n_fds, NULL, seclabel, 0, &m); if (r < 0) return r; @@ -603,7 +603,6 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k, sd_bus_mess /* We take possession of the kmsg struct now */ m->kdbus = k; - m->bus = sd_bus_ref(bus); m->release_kdbus = true; m->free_fds = true; diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c index 666307cc6e..4aa7dde05c 100644 --- a/src/libsystemd-bus/bus-message.c +++ b/src/libsystemd-bus/bus-message.c @@ -305,6 +305,7 @@ static int message_append_field_uint32(sd_bus_message *m, uint8_t h, uint32_t x) } int bus_message_from_header( + sd_bus *bus, void *buffer, size_t length, int *fds, @@ -368,11 +369,15 @@ int bus_message_from_header( memcpy(m->label, label, label_sz + 1); } + if (bus) + m->bus = sd_bus_ref(bus); + *ret = m; return 0; } int bus_message_from_malloc( + sd_bus *bus, void *buffer, size_t length, int *fds, @@ -384,7 +389,7 @@ int bus_message_from_malloc( sd_bus_message *m; int r; - r = bus_message_from_header(buffer, length, fds, n_fds, ucred, label, 0, &m); + r = bus_message_from_header(bus, buffer, length, fds, n_fds, ucred, label, 0, &m); if (r < 0) return r; @@ -530,7 +535,6 @@ fail: } static int message_new_reply( - sd_bus *bus, sd_bus_message *call, uint8_t type, sd_bus_message **m) { @@ -538,13 +542,13 @@ static int message_new_reply( sd_bus_message *t; int r; - assert_return(!bus || bus->state != BUS_UNSET, -ENOTCONN); assert_return(call, -EINVAL); assert_return(call->sealed, -EPERM); assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL); + assert_return(!call->bus || call->bus->state != BUS_UNSET, -ENOTCONN); assert_return(m, -EINVAL); - t = message_new(bus, type); + t = message_new(call->bus, type); if (!t) return -ENOMEM; @@ -572,15 +576,13 @@ fail: } _public_ int sd_bus_message_new_method_return( - sd_bus *bus, sd_bus_message *call, sd_bus_message **m) { - return message_new_reply(bus, call, SD_BUS_MESSAGE_METHOD_RETURN, m); + return message_new_reply(call, SD_BUS_MESSAGE_METHOD_RETURN, m); } _public_ int sd_bus_message_new_method_error( - sd_bus *bus, sd_bus_message *call, const sd_bus_error *e, sd_bus_message **m) { @@ -591,7 +593,7 @@ _public_ int sd_bus_message_new_method_error( assert_return(sd_bus_error_is_set(e), -EINVAL); assert_return(m, -EINVAL); - r = message_new_reply(bus, call, SD_BUS_MESSAGE_METHOD_ERROR, &t); + r = message_new_reply(call, SD_BUS_MESSAGE_METHOD_ERROR, &t); if (r < 0) return r; @@ -614,7 +616,6 @@ fail: } _public_ int sd_bus_message_new_method_errorf( - sd_bus *bus, sd_bus_message *call, sd_bus_message **m, const char *name, @@ -635,11 +636,10 @@ _public_ int sd_bus_message_new_method_errorf( if (r < 0) return r; - return sd_bus_message_new_method_error(bus, call, &error, m); + return sd_bus_message_new_method_error(call, &error, m); } _public_ int sd_bus_message_new_method_errno( - sd_bus *bus, sd_bus_message *call, int error, const sd_bus_error *p, @@ -648,15 +648,14 @@ _public_ int sd_bus_message_new_method_errno( _cleanup_free_ sd_bus_error berror = SD_BUS_ERROR_NULL; if (sd_bus_error_is_set(p)) - return sd_bus_message_new_method_error(bus, call, p, m); + return sd_bus_message_new_method_error(call, p, m); sd_bus_error_set_errno(&berror, error); - return sd_bus_message_new_method_error(bus, call, &berror, m); + return sd_bus_message_new_method_error(call, &berror, m); } _public_ int sd_bus_message_new_method_errnof( - sd_bus *bus, sd_bus_message *call, sd_bus_message **m, int error, @@ -674,7 +673,7 @@ _public_ int sd_bus_message_new_method_errnof( if (r < 0) return r; - return sd_bus_message_new_method_error(bus, call, &berror, m); + return sd_bus_message_new_method_error(call, &berror, m); } int bus_message_new_synthetic_error( diff --git a/src/libsystemd-bus/bus-message.h b/src/libsystemd-bus/bus-message.h index aec6f75857..8c0ba86213 100644 --- a/src/libsystemd-bus/bus-message.h +++ b/src/libsystemd-bus/bus-message.h @@ -194,6 +194,7 @@ int bus_message_get_blob(sd_bus_message *m, void **buffer, size_t *sz); int bus_message_read_strv_extend(sd_bus_message *m, char ***l); int bus_message_from_header( + sd_bus *bus, void *header, size_t length, int *fds, @@ -204,6 +205,7 @@ int bus_message_from_header( sd_bus_message **ret); int bus_message_from_malloc( + sd_bus *bus, void *buffer, size_t length, int *fds, diff --git a/src/libsystemd-bus/bus-objects.c b/src/libsystemd-bus/bus-objects.c index a6e8b2de86..d9be3ddbfc 100644 --- a/src/libsystemd-bus/bus-objects.c +++ b/src/libsystemd-bus/bus-objects.c @@ -289,7 +289,7 @@ static int method_callbacks_run( return -EINVAL; if (!streq(strempty(c->vtable->x.method.signature), signature)) { - r = sd_bus_reply_method_errorf(bus, m, + r = sd_bus_reply_method_errorf(m, SD_BUS_ERROR_INVALID_ARGS, "Invalid arguments '%s' to call %s:%s, expecting '%s'.", signature, c->interface, c->member, strempty(c->vtable->x.method.signature)); @@ -303,7 +303,7 @@ static int method_callbacks_run( return c->vtable->x.method.handler(bus, m, u); /* If the method callback is NULL, make this a successful NOP */ - r = sd_bus_reply_method_return(bus, m, NULL); + r = sd_bus_reply_method_return(m, NULL); if (r < 0) return r; @@ -449,7 +449,7 @@ static int property_get_set_callbacks_run( *found_object = true; - r = sd_bus_message_new_method_return(bus, m, &reply); + r = sd_bus_message_new_method_return(m, &reply); if (r < 0) return r; @@ -470,7 +470,7 @@ static int property_get_set_callbacks_run( return r; if (sd_bus_error_is_set(&error)) { - r = sd_bus_reply_method_error(bus, m, &error); + r = sd_bus_reply_method_error(m, &error); if (r < 0) return r; @@ -507,7 +507,7 @@ static int property_get_set_callbacks_run( } if (sd_bus_error_is_set(&error)) { - r = sd_bus_reply_method_error(bus, m, &error); + r = sd_bus_reply_method_error(m, &error); if (r < 0) return r; @@ -598,7 +598,7 @@ static int property_get_all_callbacks_run( assert(m); assert(found_object); - r = sd_bus_message_new_method_return(bus, m, &reply); + r = sd_bus_message_new_method_return(m, &reply); if (r < 0) return r; @@ -637,7 +637,7 @@ static int property_get_all_callbacks_run( return r; if (sd_bus_error_is_set(&error)) { - r = sd_bus_reply_method_error(bus, m, &error); + r = sd_bus_reply_method_error(m, &error); if (r < 0) return r; @@ -649,7 +649,7 @@ static int property_get_all_callbacks_run( if (!found_interface) { r = sd_bus_reply_method_errorf( - bus, m, + m, SD_BUS_ERROR_UNKNOWN_INTERFACE, "Unknown interface '%s'.", iface); if (r < 0) @@ -1004,7 +1004,7 @@ static int process_get_managed_objects( if (bus->nodes_modified) return 0; - r = sd_bus_message_new_method_return(bus, m, &reply); + r = sd_bus_message_new_method_return(m, &reply); if (r < 0) return r; @@ -1048,7 +1048,7 @@ static int process_get_managed_objects( return -ENOMEM; if (sd_bus_error_is_set(&error)) { - r = sd_bus_reply_method_error(bus, m, &error); + r = sd_bus_reply_method_error(m, &error); if (r < 0) return r; @@ -1232,12 +1232,12 @@ int bus_process_object(sd_bus *bus, sd_bus_message *m) { if (sd_bus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "Get") || sd_bus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "Set")) r = sd_bus_reply_method_errorf( - bus, m, + m, SD_BUS_ERROR_UNKNOWN_PROPERTY, "Unknown property or interface."); else r = sd_bus_reply_method_errorf( - bus, m, + m, SD_BUS_ERROR_UNKNOWN_METHOD, "Unknown method '%s' or interface '%s'.", m->member, m->interface); diff --git a/src/libsystemd-bus/bus-socket.c b/src/libsystemd-bus/bus-socket.c index b7e816ea80..60d9ad41c3 100644 --- a/src/libsystemd-bus/bus-socket.c +++ b/src/libsystemd-bus/bus-socket.c @@ -909,7 +909,8 @@ static int bus_socket_make_message(sd_bus *bus, size_t size, sd_bus_message **m) } else b = NULL; - r = bus_message_from_malloc(bus->rbuffer, size, + r = bus_message_from_malloc(bus, + bus->rbuffer, size, bus->fds, bus->n_fds, bus->ucred_valid ? &bus->ucred : NULL, bus->label[0] ? bus->label : NULL, diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c index 0ae52563e7..9374be93ca 100644 --- a/src/libsystemd-bus/sd-bus.c +++ b/src/libsystemd-bus/sd-bus.c @@ -1986,7 +1986,7 @@ static int process_builtin(sd_bus *bus, sd_bus_message *m) { return 1; if (streq_ptr(m->member, "Ping")) - r = sd_bus_message_new_method_return(bus, m, &reply); + r = sd_bus_message_new_method_return(m, &reply); else if (streq_ptr(m->member, "GetMachineId")) { sd_id128_t id; char sid[33]; @@ -1995,14 +1995,14 @@ static int process_builtin(sd_bus *bus, sd_bus_message *m) { if (r < 0) return r; - r = sd_bus_message_new_method_return(bus, m, &reply); + r = sd_bus_message_new_method_return(m, &reply); if (r < 0) return r; r = sd_bus_message_append(reply, "s", sd_id128_to_string(id, sid)); } else { r = sd_bus_message_new_method_errorf( - bus, m, &reply, + m, &reply, SD_BUS_ERROR_UNKNOWN_METHOD, "Unknown method '%s' on interface '%s'.", m->member, m->interface); } @@ -2097,7 +2097,7 @@ static int process_running(sd_bus *bus, sd_bus_message **ret) { if (m->header->type == SD_BUS_MESSAGE_METHOD_CALL) { r = sd_bus_reply_method_errorf( - bus, m, + m, SD_BUS_ERROR_UNKNOWN_OBJECT, "Unknown object '%s'.", m->path); if (r < 0) diff --git a/src/libsystemd-bus/test-bus-chat.c b/src/libsystemd-bus/test-bus-chat.c index 67411f1184..8c344f6edb 100644 --- a/src/libsystemd-bus/test-bus-chat.c +++ b/src/libsystemd-bus/test-bus-chat.c @@ -52,7 +52,7 @@ static int object_callback(sd_bus *bus, sd_bus_message *m, void *userdata) { if (sd_bus_message_is_method_call(m, "org.object.test", "Foobar")) { log_info("Invoked Foobar() on %s", sd_bus_message_get_path(m)); - r = sd_bus_reply_method_return(bus, m, NULL); + r = sd_bus_reply_method_return(m, NULL); if (r < 0) { log_error("Failed to send reply: %s", strerror(-r)); return r; @@ -185,14 +185,14 @@ static int server(sd_bus *bus) { ascii_strlower(lowercase); - r = sd_bus_reply_method_return(bus, m, "s", lowercase); + r = sd_bus_reply_method_return(m, "s", lowercase); if (r < 0) { log_error("Failed to send reply: %s", strerror(-r)); goto fail; } } else if (sd_bus_message_is_method_call(m, "org.freedesktop.systemd.test", "ExitClient1")) { - r = sd_bus_reply_method_return(bus, m, NULL); + r = sd_bus_reply_method_return(m, NULL); if (r < 0) { log_error("Failed to send reply: %s", strerror(-r)); goto fail; @@ -201,7 +201,7 @@ static int server(sd_bus *bus) { client1_gone = true; } else if (sd_bus_message_is_method_call(m, "org.freedesktop.systemd.test", "ExitClient2")) { - r = sd_bus_reply_method_return(bus, m, NULL); + r = sd_bus_reply_method_return(m, NULL); if (r < 0) { log_error("Failed to send reply: %s", strerror(-r)); goto fail; @@ -212,7 +212,7 @@ static int server(sd_bus *bus) { sleep(1); - r = sd_bus_reply_method_return(bus, m, NULL); + r = sd_bus_reply_method_return(m, NULL); if (r < 0) { log_error("Failed to send reply: %s", strerror(-r)); goto fail; @@ -236,7 +236,7 @@ static int server(sd_bus *bus) { goto fail; } - r = sd_bus_reply_method_return(bus, m, NULL); + r = sd_bus_reply_method_return(m, NULL); if (r < 0) { log_error("Failed to send reply: %s", strerror(-r)); goto fail; @@ -245,7 +245,7 @@ static int server(sd_bus *bus) { } else if (sd_bus_message_is_method_call(m, NULL, NULL)) { r = sd_bus_reply_method_error( - bus, m, + m, &SD_BUS_ERROR_MAKE(SD_BUS_ERROR_UNKNOWN_METHOD, "Unknown method.")); if (r < 0) { log_error("Failed to send reply: %s", strerror(-r)); diff --git a/src/libsystemd-bus/test-bus-kernel-benchmark.c b/src/libsystemd-bus/test-bus-kernel-benchmark.c index 18b08ed816..6afae7f487 100644 --- a/src/libsystemd-bus/test-bus-kernel-benchmark.c +++ b/src/libsystemd-bus/test-bus-kernel-benchmark.c @@ -52,7 +52,7 @@ static void server(sd_bus *b, size_t *result) { continue; if (sd_bus_message_is_method_call(m, "benchmark.server", "Ping")) - assert_se(sd_bus_reply_method_return(b, m, NULL) >= 0); + assert_se(sd_bus_reply_method_return(m, NULL) >= 0); else if (sd_bus_message_is_method_call(m, "benchmark.server", "Work")) { const void *p; size_t sz; @@ -60,7 +60,7 @@ static void server(sd_bus *b, size_t *result) { /* Make sure the mmap is mapped */ assert_se(sd_bus_message_read_array(m, 'y', &p, &sz) > 0); - assert_se(sd_bus_reply_method_return(b, m, NULL) >= 0); + assert_se(sd_bus_reply_method_return(m, NULL) >= 0); } else if (sd_bus_message_is_method_call(m, "benchmark.server", "Exit")) { uint64_t res; assert_se(sd_bus_message_read(m, "t", &res) > 0); diff --git a/src/libsystemd-bus/test-bus-marshal.c b/src/libsystemd-bus/test-bus-marshal.c index 98737b6811..da072c707f 100644 --- a/src/libsystemd-bus/test-bus-marshal.c +++ b/src/libsystemd-bus/test-bus-marshal.c @@ -172,7 +172,7 @@ int main(int argc, char *argv[]) { m = sd_bus_message_unref(m); - r = bus_message_from_malloc(buffer, sz, NULL, 0, NULL, NULL, &m); + r = bus_message_from_malloc(NULL, buffer, sz, NULL, 0, NULL, NULL, &m); assert_se(r >= 0); bus_message_dump(m, stdout, true); diff --git a/src/libsystemd-bus/test-bus-objects.c b/src/libsystemd-bus/test-bus-objects.c index c9fb846ffd..0e9ef57da1 100644 --- a/src/libsystemd-bus/test-bus-objects.c +++ b/src/libsystemd-bus/test-bus-objects.c @@ -61,7 +61,7 @@ static int something_handler(sd_bus *bus, sd_bus_message *m, void *userdata) { log_info("AlterSomething() called, got %s, returning %s", s, n); - r = sd_bus_reply_method_return(bus, m, "s", n); + r = sd_bus_reply_method_return(m, "s", n); assert_se(r >= 0); return 1; @@ -75,7 +75,7 @@ static int exit_handler(sd_bus *bus, sd_bus_message *m, void *userdata) { log_info("Exit called"); - r = sd_bus_reply_method_return(bus, m, ""); + r = sd_bus_reply_method_return(m, ""); assert_se(r >= 0); return 1; @@ -134,7 +134,7 @@ static int notify_test(sd_bus *bus, sd_bus_message *m, void *userdata) { assert_se(sd_bus_emit_properties_changed(bus, m->path, "org.freedesktop.systemd.ValueTest", "Value", NULL) >= 0); - r = sd_bus_reply_method_return(bus, m, NULL); + r = sd_bus_reply_method_return(m, NULL); assert_se(r >= 0); return 1; @@ -145,7 +145,7 @@ static int emit_interfaces_added(sd_bus *bus, sd_bus_message *m, void *userdata) assert_se(sd_bus_emit_interfaces_added(bus, m->path, "org.freedesktop.systemd.test", NULL) >= 0); - r = sd_bus_reply_method_return(bus, m, NULL); + r = sd_bus_reply_method_return(m, NULL); assert_se(r >= 0); return 1; @@ -156,7 +156,7 @@ static int emit_interfaces_removed(sd_bus *bus, sd_bus_message *m, void *userdat assert_se(sd_bus_emit_interfaces_removed(bus, m->path, "org.freedesktop.systemd.test", NULL) >= 0); - r = sd_bus_reply_method_return(bus, m, NULL); + r = sd_bus_reply_method_return(m, NULL); assert_se(r >= 0); return 1; diff --git a/src/libsystemd-bus/test-bus-server.c b/src/libsystemd-bus/test-bus-server.c index a9db1f4101..33a5dd5f6f 100644 --- a/src/libsystemd-bus/test-bus-server.c +++ b/src/libsystemd-bus/test-bus-server.c @@ -88,7 +88,7 @@ static void *server(void *p) { assert_se((sd_bus_can_send(bus, 'h') >= 1) == (c->server_negotiate_unix_fds && c->client_negotiate_unix_fds)); - r = sd_bus_message_new_method_return(bus, m, &reply); + r = sd_bus_message_new_method_return(m, &reply); if (r < 0) { log_error("Failed to allocate return: %s", strerror(-r)); goto fail; @@ -98,7 +98,7 @@ static void *server(void *p) { } else if (sd_bus_message_is_method_call(m, NULL, NULL)) { r = sd_bus_message_new_method_error( - bus, m, + m, &SD_BUS_ERROR_MAKE(SD_BUS_ERROR_UNKNOWN_METHOD, "Unknown method."), &reply); if (r < 0) { |