79dacd0
From 40885bb29e3f39fc06787075f666a0ec2ac35361 Mon Sep 17 00:00:00 2001
79dacd0
From: Daniel Mack <daniel@zonque.org>
79dacd0
Date: Wed, 8 Oct 2014 15:32:41 +0200
79dacd0
Subject: [PATCH] sd-bus: sync kdbus.h (ABI break)
79dacd0
79dacd0
Sync kdbus.h once again. Two thing have changed:
79dacd0
79dacd0
 a) KDBUS_CMD_EP_* was renamed to KDBUS_CMD_ENDPOINT_*
79dacd0
 b) struct kdbus_cmd_hello and struct kdbus_cmd_make gained a
79dacd0
    'features' bitfield (which is currently unused)
79dacd0
---
79dacd0
 src/libsystemd/sd-bus/bus-kernel.c | 19 ++++++++++---------
79dacd0
 src/libsystemd/sd-bus/kdbus.h      | 16 ++++++++++------
79dacd0
 2 files changed, 20 insertions(+), 15 deletions(-)
79dacd0
79dacd0
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
79dacd0
index b431d78139..c3dbc837d7 100644
79dacd0
--- a/src/libsystemd/sd-bus/bus-kernel.c
79dacd0
+++ b/src/libsystemd/sd-bus/bus-kernel.c
79dacd0
@@ -1307,9 +1307,9 @@ int bus_kernel_create_bus(const char *name, bool world, char **s) {
79dacd0
                 return -errno;
79dacd0
         }
79dacd0
 
