off = (uint8_t *)k - (uint8_t *)bus->kdbus_buffer;
ioctl(bus->input_fd, KDBUS_CMD_MSG_RELEASE, &off);
- KDBUS_ITEM_FOREACH(d, k) {
+ KDBUS_PART_FOREACH(d, k, items) {
if (d->type == KDBUS_MSG_FDS)
close_many(d->fds, (d->size - offsetof(struct kdbus_item, fds)) / sizeof(int));
if (k->payload_type != KDBUS_PAYLOAD_DBUS1)
return 0;
- KDBUS_ITEM_FOREACH(d, k) {
+ KDBUS_PART_FOREACH(d, k, items) {
size_t l;
l = d->size - offsetof(struct kdbus_item, data);
if (r < 0)
return r;
- KDBUS_ITEM_FOREACH(d, k) {
+ KDBUS_PART_FOREACH(d, k, items) {
size_t l;
l = d->size - offsetof(struct kdbus_item, data);
} else if (d->type == KDBUS_MSG_DST_NAME)
destination = d->str;
else if (d->type != KDBUS_MSG_FDS &&
- d->type != KDBUS_MSG_SRC_SECLABEL)
+ d->type != KDBUS_MSG_SRC_SECLABEL &&
+ d->type != KDBUS_MSG_SRC_NAMES)
log_debug("Got unknown field from kernel %llu", d->type);
}
l = strlen(name);
make = alloca0(offsetof(struct kdbus_cmd_bus_make, items) +
- KDBUS_ITEM_HEADER_SIZE + sizeof(uint64_t) +
- KDBUS_ITEM_HEADER_SIZE + DECIMAL_STR_MAX(uid_t) + 1 + l + 1);
+ KDBUS_PART_HEADER_SIZE + sizeof(uint64_t) +
+ KDBUS_PART_HEADER_SIZE + DECIMAL_STR_MAX(uid_t) + 1 + l + 1);
n = make->items;
n->type = KDBUS_MAKE_NAME;
sprintf(n->str, "%lu-%s", (unsigned long) getuid(), name);
- n->size = KDBUS_ITEM_HEADER_SIZE + strlen(n->str) + 1;
+ n->size = KDBUS_PART_HEADER_SIZE + strlen(n->str) + 1;
make->size = offsetof(struct kdbus_cmd_bus_make, items) + n->size;
make->flags = KDBUS_MAKE_POLICY_OPEN;
for (i = 0; i < b->n_memfd_cache; i++)
close_and_munmap(b->memfd_cache[i].fd, b->memfd_cache[i].address, b->memfd_cache[i].size);
}
+
+int sd_bus_kernel_translate_request_name_flags(uint64_t sd_bus_flags, uint64_t *kdbus_flags) {
+
+ assert_return(kdbus_flags != NULL, -EINVAL);
+
+ *kdbus_flags = 0;
+
+ if (sd_bus_flags & SD_BUS_NAME_ALLOW_REPLACEMENT)
+ *kdbus_flags |= KDBUS_NAME_ALLOW_REPLACEMENT;
+
+ if (sd_bus_flags & SD_BUS_NAME_REPLACE_EXISTING)
+ *kdbus_flags |= KDBUS_NAME_REPLACE_EXISTING;
+
+ if (!(sd_bus_flags & SD_BUS_NAME_DO_NOT_QUEUE))
+ *kdbus_flags |= KDBUS_NAME_QUEUE;
+
+ return 0;
+}