From d1a5d76b1c16ac4f2e386d90926fbce50df2efbd Mon Sep 17 00:00:00 2001 From: Matthew Sotoudeh Date: Sat, 18 May 2024 15:55:38 -0700 Subject: more info on reservation --- magic_buddy/magic_buddy.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'magic_buddy/magic_buddy.h') diff --git a/magic_buddy/magic_buddy.h b/magic_buddy/magic_buddy.h index 167397b..3b5e8d0 100644 --- a/magic_buddy/magic_buddy.h +++ b/magic_buddy/magic_buddy.h @@ -42,10 +42,18 @@ void *reallocate(void *old, size_t new_size, size_t old_size, struct buddy *state); // Attempts to reserve a range [@start,@start+@size). +// // Returns 1 if success, 0 otherwise. +// // Whenever possible, we avoid writing anything into the reserved region. +// +// If the reservation succeeds, and @out_start (@out_size) is negative, it puts +// the start (size) of the actually reserved region into *@out_start +// (*@out_size). These can be passed into liberate(...) later to unreserve. +// // O(1) -int reserve(void *start, size_t size, struct buddy *state); +int reserve(void *start, size_t size, void **out_start, size_t *out_size, + struct buddy *state); // Update @state to assume the memory pool has been copied to // [@new_base,@new_base+@new_size) -- cgit v1.2.3