Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/blob.h
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-03-12 23:08:27 +0400
committerFelix Fietkau <nbd@openwrt.org>2014-03-12 23:18:12 +0400
commit58aec3c59a53147c7d924c823f7405218fb5f555 (patch)
tree5b965908d842013c5609d2d541f5dff32806b6c8 /blob.h
parent926121113b903bf7b6133f782c84d0ed6c1a1a58 (diff)
blobmsg: allow data/length iterator/accessor functions to work on non-blobmsg elements
This primarily helps with simplifying the ubus APIs. blobmsg header presence is indicated by the BLOB_ATTR_EXTENDED bit in the id_len field. This changes the format ABI, but not the API. Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'blob.h')
-rw-r--r--blob.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/blob.h b/blob.h
index fa430a8..37a572b 100644
--- a/blob.h
+++ b/blob.h
@@ -42,10 +42,11 @@ enum {
BLOB_ATTR_LAST
};
-#define BLOB_ATTR_ID_MASK 0xff000000
+#define BLOB_ATTR_ID_MASK 0x7f000000
#define BLOB_ATTR_ID_SHIFT 24
#define BLOB_ATTR_LEN_MASK 0x00ffffff
#define BLOB_ATTR_ALIGN 4
+#define BLOB_ATTR_EXTENDED 0x80000000
struct blob_attr {
uint32_t id_len;
@@ -85,6 +86,12 @@ blob_id(const struct blob_attr *attr)
return id;
}
+static inline bool
+blob_is_extended(const struct blob_attr *attr)
+{
+ return !!(attr->id_len & cpu_to_be32(BLOB_ATTR_EXTENDED));
+}
+
/*
* blob_len: returns the length of the attribute's payload
*/