chiark / gitweb /
kdbus.h: update
[elogind.git] / src / libsystemd / sd-bus / kdbus.h
index bd51e3759332c45608561a982a9c8c33d0e468d5..e9d9c9f31b367c0bd371139c27f89c0f57b69e3d 100644 (file)
@@ -229,6 +229,9 @@ struct kdbus_policy_access {
  * @KDBUS_ITEM_PAYLOAD_OFF:            Data at returned offset to message head
  * @KDBUS_ITEM_PAYLOAD_MEMFD:          Data as sealed memfd
  * @KDBUS_ITEM_FDS:                    Attached file descriptors
+ * @KDBUS_ITEM_CANCEL_FD:              FD used to cancel a synchronous
+ *                                     operation by writing to it from
+ *                                     userspace
  * @KDBUS_ITEM_BLOOM_PARAMETER:                Bus-wide bloom parameters, used with
  *                                     KDBUS_CMD_BUS_MAKE, carries a
  *                                     struct kdbus_bloom_parameter
@@ -292,6 +295,7 @@ enum kdbus_item_type {
        KDBUS_ITEM_PAYLOAD_OFF,
        KDBUS_ITEM_PAYLOAD_MEMFD,
        KDBUS_ITEM_FDS,
+       KDBUS_ITEM_CANCEL_FD,
        KDBUS_ITEM_BLOOM_PARAMETER,
        KDBUS_ITEM_BLOOM_FILTER,
        KDBUS_ITEM_BLOOM_MASK,
@@ -383,6 +387,16 @@ struct kdbus_item {
        };
 };
 
+/**
+ * struct kdbus_item_list - A list of items
+ * @size:              The total size of the structure
+ * @items:             Array of items
+ */
+struct kdbus_item_list {
+       __u64 size;
+       struct kdbus_item items[0];
+};
+
 /**
  * enum kdbus_msg_flags - type of message
  * @KDBUS_MSG_EXPECT_REPLY:    Expect a reply message, used for
@@ -392,10 +406,12 @@ struct kdbus_item {
  *                             in cookie_reply
  * @KDBUS_MSG_NO_AUTO_START:   Do not start a service, if the addressed
  *                             name is not currently active
+ * @KDBUS_MSG_SIGNAL:          Treat this message as signal
  */
 enum kdbus_msg_flags {
        KDBUS_MSG_EXPECT_REPLY  = 1ULL << 0,
        KDBUS_MSG_NO_AUTO_START = 1ULL << 1,
+       KDBUS_MSG_SIGNAL        = 1ULL << 2,
 };
 
 /**
@@ -447,12 +463,12 @@ struct kdbus_msg {
 } __attribute__((aligned(8)));
 
 /**
- * struct kdbus_reply - reply container
+ * struct kdbus_msg_info - returned message container
  * @offset:            Offset of kdbus_msg slice in pool
  * @msg_size:          Copy of the kdbus_msg.size field
  * @return_flags:      Command return flags, kernel → userspace
  */
-struct kdbus_reply {
+struct kdbus_msg_info {
        __u64 offset;
        __u64 msg_size;
        __u64 return_flags;
@@ -493,7 +509,7 @@ struct kdbus_cmd_send {
        __u64 kernel_msg_flags;
        __u64 return_flags;
        __u64 msg_address;
-       struct kdbus_reply reply;
+       struct kdbus_msg_info reply;
        struct kdbus_item items[0];
 } __attribute__((aligned(8)));
 
@@ -550,45 +566,29 @@ struct kdbus_cmd_recv {
        __u64 return_flags;
        __s64 priority;
        __u64 dropped_msgs;
-       struct kdbus_reply reply;
-       struct kdbus_item items[0];
-} __attribute__((aligned(8)));
-
-/**
- * struct kdbus_cmd_cancel - struct to cancel a synchronously pending message
- * @size:              Overall size of this object
- * @flags:             Flags for the free command. Currently unused.
- * @kernel_flags:      Supported flags of CANCEL, kernel → userspace
- * @return_flags:      Command return flags, kernel → userspace
- * @cookie:            The cookie of the pending message
- * @items:             Items to modify the command behavior
- *
- * This struct is used with the KDBUS_CMD_CANCEL ioctl.
- */
-struct kdbus_cmd_cancel {
-       __u64 size;
-       __u64 flags;
-       __u64 kernel_flags;
-       __u64 return_flags;
-       __u64 cookie;
+       struct kdbus_msg_info reply;
        struct kdbus_item items[0];
 } __attribute__((aligned(8)));
 
 /**
  * struct kdbus_cmd_free - struct to free a slice of memory in the pool
+ * @size:              Overall size of this structure
  * @offset:            The offset of the memory slice, as returned by other
  *                     ioctls
  * @flags:             Flags for the free command, userspace → kernel
  * @return_flags:      Command return flags, kernel → userspace
  * @kernel_flags:      Supported flags of the free command, userspace → kernel
+ * @items:             Additional items to modify the behavior
  *
  * This struct is used with the KDBUS_CMD_FREE ioctl.
  */
 struct kdbus_cmd_free {
+       __u64 size;
        __u64 offset;
        __u64 flags;
        __u64 kernel_flags;
        __u64 return_flags;
+       struct kdbus_item items[0];
 } __attribute__((aligned(8)));
 
 /**
@@ -701,8 +701,10 @@ enum kdbus_attach_flags {
  * @id:                        The ID of this connection (kernel → userspace)
  * @pool_size:         Size of the connection's buffer where the received
  *                     messages are placed
- * @bloom:             The bloom properties of the bus, specified
- *                     by the bus creator (kernel → userspace)
+ * @offset:            Pool offset where additional items of type
+ *                     kdbus_item_list are stored. They contain information
+ *                     about the bus and the newly created connection.
+ * @items_size:                Copy of item_list.size stored in @offset.
  * @id128:             Unique 128-bit ID of the bus (kernel → userspace)
  * @items:             A list of items
  *
@@ -718,7 +720,8 @@ struct kdbus_cmd_hello {
        __u64 bus_flags;
        __u64 id;
        __u64 pool_size;
-       struct kdbus_bloom_parameter bloom;
+       __u64 offset;
+       __u64 items_size;
        __u8 id128[16];
        struct kdbus_item items[0];
 } __attribute__((aligned(8)));
@@ -842,7 +845,9 @@ enum kdbus_name_list_flags {
  * @offset:            The returned offset in the caller's pool buffer.
  *                     The user must use KDBUS_CMD_FREE to free the
  *                     allocated memory.
+ * @list_size:         Returned size of list in bytes
  * @size:              Output buffer to report size of data at @offset.
+ * @items:             Items for the command. Reserved for future use.
  *
  * This structure is used with the KDBUS_CMD_NAME_LIST ioctl.
  */
@@ -979,9 +984,6 @@ struct kdbus_cmd_match {
  *                             the kernel.
  * KDBUS_CMD_RECV:             Receive a message from the kernel which is
  *                             placed in the receiver's pool.
- * KDBUS_CMD_CANCEL:           Cancel a pending request of a message that
- *                             blocks while waiting for a reply. The parameter
- *                             denotes the cookie of the message in flight.
  * KDBUS_CMD_FREE:             Release the allocated memory in the receiver's
  *                             pool.
  * KDBUS_CMD_NAME_ACQUIRE:     Request a well-known bus name to associate with
@@ -1003,48 +1005,48 @@ struct kdbus_cmd_match {
  *                             a connection is attached to.
  * KDBUS_CMD_ENDPOINT_UPDATE:  Update the properties of a custom enpoint. Used
  *                             to update the policy.
- * KDBUS_CMD_MATCH_ADD:        Install a match which broadcast messages should
+ * KDBUS_CMD_MATCH_ADD:                Install a match which broadcast messages should
  *                             be delivered to the connection.
  * KDBUS_CMD_MATCH_REMOVE:     Remove a current match for broadcast messages.
  */
-#define KDBUS_CMD_BUS_MAKE             _IOW(KDBUS_IOCTL_MAGIC, 0x00,   \
-                                            struct kdbus_cmd_make)
-#define KDBUS_CMD_ENDPOINT_MAKE                _IOW(KDBUS_IOCTL_MAGIC, 0x10,   \
-                                            struct kdbus_cmd_make)
+enum kdbus_ioctl_type {
+       KDBUS_CMD_BUS_MAKE =            _IOW(KDBUS_IOCTL_MAGIC, 0x00,
+                                            struct kdbus_cmd_make),
+       KDBUS_CMD_ENDPOINT_MAKE =       _IOW(KDBUS_IOCTL_MAGIC, 0x10,
+                                            struct kdbus_cmd_make),
 
-#define KDBUS_CMD_HELLO                        _IOWR(KDBUS_IOCTL_MAGIC, 0x20,  \
-                                             struct kdbus_cmd_hello)
-#define KDBUS_CMD_BYEBYE               _IO(KDBUS_IOCTL_MAGIC, 0x21)    \
+       KDBUS_CMD_HELLO =               _IOWR(KDBUS_IOCTL_MAGIC, 0x20,
+                                             struct kdbus_cmd_hello),
+       KDBUS_CMD_BYEBYE =              _IO(KDBUS_IOCTL_MAGIC, 0x21),
 
-#define KDBUS_CMD_SEND                 _IOWR(KDBUS_IOCTL_MAGIC, 0x30,  \
-                                             struct kdbus_msg)
-#define KDBUS_CMD_RECV                 _IOWR(KDBUS_IOCTL_MAGIC, 0x31,  \
-                                             struct kdbus_cmd_recv)
-#define KDBUS_CMD_CANCEL               _IOW(KDBUS_IOCTL_MAGIC, 0x32,   \
-                                            struct kdbus_cmd_cancel)
-#define KDBUS_CMD_FREE                 _IOW(KDBUS_IOCTL_MAGIC, 0x33,   \
-                                            struct kdbus_cmd_free)
+       KDBUS_CMD_SEND =                _IOWR(KDBUS_IOCTL_MAGIC, 0x30,
+                                             struct kdbus_cmd_send),
+       KDBUS_CMD_RECV =                _IOWR(KDBUS_IOCTL_MAGIC, 0x31,
+                                             struct kdbus_cmd_recv),
+       KDBUS_CMD_FREE =                _IOW(KDBUS_IOCTL_MAGIC, 0x32,
+                                            struct kdbus_cmd_free),
 
