diff options
-rw-r--r-- | firmware/buflib.c | 2 | ||||
-rw-r--r-- | firmware/include/buflib.h | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/firmware/buflib.c b/firmware/buflib.c index 27a6965ee0..8d5fe1eef3 100644 --- a/firmware/buflib.c +++ b/firmware/buflib.c | |||
@@ -55,6 +55,8 @@ | |||
55 | * to find the start of the character array (and therefore the start of the | 55 | * to find the start of the character array (and therefore the start of the |
56 | * entire block) when only the handle or payload start is known. | 56 | * entire block) when only the handle or payload start is known. |
57 | * | 57 | * |
58 | * UPDATE BUFLIB_ALLOC_OVERHEAD (buflib.h) WHEN THIS COOKIE CHANGES! | ||
59 | * | ||
58 | * Example: | 60 | * Example: |
59 | * |<- alloc block #1 ->|<- unalloc block ->|<- alloc block #2 ->|<-handle table->| | 61 | * |<- alloc block #1 ->|<- unalloc block ->|<- alloc block #2 ->|<-handle table->| |
60 | * |L|H|C|cccc|L2|crc|XXXXXX|-L|YYYYYYYYYYYYYYYY|L|H|C|cc|L2|crc|XXXXXXXXXXXXX|AAA| | 62 | * |L|H|C|cccc|L2|crc|XXXXXX|-L|YYYYYYYYYYYYYYYY|L|H|C|cc|L2|crc|XXXXXXXXXXXXX|AAA| |
diff --git a/firmware/include/buflib.h b/firmware/include/buflib.h index e912429b1f..1bae3e7a3f 100644 --- a/firmware/include/buflib.h +++ b/firmware/include/buflib.h | |||
@@ -54,6 +54,17 @@ struct buflib_context | |||
54 | }; | 54 | }; |
55 | 55 | ||
56 | /** | 56 | /** |
57 | * This declares the minimal overhead that is required per alloc. These | ||
58 | * are bytes that are allocated from the context's pool in addition | ||
59 | * to the actually requested number of bytes. | ||
60 | * | ||
61 | * The total number of bytes consumed by an allocation is | ||
62 | * BUFLIB_ALLOC_OVERHEAD + requested bytes + strlen(<name passed to | ||
63 | * buflib_alloc_ex()) + pad to pointer size | ||
64 | */ | ||
65 | #define BUFLIB_ALLOC_OVERHEAD (6*sizeof(union buflib_data)) | ||
66 | |||
67 | /** | ||
57 | * Callbacks used by the buflib to inform allocation that compaction | 68 | * Callbacks used by the buflib to inform allocation that compaction |
58 | * is happening (before data is moved) | 69 | * is happening (before data is moved) |
59 | * | 70 | * |