38#include <sys/kernel.h>
39#include <sys/malloc.h>
48#define ASSERT(E, M) KASSERT(E,M)
65#define INS_ALLOC() ng_uni_malloc(UNIMEM_INS, __FILE__, __LINE__)
66#define INS_FREE(P) ng_uni_free(UNIMEM_INS, P, __FILE__, __LINE__)
68#define UNI_ALLOC() ng_uni_malloc(UNIMEM_ALL, __FILE__, __LINE__)
69#define UNI_FREE(P) ng_uni_free(UNIMEM_ALL, P, __FILE__, __LINE__)
71#define SIG_ALLOC() ng_uni_malloc(UNIMEM_SIG, __FILE__, __LINE__)
72#define SIG_FREE(P) ng_uni_free(UNIMEM_SIG, P, __FILE__, __LINE__)
74#define CALL_ALLOC() ng_uni_malloc(UNIMEM_CALL, __FILE__, __LINE__)
75#define CALL_FREE(P) ng_uni_free(UNIMEM_CALL, P, __FILE__, __LINE__)
77#define PARTY_ALLOC() ng_uni_malloc(UNIMEM_PARTY, __FILE__, __LINE__)
78#define PARTY_FREE(P) ng_uni_free(UNIMEM_PARTY, P, __FILE__, __LINE__)
87#define _TIMER_INIT(X,T) ng_callout_init(&(X)->T.c)
88#define _TIMER_DESTROY(UNI,FIELD) _TIMER_STOP(UNI,FIELD)
89#define _TIMER_STOP(UNI,FIELD) do { \
90 ng_uncallout(&FIELD.c, (UNI)->arg); \
92#define TIMER_ISACT(UNI,T) (callout_active(&(UNI)->T.c) || \
93 callout_pending(&(UNI)->T.c))
94#define _TIMER_START(UNI,ARG,FIELD,DUE,FUNC) do { \
95 _TIMER_STOP(UNI, FIELD); \
96 ng_callout(&FIELD.c, (UNI)->arg, NULL, \
97 hz * (DUE) / 1000, FUNC, (ARG), 0); \
100#define TIMER_FUNC_UNI(T,F) \
101static void F(struct uni *); \
103_##T##_func(node_p node, hook_p hook, void *arg1, int arg2) \
105 struct uni *uni = (struct uni *)arg1; \
114#define TIMER_FUNC_CALL(T,F) \
115static void F(struct call *); \
117_##T##_func(node_p node, hook_p hook, void *arg1, int arg2) \
119 struct call *call = (struct call *)arg1; \
120 struct uni *uni = call->uni; \
129#define TIMER_FUNC_PARTY(T,F) \
130static void F(struct party *); \
132_##T##_func(node_p node, hook_p hook, void *arg1, int arg2) \
134 struct party *party = (struct party *)arg1; \
135 struct uni *uni = party->call->uni; \
144size_t unimem_sizes[UNIMEM_TYPES] = { \
145 [UNIMEM_INS] = sizeof(struct uni), \
146 [UNIMEM_ALL] = sizeof(struct uni_all), \
147 [UNIMEM_SIG] = sizeof(struct sig), \
148 [UNIMEM_CALL] = sizeof(struct call), \
149 [UNIMEM_PARTY] = sizeof(struct party) \
void ng_uni_free(enum unimem, void *, const char *, u_int)
void * ng_uni_malloc(enum unimem, const char *, u_int)
size_t unimem_sizes[UNIMEM_TYPES]