-#define KDBUS_CMD_NAME_ACQUIRE         _IOWR(KDBUS_IOCTL_MAGIC, 0x40,  \
-                                             struct kdbus_cmd_name)
-#define KDBUS_CMD_NAME_RELEASE         _IOW(KDBUS_IOCTL_MAGIC, 0x41,   \
-                                            struct kdbus_cmd_name)
-#define KDBUS_CMD_NAME_LIST            _IOWR(KDBUS_IOCTL_MAGIC, 0x42,  \
-                                             struct kdbus_cmd_name_list)
+       KDBUS_CMD_NAME_ACQUIRE =        _IOWR(KDBUS_IOCTL_MAGIC, 0x40,
+                                             struct kdbus_cmd_name),
+       KDBUS_CMD_NAME_RELEASE =        _IOW(KDBUS_IOCTL_MAGIC, 0x41,
+                                            struct kdbus_cmd_name),
+       KDBUS_CMD_NAME_LIST =           _IOWR(KDBUS_IOCTL_MAGIC, 0x42,
+                                             struct kdbus_cmd_name_list),
 
-#define KDBUS_CMD_CONN_INFO            _IOWR(KDBUS_IOCTL_MAGIC, 0x50,  \
-                                             struct kdbus_cmd_info)
-#define KDBUS_CMD_CONN_UPDATE          _IOW(KDBUS_IOCTL_MAGIC, 0x51,   \
-                                            struct kdbus_cmd_update)
-#define KDBUS_CMD_BUS_CREATOR_INFO     _IOWR(KDBUS_IOCTL_MAGIC, 0x52,  \
-                                             struct kdbus_cmd_info)
+       KDBUS_CMD_CONN_INFO =           _IOWR(KDBUS_IOCTL_MAGIC, 0x50,
+                                             struct kdbus_cmd_info),
+       KDBUS_CMD_CONN_UPDATE =         _IOW(KDBUS_IOCTL_MAGIC, 0x51,
+                                            struct kdbus_cmd_update),
+       KDBUS_CMD_BUS_CREATOR_INFO =    _IOWR(KDBUS_IOCTL_MAGIC, 0x52,
+                                             struct kdbus_cmd_info),
 
-#define KDBUS_CMD_ENDPOINT_UPDATE      _IOW(KDBUS_IOCTL_MAGIC, 0x61,   \
-                                            struct kdbus_cmd_update)
+       KDBUS_CMD_ENDPOINT_UPDATE =     _IOW(KDBUS_IOCTL_MAGIC, 0x61,
+                                            struct kdbus_cmd_update),
 
-#define KDBUS_CMD_MATCH_ADD            _IOW(KDBUS_IOCTL_MAGIC, 0x70,   \
-                                            struct kdbus_cmd_match)
-#define KDBUS_CMD_MATCH_REMOVE         _IOW(KDBUS_IOCTL_MAGIC, 0x71,   \
-                                            struct kdbus_cmd_match)
+       KDBUS_CMD_MATCH_ADD =           _IOW(KDBUS_IOCTL_MAGIC, 0x70,
+                                            struct kdbus_cmd_match),
+       KDBUS_CMD_MATCH_REMOVE =        _IOW(KDBUS_IOCTL_MAGIC, 0x71,
+                                            struct kdbus_cmd_match),
+};
 
 #endif /* _KDBUS_UAPI_H_ */