diff options
| author | Douglas B. Rumbaugh <doug@douglasrumbaugh.com> | 2025-11-02 15:39:43 -0500 |
|---|---|---|
| committer | Douglas B. Rumbaugh <doug@douglasrumbaugh.com> | 2025-11-02 15:39:43 -0500 |
| commit | 04b57a756402e156953edfa2079d69b41db26e51 (patch) | |
| tree | 8bbfc5301c960a72b67918f37456460e23e496ba /include/alloc_header.h | |
| parent | 24d5cd8e806477b0fd2ddb5a232e672707f0da34 (diff) | |
| download | liballoc-04b57a756402e156953edfa2079d69b41db26e51.tar.gz | |
Updated free list interface
I realized my existing interface wouldn't work
if the coalescing or adding of a new node replaced
the head of the list, as there was no way to
communicate that back to the caller. As a result,
I've updated those interfaces to accept a pointer
to the free list head pointer. This will let them
change the free list head in alloc.c if necessary.
Diffstat (limited to 'include/alloc_header.h')
| -rw-r--r-- | include/alloc_header.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/alloc_header.h b/include/alloc_header.h new file mode 100644 index 0000000..bf4716c --- /dev/null +++ b/include/alloc_header.h @@ -0,0 +1,27 @@ +/* + * include/alloc_header.h + * + * liballoc memory block header type. + * CISC 301 -- Operating Systems, Project 3 + * + * Copyright (C) 2025 Douglas B. Rumbaugh <dbrumbaugh@harrisburgu.edu> + * + * Distributed under the Modified BSD License + * + */ +#ifndef H_LIBALLOC_HEADER +#define H_LIBALLOC_HEADER + +#include <stdlib.h> +#include <assert.h> + +#include "constants.h" + +typedef struct header { + size_t size; + size_t magic_number; +} header; + +static_assert(sizeof(header) % ALIGNMENT == 0, "Header improperly aligned"); + +#endif |