[systemd-commits] src/libsystemd-bus

Kay Sievers kay at kemper.freedesktop.org
Thu May 2 08:58:07 PDT 2013


 src/libsystemd-bus/bus-kernel.c |   22 +++---
 src/libsystemd-bus/kdbus.h      |  128 +++++++++++++++++++++-------------------
 2 files changed, 81 insertions(+), 69 deletions(-)

New commits:
commit 799e7ea85845bd343eb46daaefa11fd14c9e67cc
Author: Kay Sievers <kay at vrfy.org>
Date:   Thu May 2 17:57:49 2013 +0200

    kdbus: update kdbus.h from upstream

diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c
index 2be2acf..c35d957 100644
--- a/src/libsystemd-bus/bus-kernel.c
+++ b/src/libsystemd-bus/bus-kernel.c
@@ -274,14 +274,14 @@ static int bus_message_setup_kmsg(sd_bus *b, sd_bus_message *m) {
 int bus_kernel_take_fd(sd_bus *b) {
         struct kdbus_cmd_hello hello = {
                 .conn_flags =
-                        KDBUS_CMD_HELLO_ACCEPT_FD|
-                        KDBUS_CMD_HELLO_ATTACH_COMM|
-                        KDBUS_CMD_HELLO_ATTACH_EXE|
-                        KDBUS_CMD_HELLO_ATTACH_CMDLINE|
-                        KDBUS_CMD_HELLO_ATTACH_CGROUP|
-                        KDBUS_CMD_HELLO_ATTACH_CAPS|
-                        KDBUS_CMD_HELLO_ATTACH_SECLABEL|
-                        KDBUS_CMD_HELLO_ATTACH_AUDIT
+                        KDBUS_HELLO_ACCEPT_FD|
+                        KDBUS_HELLO_ATTACH_COMM|
+                        KDBUS_HELLO_ATTACH_EXE|
+                        KDBUS_HELLO_ATTACH_CMDLINE|
+                        KDBUS_HELLO_ATTACH_CGROUP|
+                        KDBUS_HELLO_ATTACH_CAPS|
+                        KDBUS_HELLO_ATTACH_SECLABEL|
+                        KDBUS_HELLO_ATTACH_AUDIT
         };
         int r;
 
@@ -583,17 +583,17 @@ int bus_kernel_create(const char *name, char **s) {
                        sizeof(struct kdbus_cmd_make_item) + DECIMAL_STR_MAX(uid_t) + 1 + l + 1);
 
         cg = make->items;
-        cg->type = KDBUS_CMD_MAKE_CGROUP;
+        cg->type = KDBUS_MAKE_CGROUP;
         cg->data64[0] = 1;
         cg->size = sizeof(struct kdbus_cmd_make_item) + sizeof(uint64_t);
 
         n = KDBUS_ITEM_NEXT(cg);
-        n->type = KDBUS_CMD_MAKE_NAME;
+        n->type = KDBUS_MAKE_NAME;
         sprintf(n->str, "%lu-%s", (unsigned long) getuid(), name);
         n->size = sizeof(struct kdbus_cmd_make_item) + strlen(n->str) + 1;
 
         make->size = offsetof(struct kdbus_cmd_bus_make, items) + cg->size + n->size;
-        make->flags = KDBUS_ACCESS_WORLD | KDBUS_POLICY_OPEN;
+        make->flags = KDBUS_MAKE_ACCESS_WORLD | KDBUS_MAKE_POLICY_OPEN;
         make->bus_flags = 0;
         make->bloom_size = BLOOM_SIZE;
         assert_cc(BLOOM_SIZE % 8 == 0);
diff --git a/src/libsystemd-bus/kdbus.h b/src/libsystemd-bus/kdbus.h
index a597c87..6d817b8 100644
--- a/src/libsystemd-bus/kdbus.h
+++ b/src/libsystemd-bus/kdbus.h
@@ -27,13 +27,13 @@
 struct kdbus_manager_msg_name_change {
 	__u64 old_id;
 	__u64 new_id;
-	__u64 flags;		/* 0 or (possibly?) KDBUS_CMD_NAME_IN_QUEUE */
+	__u64 flags;			/* 0 or (possibly?) KDBUS_NAME_IN_QUEUE */
 	char name[0];
 };
 
 struct kdbus_manager_msg_id_change {
 	__u64 id;
-	__u64 flags; /* The kernel flags field from KDBUS_CMD_HELLO */
+	__u64 flags;			/* The kernel flags field from KDBUS_HELLO */
 };
 
 struct kdbus_creds {
@@ -144,7 +144,7 @@ enum {
 };
 
 enum {
-	KDBUS_PAYLOAD_NONE,
+	KDBUS_PAYLOAD_NULL,
 	KDBUS_PAYLOAD_DBUS1	= 0x4442757356657231ULL, /* 'DBusVer1' */
 	KDBUS_PAYLOAD_GVARIANT	= 0x4756617269616e74ULL, /* 'GVariant' */
 };
@@ -163,10 +163,10 @@ enum {
 struct kdbus_msg {
 	__u64 size;
 	__u64 flags;
-	__u64 dst_id;		/* connection, 0 == name in data, ~0 broadcast */
-	__u64 src_id;		/* connection, 0 == kernel */
-	__u64 payload_type;	/* 'DBusVer1', 'GVariant', ... */
-	__u64 cookie;		/* userspace-supplied cookie */
+	__u64 dst_id;			/* connection, 0 == name in data, ~0 broadcast */
+	__u64 src_id;			/* connection, 0 == kernel */
+	__u64 payload_type;		/* 'DBusVer1', 'GVariant', ... */
+	__u64 cookie;			/* userspace-supplied cookie */
 	union {
 		__u64 cookie_reply;	/* cookie we reply to */
 		__u64 timeout_ns;	/* timespan to wait for reply */
@@ -208,50 +208,32 @@ struct kdbus_policy {
 
 struct kdbus_cmd_policy {
 	__u64 size;
-	__u8 buffer[0];	/* a series of KDBUS_POLICY_NAME plus one or
-			 * more KDBUS_POLICY_ACCESS each. */
+	__u8 buffer[0];		/* a series of KDBUS_POLICY_NAME plus one or
+				 * more KDBUS_POLICY_ACCESS each. */
 };
 
+/* Flags for struct kdbus_cmd_hello */
 enum {
-	KDBUS_CMD_HELLO_STARTER		=  1 <<  0,
-	KDBUS_CMD_HELLO_ACCEPT_FD	=  1 <<  1,
+	KDBUS_HELLO_STARTER		=  1 <<  0,
+	KDBUS_HELLO_ACCEPT_FD		=  1 <<  1,
 
 	/* The following have an effect on directed messages only --
 	 * not for broadcasts */
-	KDBUS_CMD_HELLO_ATTACH_COMM	=  1 << 10,
-	KDBUS_CMD_HELLO_ATTACH_EXE	=  1 << 11,
-	KDBUS_CMD_HELLO_ATTACH_CMDLINE	=  1 << 12,
-	KDBUS_CMD_HELLO_ATTACH_CGROUP	=  1 << 13,
-	KDBUS_CMD_HELLO_ATTACH_CAPS	=  1 << 14,
-	KDBUS_CMD_HELLO_ATTACH_SECLABEL	=  1 << 15,
-	KDBUS_CMD_HELLO_ATTACH_AUDIT	=  1 << 16,
+	KDBUS_HELLO_ATTACH_COMM		=  1 << 10,
+	KDBUS_HELLO_ATTACH_EXE		=  1 << 11,
+	KDBUS_HELLO_ATTACH_CMDLINE	=  1 << 12,
+	KDBUS_HELLO_ATTACH_CGROUP	=  1 << 13,
+	KDBUS_HELLO_ATTACH_CAPS		=  1 << 14,
+	KDBUS_HELLO_ATTACH_SECLABEL	=  1 << 15,
+	KDBUS_HELLO_ATTACH_AUDIT	=  1 << 16,
 };
 
-/* Flags for kdbus_cmd_bus_make, kdbus_cmd_ep_make and
- * kdbus_cmd_ns_make */
+/* Items to append to struct kdbus_cmd_hello */
 enum {
-	KDBUS_ACCESS_GROUP		= 1 <<  0,
-	KDBUS_ACCESS_WORLD		= 1 <<  1,
-	KDBUS_POLICY_OPEN		= 1 <<  2,
+	KDBUS_HELLO_NULL,
 };
 
-/* Items to append to kdbus_cmd_bus_make, kdbus_cmd_ep_make and
- * kdbus_cmd_ns_make */
-
-enum {
-	KDBUS_CMD_MAKE_NONE,
-	KDBUS_CMD_MAKE_NAME,
-	KDBUS_CMD_MAKE_CGROUP,	/* the cgroup hierarchy ID for which to attach
-				 * cgroup membership paths * to messages. */
-	KDBUS_CMD_MAKE_CRED,	/* allow translator services which connect
-				 * to the bus on behalf of somebody else,
-				 * allow specifiying the credentials of the
-				 * client to connect on behalf on. Needs
-				 * privileges */
-
-};
-
-struct kdbus_cmd_make_item {
+struct kdbus_cmd_hello_item {
 	__u64 size;
 	__u64 type;
 	union {
@@ -270,7 +252,7 @@ struct kdbus_cmd_hello {
 				 * returns its capabilites and
 				 * more. Kernel might refuse client's
 				 * capabilities by returning an error
-				 * from KDBUS_CMD_HELLO */
+				 * from KDBUS_HELLO */
 
 	/* kernel → userspace */
 	__u64 bus_flags;	/* this is .flags copied verbatim from
@@ -281,7 +263,37 @@ struct kdbus_cmd_hello {
 	__u64 id;		/* id assigned to this connection */
 	__u64 bloom_size;	/* The bloom filter size chosen by the
 				 * bus owner */
-	struct kdbus_cmd_make_item items[0];
+	struct kdbus_cmd_hello_item items[0];
+};
+
+/* Flags for kdbus_cmd_{bus,ep,ns}_make */
+enum {
+	KDBUS_MAKE_ACCESS_GROUP		= 1 <<  0,
+	KDBUS_MAKE_ACCESS_WORLD		= 1 <<  1,
+	KDBUS_MAKE_POLICY_OPEN		= 1 <<  2,
+};
+
+/* Items to append to kdbus_cmd_{bus,ep,ns}_make */
+enum {
+	KDBUS_MAKE_NULL,
+	KDBUS_MAKE_NAME,
+	KDBUS_MAKE_CGROUP,	/* the cgroup hierarchy ID for which to attach
+				 * cgroup membership paths * to messages. */
+	KDBUS_MAKE_CRED,	/* allow translator services which connect
+				 * to the bus on behalf of somebody else,
+				 * allow specifiying the credentials of the
+				 * client to connect on behalf on. Needs
+				 * privileges */
+};
+
+struct kdbus_cmd_make_item {
+	__u64 size;
+	__u64 type;
+	union {
+		__u8 data[0];
+		__u64 data64[0];
+		char str[0];
+	};
 };
 
 struct kdbus_cmd_bus_make {
@@ -323,12 +335,12 @@ struct kdbus_cmd_ns_make {
 
 enum {
 	/* userspace → kernel */
-	KDBUS_CMD_NAME_REPLACE_EXISTING		= 1 <<  0,
-	KDBUS_CMD_NAME_QUEUE			= 1 <<  1,
-	KDBUS_CMD_NAME_ALLOW_REPLACEMENT	= 1 <<  2,
+	KDBUS_NAME_REPLACE_EXISTING		= 1 <<  0,
+	KDBUS_NAME_QUEUE			= 1 <<  1,
+	KDBUS_NAME_ALLOW_REPLACEMENT		= 1 <<  2,
 
 	/* kernel → userspace */
-	KDBUS_CMD_NAME_IN_QUEUE			= 1 << 16,
+	KDBUS_NAME_IN_QUEUE			= 1 << 16,
 };
 
 struct kdbus_cmd_name {
@@ -345,10 +357,10 @@ struct kdbus_cmd_names {
 };
 
 enum {
-	KDBUS_CMD_NAME_INFO_ITEM_NULL,
-	KDBUS_CMD_NAME_INFO_ITEM_NAME,		/* userspace → kernel */
-	KDBUS_CMD_NAME_INFO_ITEM_SECLABEL,	/* kernel → userspace */
-	KDBUS_CMD_NAME_INFO_ITEM_AUDIT,		/* kernel → userspace */
+	KDBUS_NAME_INFO_ITEM_NULL,
+	KDBUS_NAME_INFO_ITEM_NAME,	/* userspace → kernel */
+	KDBUS_NAME_INFO_ITEM_SECLABEL,	/* kernel → userspace */
+	KDBUS_NAME_INFO_ITEM_AUDIT,	/* kernel → userspace */
 };
 
 struct kdbus_cmd_name_info_item {
@@ -366,14 +378,14 @@ struct kdbus_cmd_name_info {
 };
 
 enum {
-	KDBUS_CMD_MATCH_NULL,
-	KDBUS_CMD_MATCH_BLOOM,		/* Matches a mask blob against KDBUS_MSG_BLOOM */
-	KDBUS_CMD_MATCH_SRC_NAME,	/* Matches a name string against KDBUS_MSG_SRC_NAMES */
-	KDBUS_CMD_MATCH_NAME_ADD,	/* Matches a name string against KDBUS_MSG_NAME_ADD */
-	KDBUS_CMD_MATCH_NAME_REMOVE,	/* Matches a name string against KDBUS_MSG_NAME_REMOVE */
-	KDBUS_CMD_MATCH_NAME_CHANGE,	/* Matches a name string against KDBUS_MSG_NAME_CHANGE */
-	KDBUS_CMD_MATCH_ID_ADD,		/* Matches an ID against KDBUS_MSG_ID_ADD */
-	KDBUS_CMD_MATCH_ID_REMOVE,	/* Matches an ID against KDBUS_MSG_ID_REMOVE */
+	KDBUS_MATCH_NULL,
+	KDBUS_MATCH_BLOOM,		/* Matches a mask blob against KDBUS_MSG_BLOOM */
+	KDBUS_MATCH_SRC_NAME,		/* Matches a name string against KDBUS_MSG_SRC_NAMES */
+	KDBUS_MATCH_NAME_ADD,		/* Matches a name string against KDBUS_MSG_NAME_ADD */
+	KDBUS_MATCH_NAME_REMOVE,	/* Matches a name string against KDBUS_MSG_NAME_REMOVE */
+	KDBUS_MATCH_NAME_CHANGE,	/* Matches a name string against KDBUS_MSG_NAME_CHANGE */
+	KDBUS_MATCH_ID_ADD,		/* Matches an ID against KDBUS_MSG_ID_ADD */
+	KDBUS_MATCH_ID_REMOVE,		/* Matches an ID against KDBUS_MSG_ID_REMOVE */
 };
 
 struct kdbus_cmd_match_item {



More information about the systemd-commits mailing list