From: Daniel Mack Date: Fri, 17 Jan 2014 20:33:04 +0000 (+0100) Subject: kdbus.h, message: prepare for synchronous operations (ABI break) X-Git-Tag: upstream/0.20140120.123719~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e6516d1617e66e5d75c00aab9458e8a43e10f661;p=platform%2Fcore%2Fsystem%2Fkdbus-bus.git kdbus.h, message: prepare for synchronous operations (ABI break) --- diff --git a/kdbus.h b/kdbus.h index 3572127..fe0bb48 100644 --- a/kdbus.h +++ b/kdbus.h @@ -330,12 +330,23 @@ struct kdbus_item { * cookie identifies the message and the * respective reply carries the cookie * in cookie_reply + * @KDBUS_MSG_FLAGS_SYNC_REPLY: Wait for destination connection to + * reply to this message. The + * KDBUS_CMD_MSG_SEND ioctl() will block + * until the reply is received, and + * offset_reply in struct kdbus_msg will + * yield the offset in the sender's pool + * where the reply can be found. + * This flag is only valid if + * @KDBUS_MSG_FLAGS_EXPECT_REPLY is set as + * well. * @KDBUS_MSG_FLAGS_NO_AUTO_START: Do not start a service, if the addressed * name is not currently active */ enum kdbus_msg_flags { KDBUS_MSG_FLAGS_EXPECT_REPLY = 1 << 0, - KDBUS_MSG_FLAGS_NO_AUTO_START = 1 << 1, + KDBUS_MSG_FLAGS_SYNC_REPLY = 1 << 1, + KDBUS_MSG_FLAGS_NO_AUTO_START = 1 << 2, }; /** @@ -365,6 +376,9 @@ enum kdbus_payload_type { * @cookie_reply: A reply to the requesting message with the same * cookie. The requesting connection can match its * request and the reply with this value + * @offset_reply: If KDBUS_MSG_FLAGS_WAIT_FOR_REPLY, this field will + * contain the offset in the sender's pool where the + * reply is stored. * @items: A list of kdbus_items containing the message payload */ struct kdbus_msg { @@ -378,6 +392,7 @@ struct kdbus_msg { union { __u64 timeout_ns; __u64 cookie_reply; + __u64 offset_reply; }; struct kdbus_item items[0]; } __attribute__((aligned(8))); diff --git a/message.c b/message.c index b36199f..3a65ba0 100644 --- a/message.c +++ b/message.c @@ -280,6 +280,16 @@ int kdbus_kmsg_new_from_user(struct kdbus_conn *conn, goto exit_free; } + /* + * KDBUS_MSG_FLAGS_EXPECT_REPLY is only valid together with + * KDBUS_MSG_FLAGS_WAIT_FOR_REPLY + */ + if ((m->msg.flags & KDBUS_MSG_FLAGS_SYNC_REPLY) && + !((m->msg.flags & KDBUS_MSG_FLAGS_EXPECT_REPLY))) { + ret = -EINVAL; + goto exit_free; + } + ret = kdbus_msg_scan_items(conn, m); if (ret < 0) goto exit_free;