diff options
author | Daniel Mack <zonque@gmail.com> | 2013-12-20 12:03:45 +0100 |
---|---|---|
committer | Daniel Mack <zonque@gmail.com> | 2013-12-20 20:54:17 +0100 |
commit | e480fb1d4ab40a053c2e0be39455008d1632f5e3 (patch) | |
tree | 644dec5d1da0dbebfc3508d9e80aa8bb0c2c17bf /test | |
parent | 8fd7f12ff84c2ad3bfaacadad936f683ac5be076 (diff) | |
download | kdbus-bus-e480fb1d4ab40a053c2e0be39455008d1632f5e3.tar.gz kdbus-bus-e480fb1d4ab40a053c2e0be39455008d1632f5e3.tar.bz2 kdbus-bus-e480fb1d4ab40a053c2e0be39455008d1632f5e3.zip |
match: rework code
This is a rework of the match code logic. This also changes the external
API in multiple ways. In particular,
* the item types of kdbus_cmd_match are now of type KDBUS_ITEM_*
* existing kdbus_item structs are used as attachment to kdbus_cmd_match
* the KDBUS_MATCH definitions have been removed entirely
* introduce KDBUS_ITEM_ID to store a connection ID
* src_id in kdbus_cmd_match has been removed, the information lives in
an item attachment now.
Internally, the code was completely reworked.
Diffstat (limited to 'test')
-rw-r--r-- | test/kdbus-enum.c | 12 | ||||
-rw-r--r-- | test/kdbus-util.c | 16 |
2 files changed, 11 insertions, 17 deletions
diff --git a/test/kdbus-enum.c b/test/kdbus-enum.c index 6c9cf42f1b9..8207f6a2c72 100644 --- a/test/kdbus-enum.c +++ b/test/kdbus-enum.c @@ -80,18 +80,6 @@ TABLE(MSG) = { }; LOOKUP(MSG); -TABLE(MATCH) = { - ENUM(_KDBUS_MATCH_NULL), - ENUM(KDBUS_MATCH_BLOOM), - ENUM(KDBUS_MATCH_SRC_NAME), - ENUM(KDBUS_MATCH_NAME_ADD), - ENUM(KDBUS_MATCH_NAME_REMOVE), - ENUM(KDBUS_MATCH_NAME_CHANGE), - ENUM(KDBUS_MATCH_ID_ADD), - ENUM(KDBUS_MATCH_ID_REMOVE), -}; -LOOKUP(MATCH); - TABLE(PAYLOAD) = { ENUM(KDBUS_PAYLOAD_KERNEL), ENUM(KDBUS_PAYLOAD_DBUS), diff --git a/test/kdbus-util.c b/test/kdbus-util.c index f9e22534978..ebda9aadf30 100644 --- a/test/kdbus-util.c +++ b/test/kdbus-util.c @@ -571,15 +571,21 @@ int upload_policy(int fd, const char *name) void add_match_empty(int fd) { - struct kdbus_cmd_match cmd_match; + struct { + struct kdbus_cmd_match cmd; + struct kdbus_item item; + } buf; int ret; - memset(&cmd_match, 0, sizeof(cmd_match)); + memset(&buf, 0, sizeof(buf)); - cmd_match.size = sizeof(cmd_match); - cmd_match.src_id = KDBUS_MATCH_SRC_ID_ANY; + buf.item.size = sizeof(uint64_t) * 3; + buf.item.type = KDBUS_ITEM_ID; + buf.item.id = KDBUS_MATCH_ID_ANY; - ret = ioctl(fd, KDBUS_CMD_MATCH_ADD, &cmd_match); + buf.cmd.size = sizeof(buf.cmd) + buf.item.size; + + ret = ioctl(fd, KDBUS_CMD_MATCH_ADD, &buf); if (ret < 0) fprintf(stderr, "--- error adding conn match: %d (%m)\n", ret); } |