btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / system / kernel / slab / slab_private.h
blobc9b8d534b02a049bb19ff453961294b427dcccdc
1 /*
2 * Copyright 2007, Hugo Santos. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Hugo Santos, hugosantos@gmail.com
7 */
8 #ifndef SLAB_PRIVATE_H
9 #define SLAB_PRIVATE_H
12 #include <stddef.h>
14 #include <slab/Slab.h>
17 static const size_t kMinObjectAlignment = 8;
20 void request_memory_manager_maintenance();
22 void* block_alloc(size_t size, size_t alignment, uint32 flags);
23 void* block_alloc_early(size_t size);
24 void block_free(void* block, uint32 flags);
25 void block_allocator_init_boot();
26 void block_allocator_init_rest();
29 template<typename Type>
30 static inline Type*
31 _pop(Type*& head)
33 Type* oldHead = head;
34 head = head->next;
35 return oldHead;
39 template<typename Type>
40 static inline void
41 _push(Type*& head, Type* object)
43 object->next = head;
44 head = object;
48 static inline void*
49 slab_internal_alloc(size_t size, uint32 flags)
51 if (flags & CACHE_DURING_BOOT)
52 return block_alloc_early(size);
54 return block_alloc(size, 0, flags);
58 static inline void
59 slab_internal_free(void* buffer, uint32 flags)
61 block_free(buffer, flags);
65 #endif // SLAB_PRIVATE_H