summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadoslaw Pajak <r.pajak@samsung.com>2013-12-18 10:14:37 +0100
committerLubomir Rintel <lkundrak@v3.sk>2015-02-11 11:55:31 +0100
commit7553c727b69551b4fc6e68e85ded51698b766bfc (patch)
treec8d697233c16ab290ecc6ff338b1e106c73b42cc
parente46378c0a16ff9727a7cf6e23795dfd20ca77769 (diff)
[rename] renamed kdbus related macros
KDBUS_PART_HEADER_SIZE renamed to KDBUS_ITEM_HEADER_SIZE KDBUS_PART_SIZE renamed to KDBUS_ITEM_SIZE to become not confusing and to fit kdbus naming convention changes. Change-Id: I9c2b607185831f9cd317274dc3240733b1498c74 Signed-off-by: Radoslaw Pajak <r.pajak@samsung.com>
-rw-r--r--bus/kdbus-d.c28
-rw-r--r--dbus/dbus-transport-kdbus.c38
-rw-r--r--dbus/kdbus-common.h4
3 files changed, 35 insertions, 35 deletions
diff --git a/bus/kdbus-d.c b/bus/kdbus-d.c
index 487110c8..c926c321 100644
--- a/bus/kdbus-d.c
+++ b/bus/kdbus-d.c
@@ -127,7 +127,7 @@ dbus_bool_t add_match_kdbus (DBusTransport* transport, __u64 id, const char *rul
/*parsing rule and calculating size of command*/
size = sizeof(struct kdbus_cmd_match);
if(parse_match_key(rule, "interface='", &pInterface)) /*actual size is not important for interface because bloom size is defined by bus*/
- size += KDBUS_PART_HEADER_SIZE + bloom_size;
+ size += KDBUS_ITEM_HEADER_SIZE + bloom_size;
name_size = parse_match_key(rule, "sender='", &pName);
if(name_size)
{
@@ -138,7 +138,7 @@ dbus_bool_t add_match_kdbus (DBusTransport* transport, __u64 id, const char *rul
pName = NULL;
}
else
- size += KDBUS_PART_SIZE(name_size + 1); //well known name
+ size += KDBUS_ITEM_SIZE(name_size + 1); //well known name
}
pCmd_match = alloca(size);
@@ -154,14 +154,14 @@ dbus_bool_t add_match_kdbus (DBusTransport* transport, __u64 id, const char *rul
if(pName)
{
pItem->type = KDBUS_MATCH_SRC_NAME;
- pItem->size = KDBUS_PART_HEADER_SIZE + name_size + 1;
+ pItem->size = KDBUS_ITEM_HEADER_SIZE + name_size + 1;
memcpy(pItem->str, pName, strlen(pName) + 1);
pItem = KDBUS_PART_NEXT(pItem);
}
if(pInterface)
{
pItem->type = KDBUS_MATCH_BLOOM;
- pItem->size = KDBUS_PART_HEADER_SIZE + bloom_size;
+ pItem->size = KDBUS_ITEM_HEADER_SIZE + bloom_size;
strncpy(pItem->data, pInterface, bloom_size);
}
@@ -280,7 +280,7 @@ int kdbus_NameQuery(const char* name, DBusTransport* transport, struct nameInfo*
if(item->type == KDBUS_ITEM_SECLABEL)
{
- pInfo->sec_label_len = item->size - KDBUS_PART_HEADER_SIZE - 1;
+ pInfo->sec_label_len = item->size - KDBUS_ITEM_HEADER_SIZE - 1;
if(pInfo->sec_label_len != 0)
{
pInfo->sec_label = malloc(pInfo->sec_label_len);
@@ -336,7 +336,7 @@ char* make_kdbus_bus(DBusBusType type, const char* address, DBusError *error)
return NULL;
}
- bus_make_size = sizeof(struct kdbus_cmd_make) + KDBUS_PART_SIZE(name_size) + KDBUS_PART_SIZE(sizeof(__u64));
+ bus_make_size = sizeof(struct kdbus_cmd_make) + KDBUS_ITEM_SIZE(name_size) + KDBUS_ITEM_SIZE(sizeof(__u64));
bus_make = alloca(bus_make_size);
if (!bus_make)
{
@@ -352,7 +352,7 @@ char* make_kdbus_bus(DBusBusType type, const char* address, DBusError *error)
item = bus_make->items;
item->type = KDBUS_ITEM_MAKE_NAME;
- item->size = KDBUS_PART_HEADER_SIZE + name_size;
+ item->size = KDBUS_ITEM_HEADER_SIZE + name_size;
if(type == DBUS_BUS_SYSTEM)
sprintf(name, "%u-kdbus-%s", getuid(), "system");
else if(type == DBUS_BUS_SESSION)
@@ -363,7 +363,7 @@ char* make_kdbus_bus(DBusBusType type, const char* address, DBusError *error)
item = KDBUS_PART_NEXT(item);
item->type = KDBUS_ITEM_BLOOM_SIZE;
- item->size = KDBUS_PART_HEADER_SIZE + sizeof(__u64);
+ item->size = KDBUS_ITEM_HEADER_SIZE + sizeof(__u64);
item->data64[0] = 64;
addr_value = strchr(address, ':') + 1;
@@ -432,7 +432,7 @@ static dbus_bool_t add_matches_for_kdbus_broadcasts(DBusConnection* connection)
}
size = sizeof(struct kdbus_cmd_match);
- size += KDBUS_PART_SIZE(1)*3 + KDBUS_PART_SIZE(sizeof(__u64))*2; /*3 name related items plus 2 id related items*/
+ size += KDBUS_ITEM_SIZE(1)*3 + KDBUS_ITEM_SIZE(sizeof(__u64))*2; /*3 name related items plus 2 id related items*/
pCmd_match = alloca(size);
if(pCmd_match == NULL)
@@ -448,20 +448,20 @@ static dbus_bool_t add_matches_for_kdbus_broadcasts(DBusConnection* connection)
pItem = pCmd_match->items;
pItem->type = KDBUS_MATCH_NAME_CHANGE;
- pItem->size = KDBUS_PART_HEADER_SIZE + 1;
+ pItem->size = KDBUS_ITEM_HEADER_SIZE + 1;
pItem = KDBUS_PART_NEXT(pItem);
pItem->type = KDBUS_MATCH_NAME_ADD;
- pItem->size = KDBUS_PART_HEADER_SIZE + 1;
+ pItem->size = KDBUS_ITEM_HEADER_SIZE + 1;
pItem = KDBUS_PART_NEXT(pItem);
pItem->type = KDBUS_MATCH_NAME_REMOVE;
- pItem->size = KDBUS_PART_HEADER_SIZE + 1;
+ pItem->size = KDBUS_ITEM_HEADER_SIZE + 1;
pItem = KDBUS_PART_NEXT(pItem);
pItem->type = KDBUS_MATCH_ID_ADD;
- pItem->size = KDBUS_PART_HEADER_SIZE + sizeof(__u64);
+ pItem->size = KDBUS_ITEM_HEADER_SIZE + sizeof(__u64);
pItem->id = KDBUS_MATCH_SRC_ID_ANY;
pItem = KDBUS_PART_NEXT(pItem);
pItem->type = KDBUS_MATCH_ID_REMOVE;
- pItem->size = KDBUS_PART_HEADER_SIZE + sizeof(__u64);
+ pItem->size = KDBUS_ITEM_HEADER_SIZE + sizeof(__u64);
pItem->id = KDBUS_MATCH_SRC_ID_ANY;
if(ioctl(fd, KDBUS_CMD_MATCH_ADD, pCmd_match))
diff --git a/dbus/dbus-transport-kdbus.c b/dbus/dbus-transport-kdbus.c
index 902116d8..d590a020 100644
--- a/dbus/dbus-transport-kdbus.c
+++ b/dbus/dbus-transport-kdbus.c
@@ -85,7 +85,7 @@ if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &string)) \
#define MSG_ITEM_BUILD_VEC(data, datasize) \
item->type = KDBUS_ITEM_PAYLOAD_VEC; \
- item->size = KDBUS_PART_HEADER_SIZE + sizeof(struct kdbus_vec); \
+ item->size = KDBUS_ITEM_HEADER_SIZE + sizeof(struct kdbus_vec); \
item->vec.address = (unsigned long) data; \
item->vec.size = datasize;
@@ -285,26 +285,26 @@ static struct kdbus_msg* kdbus_init_msg(const char* name, __u64 dst_id, uint64_t
msg_size = sizeof(struct kdbus_msg);
if(use_memfd == TRUE) // bulk data - memfd
- msg_size += KDBUS_PART_SIZE(sizeof(struct kdbus_memfd));
+ msg_size += KDBUS_ITEM_SIZE(sizeof(struct kdbus_memfd));
else
{
- msg_size += KDBUS_PART_SIZE(sizeof(struct kdbus_vec)); //header is a must
+ msg_size += KDBUS_ITEM_SIZE(sizeof(struct kdbus_vec)); //header is a must
while(body_size > KDBUS_MSG_MAX_PAYLOAD_VEC_SIZE)
{
- msg_size += KDBUS_PART_SIZE(sizeof(struct kdbus_vec));
+ msg_size += KDBUS_ITEM_SIZE(sizeof(struct kdbus_vec));
body_size -= KDBUS_MSG_MAX_PAYLOAD_VEC_SIZE;
}
if(body_size)
- msg_size += KDBUS_PART_SIZE(sizeof(struct kdbus_vec));
+ msg_size += KDBUS_ITEM_SIZE(sizeof(struct kdbus_vec));
}
if(fds_count)
- msg_size += KDBUS_PART_SIZE(sizeof(int)*fds_count);
+ msg_size += KDBUS_ITEM_SIZE(sizeof(int)*fds_count);
if (name)
- msg_size += KDBUS_PART_SIZE(strlen(name) + 1);
+ msg_size += KDBUS_ITEM_SIZE(strlen(name) + 1);
else if (dst_id == KDBUS_DST_ID_BROADCAST)
- msg_size += KDBUS_PART_HEADER_SIZE + transport->bloom_size;
+ msg_size += KDBUS_ITEM_HEADER_SIZE + transport->bloom_size;
msg = malloc(msg_size);
if (!msg)
@@ -419,7 +419,7 @@ static int kdbus_write_msg(DBusTransportKdbus *transport, DBusMessage *message,
}
item->type = KDBUS_ITEM_PAYLOAD_MEMFD;
- item->size = KDBUS_PART_HEADER_SIZE + sizeof(struct kdbus_memfd);
+ item->size = KDBUS_ITEM_HEADER_SIZE + sizeof(struct kdbus_memfd);
item->memfd.size = ret_size;
item->memfd.fd = transport->memfd;
}
@@ -454,7 +454,7 @@ static int kdbus_write_msg(DBusTransportKdbus *transport, DBusMessage *message,
{
item = KDBUS_PART_NEXT(item);
item->type = KDBUS_ITEM_FDS;
- item->size = KDBUS_PART_HEADER_SIZE + (sizeof(int) * fds_count);
+ item->size = KDBUS_ITEM_HEADER_SIZE + (sizeof(int) * fds_count);
memcpy(item->fds, unix_fds, sizeof(int) * fds_count);
}
@@ -462,14 +462,14 @@ static int kdbus_write_msg(DBusTransportKdbus *transport, DBusMessage *message,
{
item = KDBUS_PART_NEXT(item);
item->type = KDBUS_ITEM_DST_NAME;
- item->size = KDBUS_PART_HEADER_SIZE + strlen(destination) + 1;
- memcpy(item->str, destination, item->size - KDBUS_PART_HEADER_SIZE);
+ item->size = KDBUS_ITEM_HEADER_SIZE + strlen(destination) + 1;
+ memcpy(item->str, destination, item->size - KDBUS_ITEM_HEADER_SIZE);
}
else if (dst_id == KDBUS_DST_ID_BROADCAST)
{
item = KDBUS_PART_NEXT(item);
item->type = KDBUS_ITEM_BLOOM;
- item->size = KDBUS_PART_HEADER_SIZE + transport->bloom_size;
+ item->size = KDBUS_ITEM_HEADER_SIZE + transport->bloom_size;
strncpy(item->data, dbus_message_get_interface(message), transport->bloom_size);
}
@@ -703,7 +703,7 @@ static int kdbus_message_size(const struct kdbus_msg* msg)
KDBUS_PART_FOREACH(item, msg, items)
{
- if (item->size <= KDBUS_PART_HEADER_SIZE)
+ if (item->size <= KDBUS_ITEM_HEADER_SIZE)
{
_dbus_verbose(" +%s (%llu bytes) invalid data record\n", enum_MSG(item->type), item->size);
return -1;
@@ -762,7 +762,7 @@ static int kdbus_decode_msg(const struct kdbus_msg* msg, char *data, DBusTranspo
KDBUS_PART_FOREACH(item, msg, items)
{
- if (item->size <= KDBUS_PART_HEADER_SIZE)
+ if (item->size <= KDBUS_ITEM_HEADER_SIZE)
{
_dbus_verbose(" +%s (%llu bytes) invalid data record\n", enum_MSG(item->type), item->size);
break; //??? continue (because dbus will find error) or break
@@ -813,7 +813,7 @@ static int kdbus_decode_msg(const struct kdbus_msg* msg, char *data, DBusTranspo
{
int i;
- *n_fds = (item->size - KDBUS_PART_HEADER_SIZE) / sizeof(int);
+ *n_fds = (item->size - KDBUS_ITEM_HEADER_SIZE) / sizeof(int);
memcpy(fds, item->fds, *n_fds * sizeof(int));
for (i = 0; i < *n_fds; i++)
_dbus_fd_set_close_on_exec(fds[i]);
@@ -841,7 +841,7 @@ static int kdbus_decode_msg(const struct kdbus_msg* msg, char *data, DBusTranspo
case KDBUS_ITEM_CMDLINE:
case KDBUS_ITEM_NAME: {
- __u64 size = item->size - KDBUS_PART_HEADER_SIZE;
+ __u64 size = item->size - KDBUS_ITEM_HEADER_SIZE;
const char *str = item->str;
int count = 0;
@@ -871,10 +871,10 @@ static int kdbus_decode_msg(const struct kdbus_msg* msg, char *data, DBusTranspo
_dbus_verbose(" +%s (%llu bytes) len=%llu bytes)\n",
enum_MSG(item->type), item->size,
- (unsigned long long)item->size - KDBUS_PART_HEADER_SIZE);
+ (unsigned long long)item->size - KDBUS_ITEM_HEADER_SIZE);
cap = item->data32;
- n = (item->size - KDBUS_PART_HEADER_SIZE) / 4 / sizeof(uint32_t);
+ n = (item->size - KDBUS_ITEM_HEADER_SIZE) / 4 / sizeof(uint32_t);
_dbus_verbose(" CapInh=");
for (i = 0; i < n; i++)
diff --git a/dbus/kdbus-common.h b/dbus/kdbus-common.h
index d8572d67..14b62af5 100644
--- a/dbus/kdbus-common.h
+++ b/dbus/kdbus-common.h
@@ -35,8 +35,8 @@
#define KDBUS_PART_NEXT(part) \
(typeof(part))(((uint8_t *)part) + KDBUS_ALIGN8((part)->size))
#define KDBUS_MSG_MAX_PAYLOAD_VEC_SIZE 0x00800000 /* maximum size of message header and items */
-#define KDBUS_PART_HEADER_SIZE offsetof(struct kdbus_item, data)
-#define KDBUS_PART_SIZE(s) KDBUS_ALIGN8((s) + KDBUS_PART_HEADER_SIZE)
+#define KDBUS_ITEM_HEADER_SIZE offsetof(struct kdbus_item, data)
+#define KDBUS_ITEM_SIZE(s) KDBUS_ALIGN8((s) + KDBUS_ITEM_HEADER_SIZE)
//todo restore if DBus policy will be applied in kdbus somehow
//#define POLICY_TO_KDBUS