summaryrefslogtreecommitdiff
path: root/util/cbfstool/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'util/cbfstool/common.h')
-rw-r--r--util/cbfstool/common.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/util/cbfstool/common.h b/util/cbfstool/common.h
index b61c2c0a5e..561a17abe3 100644
--- a/util/cbfstool/common.h
+++ b/util/cbfstool/common.h
@@ -120,6 +120,14 @@ static inline bool buffer_check_magic(const struct buffer *b, const char *magic,
memcmp(b->data, magic, magic_len) == 0;
}
+/* Returns the start of the underlying buffer, with the offset undone */
+static inline void *buffer_get_original_backing(const struct buffer *b)
+{
+ if (!b)
+ return NULL;
+ return b->data - b->offset;
+}
+
/* Creates an empty memory buffer with given size.
* Returns 0 on success, otherwise non-zero. */
int buffer_create(struct buffer *buffer, size_t size, const char *name);