summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2014-10-18 20:57:53 +0200
committerDaniel Mack <daniel@zonque.org>2014-10-18 20:57:53 +0200
commit4a3e79e1b6ac12b15efb46df0c42275376ee8e7b (patch)
tree28feb103ea1d3596b4fc4b2da1ce1f7ba57aaf07 /src/libsystemd/sd-bus
parente7bc519620cb7bcdbe2166fc2a446453769d827e (diff)
sd-bus: sync kdbus.h (ABI break)
In kdbus.h, the 'features' field has been dropped again. Instead of negotiating features that way, we decided to make the kernel return the set of supported flags in each ioctl struct's .flags field, in both the success and error cases.
Diffstat (limited to 'src/libsystemd/sd-bus')
-rw-r--r--src/libsystemd/sd-bus/bus-control.c2
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.c31
-rw-r--r--src/libsystemd/sd-bus/kdbus.h5
3 files changed, 12 insertions, 26 deletions
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
index 7b106a327..cf733a663 100644
--- a/src/libsystemd/sd-bus/bus-control.c
+++ b/src/libsystemd/sd-bus/bus-control.c
@@ -169,7 +169,7 @@ static int bus_release_name_kernel(sd_bus *bus, const char *name) {
if (r < 0)
return -errno;
- return n->flags;
+ return 0;
}
static int bus_release_name_dbus1(sd_bus *bus, const char *name) {
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index c3dbc837d..ac0ae5366 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -751,10 +751,9 @@ int bus_kernel_take_fd(sd_bus *b) {
}
}
- /* The higher 32bit of both flags fields are considered
+ /* The higher 32bit of the bus_flags fields are considered
* 'incompatible flags'. Refuse them all for now. */
- if (hello->bus_flags > 0xFFFFFFFFULL ||
- hello->conn_flags > 0xFFFFFFFFULL)
+ if (hello->bus_flags > 0xFFFFFFFFULL)
return -ENOTSUP;
if (!bloom_validate_parameters((size_t) hello->bloom.size, (unsigned) hello->bloom.n_hash))
@@ -821,6 +820,7 @@ static void close_kdbus_msg(sd_bus *bus, struct kdbus_msg *k) {
int bus_kernel_write_message(sd_bus *bus, sd_bus_message *m, bool hint_sync_call) {
int r;
+ uint64_t flags;
assert(bus);
assert(m);
@@ -843,7 +843,12 @@ int bus_kernel_write_message(sd_bus *bus, sd_bus_message *m, bool hint_sync_call
if (hint_sync_call)
m->kdbus->flags |= KDBUS_MSG_FLAGS_EXPECT_REPLY|KDBUS_MSG_FLAGS_SYNC_REPLY;
+ /* The kernel will return the set of supported flags in m->kdbus->flags.
+ * Save the current message flags before issuing the ioctl, and restore them
+ * afterwards */
+ flags = m->kdbus->flags;
r = ioctl(bus->output_fd, KDBUS_CMD_MSG_SEND, m->kdbus);
+ m->kdbus->flags = flags;
if (r < 0) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
sd_bus_message *reply;
@@ -1307,13 +1312,6 @@ int bus_kernel_create_bus(const char *name, bool world, char **s) {
return -errno;
}
- /* The features field are considered 'incompatible flags'.
- * Refuse them all for now. */
- if (make->features) {
- safe_close(fd);
- return -ENOTSUP;
- }
-
if (s) {
char *p;
@@ -1444,13 +1442,6 @@ int bus_kernel_create_endpoint(const char *bus_name, const char *ep_name, char *
return -errno;
}
- /* The features field are considered 'incompatible flags'.
- * Refuse them all for now. */
- if (make->features) {
- safe_close(fd);
- return -ENOTSUP;
- }
-
if (ep_path) {
char *p;
@@ -1574,11 +1565,9 @@ int bus_kernel_make_starter(
if (ioctl(fd, KDBUS_CMD_HELLO, hello) < 0)
return -errno;
- /* The higher 32bit of both flags fields are considered
+ /* The higher 32bit of the bus_flags fields are considered
* 'incompatible flags'. Refuse them all for now. */
- if (hello->features ||
- hello->bus_flags > 0xFFFFFFFFULL ||
- hello->conn_flags > 0xFFFFFFFFULL)
+ if (hello->bus_flags > 0xFFFFFFFFULL)
return -ENOTSUP;
if (!bloom_validate_parameters((size_t) hello->bloom.size, (unsigned) hello->bloom.n_hash))
diff --git a/src/libsystemd/sd-bus/kdbus.h b/src/libsystemd/sd-bus/kdbus.h
index 79a17f344..453a8d18b 100644
--- a/src/libsystemd/sd-bus/kdbus.h
+++ b/src/libsystemd/sd-bus/kdbus.h
@@ -26,6 +26,7 @@
#define KDBUS_DST_ID_NAME (0)
#define KDBUS_MATCH_ID_ANY (~0ULL)
#define KDBUS_DST_ID_BROADCAST (~0ULL)
+#define KDBUS_FLAG_KERNEL (1ULL << 63)
/**
* struct kdbus_notify_id_change - name registry change message
@@ -554,7 +555,6 @@ enum kdbus_attach_flags {
/**
* struct kdbus_cmd_hello - struct to say hello to kdbus
* @size: The total size of the structure
- * @features: Feature negotiation bitmask
* @conn_flags: Connection flags (KDBUS_HELLO_*).
* @attach_flags: Mask of metadata to attach to each message sent
* (KDBUS_ATTACH_*)
@@ -574,7 +574,6 @@ enum kdbus_attach_flags {
*/
struct kdbus_cmd_hello {
__u64 size;
- __u64 features;
__u64 conn_flags;
__u64 attach_flags;
__u64 bus_flags;
@@ -598,7 +597,6 @@ enum kdbus_make_flags {
/**
* struct kdbus_cmd_make - struct to make a bus, an endpoint or a domain
* @size: The total size of the struct
- * @features: Feature negotiation bitmask
* @flags: Properties for the bus/ep/domain to create
* @items: Items describing details
*
@@ -607,7 +605,6 @@ enum kdbus_make_flags {
*/
struct kdbus_cmd_make {
__u64 size;
- __u64 features;
__u64 flags;
struct kdbus_item items[0];
} __attribute__((aligned(8)));