aboutsummaryrefslogtreecommitdiff
path: root/kernel/include/slab_alloc.h
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2015-02-09 17:39:41 +0100
committerAlex Auvolat <alex.auvolat@ens.fr>2015-02-09 17:40:03 +0100
commitf2c51bc81d2aa618b29ddbeaae5ac1c5308821f0 (patch)
treefae67a79d5e60128d074550326a05216694a5848 /kernel/include/slab_alloc.h
parenta5dfdd2b3fa91a2cda4f807c88bd35928e3c7a61 (diff)
downloadkogata-f2c51bc81d2aa618b29ddbeaae5ac1c5308821f0.tar.gz
kogata-f2c51bc81d2aa618b29ddbeaae5ac1c5308821f0.zip
Reorganize all.
Diffstat (limited to 'kernel/include/slab_alloc.h')
-rw-r--r--kernel/include/slab_alloc.h44
1 files changed, 0 insertions, 44 deletions
diff --git a/kernel/include/slab_alloc.h b/kernel/include/slab_alloc.h
deleted file mode 100644
index eb9588d..0000000
--- a/kernel/include/slab_alloc.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#pragma once
-
-// Self-contained piece of library : a slab allocator...
-// Depends on page_alloc_fun_t and page_free_fun_t : a couple of functions
-// that can allocate/free multiples of one page at a time
-
-#include <stdint.h>
-#include <stddef.h>
-#include <stdbool.h>
-
-#if defined(__linux__)
-//redefine necessary stuff
-#include <assert.h>
-#define ASSERT assert
-#define PAGE_SIZE 0x1000
-#include <stdio.h>
-#define dbg_printf printf
-#else
-#include <sys.h> // this is macroscope
-#include <dbglog.h>
-#endif
-
-// expected format for the array of slab_type_t given to slab_create :
-// an array of slab_type descriptors, with last descriptor full of zeroes
-// and with obj_size increasing (strictly) in the array
-typedef struct slab_type {
- const char *descr;
- size_t obj_size;
- size_t pages_per_cache;
-} slab_type_t;
-
-struct mem_allocator;
-typedef struct mem_allocator mem_allocator_t;
-
-typedef void* (*page_alloc_fun_t)(size_t bytes);
-typedef void (*page_free_fun_t)(void* ptr);
-
-mem_allocator_t* create_slab_allocator(const slab_type_t *types, page_alloc_fun_t af, page_free_fun_t ff);
-void destroy_slab_allocator(mem_allocator_t*);
-
-void* slab_alloc(mem_allocator_t* a, size_t sz);
-void slab_free(mem_allocator_t* a, void* ptr);
-
-/* vim: set ts=4 sw=4 tw=0 noet :*/