return 0;
}
+/**
+ * kdbus_meta_offset_of() - return the offset of a meta data element
+ * @meta: Metadata object
+ * @type: The metadata type to look for (KDBUS_ITEM_*)
+ * @off: Return pointer for the offset, if any
+ *
+ * This function will iterate over the given metadata and return the
+ * offset of the item of type @type, if it exists.
+ *
+ * Return: 0 on success, -ENOENT if the item was not found.
+ */
+int kdbus_meta_offset_of(struct kdbus_meta *meta, u64 type, off_t *off)
+{
+ const struct kdbus_item *item;
+
+ KDBUS_ITEMS_FOREACH(item, meta->data, meta->size)
+ if (item->type == type) {
+ *off = (u8 *) item - (u8 *) meta->data;
+ return 0;
+ }
+
+ return -ENOENT;
+}
+
/**
* kdbus_meta_free() - release metadata
* @meta: Metadata object
struct kdbus_conn *conn,
u64 seq,
u64 which);
+int kdbus_meta_offset_of(struct kdbus_meta *meta, u64 type, off_t *off);
void kdbus_meta_free(struct kdbus_meta *meta);
#endif