]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
bloblist: add helper functions
authorRaymond Mao <raymond.mao@linaro.org>
Fri, 18 Jul 2025 14:16:15 +0000 (07:16 -0700)
committerTom Rini <trini@konsulko.com>
Mon, 27 Apr 2026 15:42:36 +0000 (09:42 -0600)
Add two helper functions for:
1. marking a blob void
2. getting blob record from a given blob data pointer.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Tested-by: Michal Simek <michal.simek@amd.com>
common/bloblist.c

index 1c690f58b5670335df5509e21acdf1c2942d8494..488908f605efb1b9895f4c52c7253db6c770eb14 100644 (file)
@@ -97,6 +97,19 @@ static inline uint rec_tag(struct bloblist_rec *rec)
                BLOBLISTR_TAG_SHIFT;
 }
 
+static inline void void_blob(struct bloblist_rec *rec)
+{
+       if (rec_tag(rec) == BLOBLISTT_VOID)
+               return;
+       rec->tag_and_hdr_size = BLOBLISTT_VOID |
+                               sizeof(*rec) << BLOBLISTR_HDR_SIZE_SHIFT;
+}
+
+static inline struct bloblist_rec *rec_from_blob(void *blob)
+{
+       return (blob - sizeof(struct bloblist_rec));
+}
+
 static ulong bloblist_blob_end_ofs(struct bloblist_hdr *hdr,
                                   struct bloblist_rec *rec)
 {