diff options
author | Felix Fietkau <nbd@openwrt.org> | 2014-03-12 23:08:27 +0400 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2014-03-12 23:18:12 +0400 |
commit | 58aec3c59a53147c7d924c823f7405218fb5f555 (patch) | |
tree | 5b965908d842013c5609d2d541f5dff32806b6c8 /blob.c | |
parent | 926121113b903bf7b6133f782c84d0ed6c1a1a58 (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.c')
-rw-r--r-- | blob.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -115,10 +115,9 @@ blob_fill_pad(struct blob_attr *attr) void blob_set_raw_len(struct blob_attr *attr, unsigned int len) { - int id = blob_id(attr); len &= BLOB_ATTR_LEN_MASK; - len |= (id << BLOB_ATTR_ID_SHIFT) & BLOB_ATTR_ID_MASK; - attr->id_len = cpu_to_be32(len); + attr->id_len &= ~cpu_to_be32(BLOB_ATTR_LEN_MASK); + attr->id_len |= cpu_to_be32(len); } struct blob_attr * |