79dacd0
-        /* The higher 32bit of the flags field are considered
79dacd0
-         * 'incompatible flags'. Refuse them all for now. */
79dacd0
-        if (make->flags > 0xFFFFFFFFULL) {
79dacd0
+        /* The features field are considered 'incompatible flags'.
79dacd0
+         * Refuse them all for now. */
79dacd0
+        if (make->features) {
79dacd0
                 safe_close(fd);
79dacd0
                 return -ENOTSUP;
79dacd0
         }
79dacd0
@@ -1439,14 +1439,14 @@ int bus_kernel_create_endpoint(const char *bus_name, const char *ep_name, char *
79dacd0
         n->size = offsetof(struct kdbus_item, str) + strlen(ep_name) + 1;
79dacd0
         strcpy(n->str, ep_name);
79dacd0
 
79dacd0
-        if (ioctl(fd, KDBUS_CMD_EP_MAKE, make) < 0) {
79dacd0
+        if (ioctl(fd, KDBUS_CMD_ENDPOINT_MAKE, make) < 0) {
79dacd0
                 safe_close(fd);
79dacd0
                 return -errno;
79dacd0
         }
79dacd0
 
79dacd0
-        /* The higher 32bit of the flags field are considered
79dacd0
-         * 'incompatible flags'. Refuse them all for now. */
79dacd0
-        if (make->flags > 0xFFFFFFFFULL) {
79dacd0
+        /* The features field are considered 'incompatible flags'.
79dacd0
+         * Refuse them all for now. */
79dacd0
+        if (make->features) {
79dacd0
                 safe_close(fd);
79dacd0
                 return -ENOTSUP;
79dacd0
         }
79dacd0
@@ -1503,7 +1503,7 @@ int bus_kernel_set_endpoint_policy(int fd, uid_t uid, BusEndpoint *ep) {
79dacd0
                 n = KDBUS_ITEM_NEXT(n);
79dacd0
         }
79dacd0
 
79dacd0
-        r = ioctl(fd, KDBUS_CMD_EP_UPDATE, update);
79dacd0
+        r = ioctl(fd, KDBUS_CMD_ENDPOINT_UPDATE, update);
79dacd0
         if (r < 0)
79dacd0
                 return -errno;
79dacd0
 
79dacd0
@@ -1576,7 +1576,8 @@ int bus_kernel_make_starter(
79dacd0
 
79dacd0
         /* The higher 32bit of both flags fields are considered
79dacd0
          * 'incompatible flags'. Refuse them all for now. */
79dacd0
-        if (hello->bus_flags > 0xFFFFFFFFULL ||
79dacd0
+        if (hello->features ||
79dacd0
+            hello->bus_flags > 0xFFFFFFFFULL ||
79dacd0
             hello->conn_flags > 0xFFFFFFFFULL)
79dacd0
                 return -ENOTSUP;
79dacd0
 
79dacd0
diff --git a/src/libsystemd/sd-bus/kdbus.h b/src/libsystemd/sd-bus/kdbus.h
79dacd0
index 8994b5673d..79a17f3449 100644
79dacd0
--- a/src/libsystemd/sd-bus/kdbus.h
79dacd0
+++ b/src/libsystemd/sd-bus/kdbus.h
79dacd0
@@ -554,6 +554,7 @@ enum kdbus_attach_flags {
79dacd0
 /**
79dacd0
  * struct kdbus_cmd_hello - struct to say hello to kdbus
79dacd0
  * @size:		The total size of the structure
79dacd0
+ * @features:		Feature negotiation bitmask
79dacd0
  * @conn_flags:		Connection flags (KDBUS_HELLO_*).
79dacd0
  * @attach_flags:	Mask of metadata to attach to each message sent
79dacd0
  *			(KDBUS_ATTACH_*)
79dacd0
@@ -573,6 +574,7 @@ enum kdbus_attach_flags {
79dacd0
  */
79dacd0
 struct kdbus_cmd_hello {
79dacd0
 	__u64 size;
79dacd0
+	__u64 features;
79dacd0
 	__u64 conn_flags;
79dacd0
 	__u64 attach_flags;
79dacd0
 	__u64 bus_flags;
79dacd0
@@ -596,14 +598,16 @@ enum kdbus_make_flags {
79dacd0
 /**
79dacd0
  * struct kdbus_cmd_make - struct to make a bus, an endpoint or a domain
79dacd0
  * @size:		The total size of the struct
79dacd0
+ * @features:		Feature negotiation bitmask
79dacd0
  * @flags:		Properties for the bus/ep/domain to create
79dacd0
  * @items:		Items describing details
79dacd0
  *
79dacd0
- * This structure is used with the KDBUS_CMD_BUS_MAKE, KDBUS_CMD_EP_MAKE and
79dacd0
- * KDBUS_CMD_DOMAIN_MAKE ioctls.
79dacd0
+ * This structure is used with the KDBUS_CMD_BUS_MAKE, KDBUS_CMD_ENDPOINT_MAKE
79dacd0
+ * and KDBUS_CMD_DOMAIN_MAKE ioctls.
79dacd0
  */
79dacd0
 struct kdbus_cmd_make {
79dacd0
 	__u64 size;
79dacd0
+	__u64 features;
79dacd0
 	__u64 flags;
79dacd0
 	struct kdbus_item items[0];
79dacd0
 } __attribute__((aligned(8)));
79dacd0
@@ -775,7 +779,7 @@ struct kdbus_cmd_match {
79dacd0
  *				is closed.
79dacd0
  * @KDBUS_CMD_DOMAIN_MAKE:	Similar to KDBUS_CMD_BUS_MAKE, but it creates a
79dacd0
  *				new kdbus domain.
79dacd0
- * @KDBUS_CMD_EP_MAKE:		Creates a new named special endpoint to talk to
79dacd0
+ * @KDBUS_CMD_ENDPOINT_MAKE:	Creates a new named special endpoint to talk to
79dacd0
  *				the bus. Such endpoints usually carry a more
79dacd0
  *				restrictive policy and grant restricted access
79dacd0
  *				to specific applications.
79dacd0
@@ -811,7 +815,7 @@ struct kdbus_cmd_match {
79dacd0
  * @KDBUS_CMD_CONN_UPDATE:	Update the properties of a connection. Used to
79dacd0
  *				update the metadata subscription mask and
79dacd0
  *				policy.
79dacd0
- * @KDBUS_CMD_EP_UPDATE:	Update the properties of a custom enpoint. Used
79dacd0
+ * @KDBUS_CMD_ENDPOINT_UPDATE:	Update the properties of a custom enpoint. Used
79dacd0
  *				to update the policy.
79dacd0
  * @KDBUS_CMD_MATCH_ADD:	Install a match which broadcast messages should
79dacd0
  *				be delivered to the connection.
79dacd0
@@ -822,7 +826,7 @@ enum kdbus_ioctl_type {
79dacd0
 					     struct kdbus_cmd_make),
79dacd0
 	KDBUS_CMD_DOMAIN_MAKE =		_IOW(KDBUS_IOCTL_MAGIC, 0x10,
79dacd0
 					     struct kdbus_cmd_make),
79dacd0
-	KDBUS_CMD_EP_MAKE =		_IOW(KDBUS_IOCTL_MAGIC, 0x20,
79dacd0
+	KDBUS_CMD_ENDPOINT_MAKE =	_IOW(KDBUS_IOCTL_MAGIC, 0x20,
79dacd0
 					     struct kdbus_cmd_make),
79dacd0
 
79dacd0
 	KDBUS_CMD_HELLO =		_IOWR(KDBUS_IOCTL_MAGIC, 0x30,
79dacd0
@@ -850,7 +854,7 @@ enum kdbus_ioctl_type {
79dacd0
 	KDBUS_CMD_CONN_UPDATE =		_IOW(KDBUS_IOCTL_MAGIC, 0x61,
79dacd0
 					     struct kdbus_cmd_update),
79dacd0
 
79dacd0
-	KDBUS_CMD_EP_UPDATE =		_IOW(KDBUS_IOCTL_MAGIC, 0x71,
79dacd0
+	KDBUS_CMD_ENDPOINT_UPDATE =	_IOW(KDBUS_IOCTL_MAGIC, 0x71,
79dacd0
 					     struct kdbus_cmd_update),
79dacd0
 
79dacd0
 	KDBUS_CMD_MATCH_ADD =		_IOW(KDBUS_IOCTL_MAGIC, 0x80,