mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
kernel: initial <512 byte object only slab
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
#ifndef _SLAB_H
|
||||
#define _SLAB_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct slab_t {
|
||||
struct slab_t *next;
|
||||
struct slab_t *prev;
|
||||
size_t used;
|
||||
void **free;
|
||||
} slab_t;
|
||||
|
||||
typedef struct scache_t {
|
||||
// TODO lock
|
||||
void (*ctor)(struct scache_t *cache, void *obj);
|
||||
void (*dtor)(struct scache_t *cache, void *obj);
|
||||
slab_t *full;
|
||||
slab_t *partial;
|
||||
slab_t *empty;
|
||||
size_t size;
|
||||
size_t truesize;
|
||||
size_t alignment;
|
||||
size_t slabobjcount;
|
||||
} scache_t;
|
||||
|
||||
void slab_init();
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user