Quake II RTX doxygen
1.0 dev
buddy_allocator.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved.
3
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License along
15
with this program; if not, write to the Free Software Foundation, Inc.,
16
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
*/
18
19
#pragma once
20
#include <stdint.h>
21
22
typedef
enum
23
{
24
BA_SUCCESS
= 0,
25
BA_NOT_ENOUGH_MEMORY
,
26
BA_INVALID_ALIGNMENT
27
}
BAResult
;
28
29
typedef
struct
BuddyAllocator
BuddyAllocator
;
30
31
BuddyAllocator
*
create_buddy_allocator
(uint64_t capacity, uint64_t block_size);
32
BAResult
buddy_allocator_allocate
(
BuddyAllocator
* allocator, uint64_t size, uint64_t alignment, uint64_t* offset);
33
void
buddy_allocator_free
(
BuddyAllocator
* allocator, uint64_t offset, uint64_t size);
34
void
destroy_buddy_allocator
(
BuddyAllocator
* allocator);
buddy_allocator_free
void buddy_allocator_free(BuddyAllocator *allocator, uint64_t offset, uint64_t size)
Definition:
buddy_allocator.c:136
BA_SUCCESS
@ BA_SUCCESS
Definition:
buddy_allocator.h:24
buddy_allocator_allocate
BAResult buddy_allocator_allocate(BuddyAllocator *allocator, uint64_t size, uint64_t alignment, uint64_t *offset)
Definition:
buddy_allocator.c:97
BuddyAllocator
Definition:
buddy_allocator.c:37
BAResult
BAResult
Definition:
buddy_allocator.h:22
create_buddy_allocator
BuddyAllocator * create_buddy_allocator(uint64_t capacity, uint64_t block_size)
Definition:
buddy_allocator.c:59
BA_INVALID_ALIGNMENT
@ BA_INVALID_ALIGNMENT
Definition:
buddy_allocator.h:26
BA_NOT_ENOUGH_MEMORY
@ BA_NOT_ENOUGH_MEMORY
Definition:
buddy_allocator.h:25
destroy_buddy_allocator
void destroy_buddy_allocator(BuddyAllocator *allocator)
Definition:
buddy_allocator.c:150
src
refresh
vkpt
buddy_allocator.h
Generated by
1.8.17