diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2014-12-09 11:12:41 +0100 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2014-12-09 11:14:55 +0100 |
commit | 77adde638217112c9e080035197a76f4dc4af700 (patch) | |
tree | 743b8c5e02f65c4002ec3385047b9d639c08fdd3 /src/libsystemd/sd-bus/bus-kernel.c | |
parent | fbf7dcb5886f4077ee0dea618447ab488ff148fc (diff) |
bus: sync with kdbus-git (ABI break)
kdbus-git gained two new features:
* memfd offsets: This allows to specify a 'start' offset in kdbus_memfd
so you can send partial memfd hunks instead of always
the full memfd
* KDBUS_HELLO_UNPRIVILEGED: If passed during HELLO, the client will be
treated as unprivileged.
Diffstat (limited to 'src/libsystemd/sd-bus/bus-kernel.c')
-rw-r--r-- | src/libsystemd/sd-bus/bus-kernel.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c index 3a809e4aa6..98fd4fd3ec 100644 --- a/src/libsystemd/sd-bus/bus-kernel.c +++ b/src/libsystemd/sd-bus/bus-kernel.c @@ -78,7 +78,7 @@ static void append_payload_vec(struct kdbus_item **d, const void *p, size_t sz) *d = (struct kdbus_item *) ((uint8_t*) *d + (*d)->size); } -static void append_payload_memfd(struct kdbus_item **d, int memfd, size_t sz) { +static void append_payload_memfd(struct kdbus_item **d, int memfd, size_t start, size_t sz) { assert(d); assert(memfd >= 0); assert(sz > 0); @@ -87,6 +87,7 @@ static void append_payload_memfd(struct kdbus_item **d, int memfd, size_t sz) { (*d)->size = offsetof(struct kdbus_item, memfd) + sizeof(struct kdbus_memfd); (*d)->type = KDBUS_ITEM_PAYLOAD_MEMFD; (*d)->memfd.fd = memfd; + (*d)->memfd.start = start; (*d)->memfd.size = sz; *d = (struct kdbus_item *) ((uint8_t*) *d + (*d)->size); @@ -263,12 +264,10 @@ static int bus_message_setup_kmsg(sd_bus *b, sd_bus_message *m) { sz = offsetof(struct kdbus_msg, items); - assert_cc(ALIGN8(offsetof(struct kdbus_item, vec) + sizeof(struct kdbus_vec)) == - ALIGN8(offsetof(struct kdbus_item, memfd) + sizeof(struct kdbus_memfd))); - /* Add in fixed header, fields header and payload */ - sz += (1 + m->n_body_parts) * - ALIGN8(offsetof(struct kdbus_item, vec) + sizeof(struct kdbus_vec)); + sz += (1 + m->n_body_parts) * ALIGN8(offsetof(struct kdbus_item, vec) + + MAX(sizeof(struct kdbus_vec), + sizeof(struct kdbus_memfd))); /* Add space for bloom filter */ sz += ALIGN8(offsetof(struct kdbus_item, bloom_filter) + @@ -343,7 +342,7 @@ static int bus_message_setup_kmsg(sd_bus *b, sd_bus_message *m) { /* Try to send a memfd, if the part is * sealed and this is not a broadcast. Since we can only */ - append_payload_memfd(&d, part->memfd, part->size); + append_payload_memfd(&d, part->memfd, part->memfd_offset, part->size); continue; } @@ -544,6 +543,7 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) { } part->memfd = d->memfd.fd; + part->memfd_offset = d->memfd.start; part->size = d->memfd.size; part->sealed = true; |