chiark / gitweb /
sd-bus: sync kdbus.h (ABI break)
authorDaniel Mack <daniel@zonque.org>
Mon, 27 Oct 2014 16:02:31 +0000 (17:02 +0100)
committerDaniel Mack <daniel@zonque.org>
Mon, 27 Oct 2014 16:02:31 +0000 (17:02 +0100)
Some comment fixes and header cleanups in kdbus.h, and the task capability
meta information has been factored out to its own struct.

src/libsystemd/sd-bus/bus-control.c
src/libsystemd/sd-bus/bus-kernel.c
src/libsystemd/sd-bus/kdbus.h

index 39f4fc83a7dd19e4fe098652d87398cd12124539..5a052d455eb425dd50e0adefb22b40b3a22ff6c4 100644 (file)
@@ -495,8 +495,8 @@ static int bus_populate_creds_from_items(sd_bus *bus,
                              SD_BUS_CREDS_INHERITABLE_CAPS | SD_BUS_CREDS_BOUNDING_CAPS) & mask;
 
                         if (m) {
-                                c->capability_size = item->size - KDBUS_ITEM_HEADER_SIZE;
-                                c->capability = memdup(item->data, c->capability_size);
+                                c->capability_size = item->size - offsetof(struct kdbus_item, caps.caps);
+                                c->capability = memdup(item->caps.caps, c->capability_size);
                                 if (!c->capability)
                                         return -ENOMEM;
 
index c23065edfeb397b1ba8ab9c7422132aece9b060a..032761474234cfecee05408d66c0d20413148751 100644 (file)
@@ -575,8 +575,8 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) {
                         break;
 
                 case KDBUS_ITEM_CAPS:
-                        m->creds.capability = d->data;
-                        m->creds.capability_size = l;
+                        m->creds.capability = (uint8_t *) d->caps.caps;
+                        m->creds.capability_size = d->size - offsetof(struct kdbus_item, caps.caps);
                         m->creds.mask |= (SD_BUS_CREDS_EFFECTIVE_CAPS|SD_BUS_CREDS_PERMITTED_CAPS|SD_BUS_CREDS_INHERITABLE_CAPS|SD_BUS_CREDS_BOUNDING_CAPS) & bus->creds_mask;
                         break;
 
index 7a715a099401fc1180c4e5d1a702ff20ac07c0ca..2ebf405d7dfabcd4c5e3d07e84b8d898697f0506 100644 (file)
@@ -1,18 +1,8 @@
 /*
- * Copyright (C) 2013-2014 Kay Sievers
- * Copyright (C) 2013-2014 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
- * Copyright (C) 2013-2014 Linux Foundation
- * Copyright (C) 2013-2014 Lennart Poettering
- * Copyright (C) 2013-2014 Daniel Mack <daniel@zonque.org>
- * Copyright (C) 2013-2014 David Herrmann <dh.herrmann@gmail.com>
- *
  * kdbus is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the
  * Free Software Foundation; either version 2.1 of the License, or (at
  * your option) any later version.
- *
- * "Everything should be made as simple as possible, but not simpler."
- *   -- Albert Einstein
  */
 
 #ifndef _KDBUS_UAPI_H_
@@ -89,6 +79,21 @@ struct kdbus_creds {
        __u64 starttime;
 };
 
+/**
+ * struct kdbus_caps - process capabilities
+ * @last_cap:  Highest currently known capability bit
+ * @caps:      Variable number of 32-bit capabilities flags
+ *
+ * Contains a variable number of 32-bit capabilities flags.
+ *
+ * Attached to:
+ *   KDBUS_ITEM_CAPS
+ */
+struct kdbus_caps {
+       __u32 last_cap;
+       __u32 caps[0];
+};
+
 /**
  * struct kdbus_audit - audit information
  * @sessionid:         The audit session ID
@@ -322,6 +327,7 @@ struct kdbus_item {
                struct kdbus_vec vec;
                struct kdbus_creds creds;
                struct kdbus_audit audit;
+               struct kdbus_caps caps;
                struct kdbus_timestamp timestamp;
                struct kdbus_name name;
                struct kdbus_bloom_parameter bloom_parameter;
@@ -731,8 +737,9 @@ struct kdbus_name_list {
  * @offset:            Returned offset in the caller's pool buffer where the
  *                     kdbus_info struct result is stored. The user must
  *                     use KDBUS_CMD_FREE to free the allocated memory.
- * @name:              The optional well-known name to look up. Only needed in
- *                     case @id is zero.
+ * @items:             The optional item list, containing the
+ *                     well-known name to look up as a KDBUS_ITEM_NAME.
+ *                     Only needed in case @id is zero.
  *
  * On success, the KDBUS_CMD_CONN_INFO ioctl will return 0 and @offset will
  * tell the user the offset in the connection pool buffer at which to find the
@@ -748,10 +755,10 @@ struct kdbus_cmd_info {
 } __attribute__((aligned(8)));
 
 /**
- * struct kdbus_info - information returned by KDBUS_CMD_CONN_INFO
+ * struct kdbus_info - information returned by KDBUS_CMD_*_INFO
  * @size:              The total size of the struct
- * @id:                        The connection's 64-bit ID
- * @flags:             The connection's flags
+ * @id:                        The connection's or bus' 64-bit ID
+ * @flags:             The connection's or bus' flags
  * @items:             A list of struct kdbus_item
  *
  * Note that the user is responsible for freeing the allocated memory with
@@ -800,8 +807,8 @@ enum kdbus_cmd_match_flags {
  * @kernel_flags:      Supported flags of the used command, kernel → userspace
  * @items:             A list of items for additional information
  *
- * This structure is used with the KDBUS_CMD_ADD_MATCH and
- * KDBUS_CMD_REMOVE_MATCH ioctl.
+ * This structure is used with the KDBUS_CMD_MATCH_ADD and
+ * KDBUS_CMD_MATCH_REMOVE ioctl.
  */
 struct kdbus_cmd_match {
        __u64 size;