From: Kay Sievers Date: Fri, 24 May 2013 01:08:48 +0000 (+0200) Subject: bus: update kdbus.h from upstream X-Git-Tag: v205~200 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=9b3848f2e2dc737bd6e7df1c765821d227d3f22f;hp=3a05c0f96c88984b47ca2f77bbf67dd5048a47d8;p=elogind.git bus: update kdbus.h from upstream --- diff --git a/src/libsystemd-bus/bus-control.c b/src/libsystemd-bus/bus-control.c index cb8618e5c..0ba858580 100644 --- a/src/libsystemd-bus/bus-control.c +++ b/src/libsystemd-bus/bus-control.c @@ -75,7 +75,7 @@ int sd_bus_request_name(sd_bus *bus, const char *name, int flags) { l = strlen(name); n = alloca0(offsetof(struct kdbus_cmd_name, name) + l + 1); n->size = offsetof(struct kdbus_cmd_name, name) + l + 1; - n->name_flags = flags; + n->flags = flags; memcpy(n->name, name, l+1); #ifdef HAVE_VALGRIND_MEMCHECK_H @@ -86,7 +86,7 @@ int sd_bus_request_name(sd_bus *bus, const char *name, int flags) { if (r < 0) return -errno; - return n->name_flags; + return n->flags; } else { r = sd_bus_call_method( bus, @@ -142,7 +142,7 @@ int sd_bus_release_name(sd_bus *bus, const char *name) { if (r < 0) return -errno; - return n->name_flags; + return n->flags; } else { r = sd_bus_call_method( bus, diff --git a/src/libsystemd-bus/kdbus.h b/src/libsystemd-bus/kdbus.h index e10a1547a..dfc64ffe2 100644 --- a/src/libsystemd-bus/kdbus.h +++ b/src/libsystemd-bus/kdbus.h @@ -21,6 +21,18 @@ #endif #define KDBUS_IOC_MAGIC 0x95 +#define KDBUS_SRC_ID_KERNEL (0) +#define KDBUS_DST_ID_WELL_KNOWN_NAME (0) +#define KDBUS_MATCH_SRC_ID_ANY (~0ULL) +#define KDBUS_DST_ID_BROADCAST (~0ULL) + +/* Common first elements in a structure which are used to iterate over + * a list of elements. */ +#define KDBUS_PART_HEADER \ + struct { \ + __u64 size; \ + __u64 type; \ + } /* Message sent from kernel to userspace, when the owner or starter of * a well-known name changes */ @@ -60,10 +72,15 @@ struct kdbus_timestamp { __u64 realtime_ns; }; -#define KDBUS_SRC_ID_KERNEL (0) -#define KDBUS_DST_ID_WELL_KNOWN_NAME (0) -#define KDBUS_MATCH_SRC_ID_ANY (~0ULL) -#define KDBUS_DST_ID_BROADCAST (~0ULL) +struct kdbus_vec { + __u64 address; + __u64 size; +}; + +struct kdbus_memfd { + __u64 size; + int fd; +}; /* Message Item Types */ enum { @@ -100,16 +117,6 @@ enum { KDBUS_MSG_REPLY_DEAD, /* dito */ }; -struct kdbus_vec { - __u64 address; - __u64 size; -}; - -struct kdbus_memfd { - __u64 size; - int fd; -}; - /** * struct kdbus_item - chain of data blocks * @@ -117,8 +124,7 @@ struct kdbus_memfd { * type: kdbus_item type of data */ struct kdbus_item { - __u64 size; - __u64 type; + KDBUS_PART_HEADER; union { /* inline data */ __u8 data[0]; @@ -151,7 +157,7 @@ enum { }; enum { - _KDBUS_PAYLOAD_NULL, + KDBUS_PAYLOAD_KERNEL, KDBUS_PAYLOAD_DBUS1 = 0x4442757356657231ULL, /* 'DBusVer1' */ KDBUS_PAYLOAD_GVARIANT = 0x4756617269616e74ULL, /* 'GVariant' */ }; @@ -200,23 +206,24 @@ enum { KDBUS_POLICY_OWN = 1 << 0, }; +struct kdbus_policy_access { + __u64 type; /* USER, GROUP, WORLD */ + __u64 bits; /* RECV, SEND, OWN */ + __u64 id; /* uid, gid, 0 */ +}; + struct kdbus_policy { - __u64 size; - __u64 type; /* NAME or ACCESS */ + KDBUS_PART_HEADER; union { char name[0]; - struct { - __u32 type; /* USER, GROUP, WORLD */ - __u32 bits; /* RECV, SEND, OWN */ - __u64 id; /* uid, gid, 0 */ - } access; + struct kdbus_policy_access access; }; }; +/* A series of KDBUS_POLICY_NAME, plus one or more KDBUS_POLICY_ACCESS */ struct kdbus_cmd_policy { __u64 size; - __u8 data[0]; /* a series of KDBUS_POLICY_NAME plus one or - * more KDBUS_POLICY_ACCESS each. */ + struct kdbus_policy policies[0]; }; /* Flags for struct kdbus_cmd_hello */ @@ -332,10 +339,11 @@ enum { KDBUS_NAME_IN_QUEUE = 1 << 16, }; +/* We allow (de)regestration of names of other peers */ struct kdbus_cmd_name { __u64 size; - __u64 name_flags; - __u64 id; /* We allow registration/deregestration of names of other peers */ + __u64 flags; + __u64 id; __u64 conn_flags; char name[0]; }; @@ -381,7 +389,7 @@ struct kdbus_cmd_match { struct kdbus_cmd_monitor { __u64 id; /* We allow setting the monitor flag of other peers */ - unsigned int enabled; /* A boolean to enable/disable monitoring */ + unsigned int enable; /* A boolean to enable/disable monitoring */ }; /* FD states: @@ -394,7 +402,7 @@ struct kdbus_cmd_monitor { * starter (via KDBUS_CMD_HELLO with KDBUS_CMD_HELLO_STARTER) * ep owner (via KDBUS_CMD_EP_MAKE) */ -enum kdbus_cmd { +enum { /* kdbus control node commands: require unset state */ KDBUS_CMD_BUS_MAKE = _IOWR(KDBUS_IOC_MAGIC, 0x00, struct kdbus_cmd_bus_make), KDBUS_CMD_NS_MAKE = _IOWR(KDBUS_IOC_MAGIC, 0x10, struct kdbus_cmd_ns_make),