From 72e6110485926c884f056717a21e4f5f3942908c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 26 Jan 2015 17:48:14 +0100 Subject: sd-bus: reuse the KDBUS_CMD_FREE wrapper wherever appropriate --- src/libsystemd/sd-bus/bus-kernel.c | 9 +-------- src/libsystemd/sd-bus/bus-message.c | 10 ++-------- 2 files changed, 3 insertions(+), 16 deletions(-) (limited to 'src/libsystemd') diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c index e73a5077b5..b4d0af102f 100644 --- a/src/libsystemd/sd-bus/bus-kernel.c +++ b/src/libsystemd/sd-bus/bus-kernel.c @@ -822,10 +822,6 @@ fail: } int bus_kernel_take_fd(sd_bus *b) { - struct kdbus_cmd_free cmd_free = { - .size = sizeof(cmd_free), - .flags = 0, - }; struct kdbus_bloom_parameter *bloom = NULL; struct kdbus_cmd_hello *hello; struct kdbus_item_list *items; @@ -989,12 +985,10 @@ int bus_kernel_take_fd(sd_bus *b) { /* free returned items */ (void) bus_kernel_cmd_free(b, hello->offset); - return bus_start_running(b); fail: - cmd_free.offset = hello->offset; - (void) ioctl(b->input_fd, KDBUS_CMD_FREE, &cmd_free); + (void) bus_kernel_cmd_free(b, hello->offset); return r; } @@ -1019,7 +1013,6 @@ int bus_kernel_connect(sd_bus *b) { int bus_kernel_cmd_free(sd_bus *bus, uint64_t offset) { struct kdbus_cmd_free cmd = { .size = sizeof(cmd), - .flags = 0, .offset = offset, }; int r; diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c index 9ae65bebc8..3f2d6e74c5 100644 --- a/src/libsystemd/sd-bus/bus-message.c +++ b/src/libsystemd/sd-bus/bus-message.c @@ -129,14 +129,8 @@ static void message_free(sd_bus_message *m) { message_reset_parts(m); - if (m->release_kdbus) { - struct kdbus_cmd_free cmd_free = { }; - - cmd_free.size = sizeof(cmd_free); - cmd_free.flags = 0; - cmd_free.offset = (uint8_t *)m->kdbus - (uint8_t *)m->bus->kdbus_buffer; - (void) ioctl(m->bus->input_fd, KDBUS_CMD_FREE, &cmd_free); - } + if (m->release_kdbus) + bus_kernel_cmd_free(m->bus, (uint8_t *) m->kdbus - (uint8_t *) m->bus->kdbus_buffer); if (m->free_kdbus) free(m->kdbus); -- cgit v1.2.3-54-g00ecf