#ifndef KImem
#define KImem
#include <k/type.h>
#ifndef KFclean
# define Kmsz(e) ( sizeof (e) / sizeof (e) [0] )
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef enum kmcond {
kmcond_ok,
kmcond_bad_address,
} kmcond;
typedef enum kmkind {
kmkind_none,
kmkind_heap,
kmkind_pool,
kmkind_ref,
kmkind_tree
} kmkind;
typedef enum kmshred {
kmshred_yes,
kmshred_no
} kmshred;
typedef struct kmcell {
kmkind kind;
sz size;
kmshred shred;
sz refs;
struct kmcell* src;
} kmcell;
typedef struct kmptr {
kmkind kind;
kmshred shred;
void* ref;
kmcell* cell;
} kmptr;
/* heap functions */
void* kmheapa(sz);
kmcond kmheapf(void*);
#ifdef __cplusplus
}
#endif
#endif