From: Daniel Mack Date: Tue, 27 Jan 2015 13:42:21 +0000 (+0100) Subject: doc: restructure kdbus.item X-Git-Tag: upstream/0.20150129.081441utc~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f05b3a61f4af2b5b53c7629eec77fdc8917122ad;p=platform%2Fcore%2Fsystem%2Fkdbus-bus.git doc: restructure kdbus.item Signed-off-by: Daniel Mack --- diff --git a/doc/kdbus.item.xml b/doc/kdbus.item.xml index 0d9bb83..08ce31c 100644 --- a/doc/kdbus.item.xml +++ b/doc/kdbus.item.xml @@ -31,7 +31,7 @@ kdbus.item - kdbus item structure + kdbus item structure, layout and usage @@ -42,30 +42,42 @@ struct kdbus_item can be attached to the structs passed into the ioctls. Some ioctls make items of certain types mandatory, others are optional. Items that are - unsupported by ioctls they are sent to will cause the ioctl to fail - -EINVAL. + unsupported by ioctls they are attached to will cause the ioctl to fail + -EINVAL. Items are also used for information stored in a connection's pool, such as received messages, name lists or requested connection or bus owner information. Depending on the type of an item, its total size is either fixed or variable. - The kernel expects all items to be aligned to 8-byte boundaries. Unaligned - items or items that are unsupported by the ioctl are rejected. - - Whenever items are used as part of the kdbus kernel API, they are - embedded in structs that are embedded inside structs that themselves - include a size field containing the overall size of the structure. - This allows multiple items to be chained up. - + + Chaining items + + Whenever items are used as part of the kdbus kernel API, they are + embedded in structs that are embedded inside structs that themselves + include a size field containing the overall size of the structure. + This allows multiple items to be chained up, and an item iterator + (see below) is capable of detecting the end of an item chain. + + + + + Alignment + + The kernel expects all items to be aligned to 8-byte boundaries. + Unaligned items will cause the ioctl they are used with to fail + with -EINVAL. An item that has an unaligned size + itself hence needs to be padded if it is followed by another item. + + Iterating items - - A simple iterator in userspace would iterate over the items until - the items have reached the embedding structure's overall size. - An example implementation is shown below. - + + A simple iterator in userspace would iterate over the items until + the items have reached the embedding structure's overall size. + An example implementation is shown below. + first; \ ((uint8_t *)(item) < (uint8_t *)(head) + (head)->size) && \ - ((uint8_t *)(item) >= (uint8_u *)(head)); \ + ((uint8_t *)(item) >= (uint8_t *)(head)); \ item = KDBUS_ITEM_NEXT(item)) ]]> @@ -134,7 +146,8 @@ struct kdbus_item { Item types - Items exchanged between userspace and kernel + + Command specific items KDBUS_ITEM_PAYLOAD_VEC @@ -208,7 +221,12 @@ struct kdbus_memfd { for more information. + + + + Items specific to some commands + KDBUS_ITEM_CANCEL_FD @@ -311,8 +329,10 @@ struct kdbus_name { + - Items attached by the kernel as metadata + + Items attached by the kernel as metadata @@ -508,7 +528,19 @@ struct kdbus_audit { - Items used for policy entries, matches and notifications + + [*] Note that the content stored in these metadata items can easily + be tampered by the sending tasks. Therefore, they should + not be used for any sort of security relevant + assumptions. The only reason they are transmitted is to let + receivers know about details that were set when metadata was + collected, even though the task they were collected from is not + active any longer when the items are received. + + + + + Items used for policy entries, matches and notifications @@ -571,17 +603,7 @@ struct kdbus_notify_id_change { - - - [*] Note that the content stored in these metadata items can easily - be tampered by the sending tasks. Therefore, they should - not be used for any sort of security relevant - assumptions. The only reason they are transmitted is to let - receivers know about details that were set when metadata was - collected, even though the task they were collected from is not - active any longer when the items are received. - - +