From 04b57a756402e156953edfa2079d69b41db26e51 Mon Sep 17 00:00:00 2001 From: "Douglas B. Rumbaugh" Date: Sun, 2 Nov 2025 15:39:43 -0500 Subject: 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. --- include/alloc_header.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 include/alloc_header.h (limited to 'include/alloc_header.h') 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 + * + * Distributed under the Modified BSD License + * + */ +#ifndef H_LIBALLOC_HEADER +#define H_LIBALLOC_HEADER + +#include +#include + +#include "constants.h" + +typedef struct header { + size_t size; + size_t magic_number; +} header; + +static_assert(sizeof(header) % ALIGNMENT == 0, "Header improperly aligned"); + +#endif -- cgit v1.2.3