X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dbus%2Fdbus-transport-kdbus.c;h=902116d8f4c83b7e4b2c4b64d831dd5ed370d95d;hb=566f2d448e9b011af49a321acb6740f7f0cc04cf;hp=6eabd17b855d92a6eeda7fb75406c07e8c84079c;hpb=006976dca31845953ad3ed5e27fcfc9b08e15a42;p=platform%2Fupstream%2Fdbus.git diff --git a/dbus/dbus-transport-kdbus.c b/dbus/dbus-transport-kdbus.c index 6eabd17..902116d 100644 --- a/dbus/dbus-transport-kdbus.c +++ b/dbus/dbus-transport-kdbus.c @@ -136,6 +136,17 @@ __u64 dbus_transport_get_bloom_size(DBusTransport* transport) } /** + * Gets pointer to the memory pool, wher received messages are + * placed and some ioctls return their info + * @param transport transport + * @returns pointer to the pool + */ +void* dbus_transport_get_pool_pointer(DBusTransport* transport) +{ + return ((DBusTransportKdbus*)transport)->kdbus_mmap_ptr; +} + +/** * Puts locally generated message into received messages queue * @param message message that will be added * @param connection connection to which message will be added @@ -274,24 +285,24 @@ 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_ITEM_SIZE(sizeof(struct kdbus_memfd)); + msg_size += KDBUS_PART_SIZE(sizeof(struct kdbus_memfd)); else { - msg_size += KDBUS_ITEM_SIZE(sizeof(struct kdbus_vec)); //header is a must + msg_size += KDBUS_PART_SIZE(sizeof(struct kdbus_vec)); //header is a must while(body_size > KDBUS_MSG_MAX_PAYLOAD_VEC_SIZE) { - msg_size += KDBUS_ITEM_SIZE(sizeof(struct kdbus_vec)); + msg_size += KDBUS_PART_SIZE(sizeof(struct kdbus_vec)); body_size -= KDBUS_MSG_MAX_PAYLOAD_VEC_SIZE; } if(body_size) - msg_size += KDBUS_ITEM_SIZE(sizeof(struct kdbus_vec)); + msg_size += KDBUS_PART_SIZE(sizeof(struct kdbus_vec)); } if(fds_count) - msg_size += KDBUS_ITEM_SIZE(sizeof(int)*fds_count); + msg_size += KDBUS_PART_SIZE(sizeof(int)*fds_count); if (name) - msg_size += KDBUS_ITEM_SIZE(strlen(name) + 1); + msg_size += KDBUS_PART_SIZE(strlen(name) + 1); else if (dst_id == KDBUS_DST_ID_BROADCAST) msg_size += KDBUS_PART_HEADER_SIZE + transport->bloom_size; @@ -304,7 +315,7 @@ static struct kdbus_msg* kdbus_init_msg(const char* name, __u64 dst_id, uint64_t memset(msg, 0, msg_size); msg->size = msg_size; - msg->payload_type = KDBUS_PAYLOAD_DBUS1; + msg->payload_type = KDBUS_PAYLOAD_DBUS; msg->dst_id = name ? 0 : dst_id; msg->src_id = strtoull(dbus_bus_get_unique_name(transport->base.connection), NULL , 10); @@ -507,6 +518,7 @@ static int kdbus_write_msg(DBusTransportKdbus *transport, DBusMessage *message, static dbus_bool_t bus_register_kdbus(char* name, DBusTransportKdbus* transportS) { struct kdbus_cmd_hello __attribute__ ((__aligned__(8))) hello; + memset(&hello, 0, sizeof(hello)); hello.conn_flags = KDBUS_HELLO_ACCEPT_FD/* | KDBUS_HELLO_ATTACH_COMM | @@ -567,9 +579,10 @@ static int capture_hello_message(DBusTransport *transport, const char* destinati strcpy(name, ":1."); if(!bus_register_kdbus(&name[3], (DBusTransportKdbus*)transport)) goto out; +#ifdef POLICY_TO_KDBUS if(!register_kdbus_policy(&name[3], transport, geteuid())) goto out; - +#endif ((DBusTransportKdbus*)transport)->sender = name; if(!reply_1_data(message, DBUS_TYPE_STRING, &name, transport->connection)) @@ -645,8 +658,7 @@ LOOKUP(MSG); const char *enum_PAYLOAD(long long id); TABLE(PAYLOAD) = { ENUM(KDBUS_PAYLOAD_KERNEL), - ENUM(KDBUS_PAYLOAD_DBUS1), - ENUM(KDBUS_PAYLOAD_GVARIANT), + ENUM(KDBUS_PAYLOAD_DBUS), }; LOOKUP(PAYLOAD); @@ -920,10 +932,11 @@ static int kdbus_decode_msg(const struct kdbus_msg* msg, char *data, DBusTranspo break; case KDBUS_ITEM_NAME_ADD: - _dbus_verbose(" +%s (%llu bytes) '%s', old id=%lld, new id=%lld, flags=0x%llx\n", + _dbus_verbose(" +%s (%llu bytes) '%s', old id=%lld, new id=%lld, old flags=0x%llx, new flags=0x%llx\n", enum_MSG(item->type), (unsigned long long) item->size, item->name_change.name, item->name_change.old_id, - item->name_change.new_id, item->name_change.flags); + item->name_change.new_id, item->name_change.old_flags, + item->name_change.new_flags); message = dbus_message_new_signal(DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, "NameOwnerChanged"); if(message == NULL) @@ -945,10 +958,11 @@ static int kdbus_decode_msg(const struct kdbus_msg* msg, char *data, DBusTranspo break; case KDBUS_ITEM_NAME_REMOVE: - _dbus_verbose(" +%s (%llu bytes) '%s', old id=%lld, new id=%lld, flags=0x%llx\n", + _dbus_verbose(" +%s (%llu bytes) '%s', old id=%lld, new id=%lld, old flags=0x%llx, new flags=0x%llx\n", enum_MSG(item->type), (unsigned long long) item->size, item->name_change.name, item->name_change.old_id, - item->name_change.new_id, item->name_change.flags); + item->name_change.new_id, item->name_change.old_flags, + item->name_change.new_flags); message = dbus_message_new_signal(DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, "NameOwnerChanged"); // name of the signal if(message == NULL) @@ -970,10 +984,11 @@ static int kdbus_decode_msg(const struct kdbus_msg* msg, char *data, DBusTranspo break; case KDBUS_ITEM_NAME_CHANGE: - _dbus_verbose(" +%s (%llu bytes) '%s', old id=%lld, new id=%lld, flags=0x%llx\n", + _dbus_verbose(" +%s (%llu bytes) '%s', old id=%lld, new id=%lld, old flags=0x%llx, new flags=0x%llx\n", enum_MSG(item->type), (unsigned long long) item->size, item->name_change.name, item->name_change.old_id, - item->name_change.new_id, item->name_change.flags); + item->name_change.new_id, item->name_change.old_flags, + item->name_change.new_flags); message = dbus_message_new_signal(DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, "NameOwnerChanged"); if(message == NULL)