#ifndef SALLOC_H #define SALLOC_H #define SALLOC_DEBUG #define SALLOC_TIMEOUT (3600*HZ) #include #include #include #include #include #include typedef struct scope_buf_s { struct scope_buf_s *next; void *scope; #ifdef SALLOC_TIMEOUT unsigned long timeout; #endif char buf[0]; } scope_buf_t; typedef struct salloc_s { scope_buf_t *buflist; int size; spinlock_t lock; #ifdef SALLOC_DEBUG int nbufs; #endif } salloc_t; #ifdef SALLOC_DEBUG #define SALLOC_INIT(size) (salloc_t) { NULL, size, SPIN_LOCK_UNLOCKED, 0 } #else #define SALLOC_INIT(size) (salloc_t) { NULL, size, SPIN_LOCK_UNLOCKED } #endif extern void *salloc(salloc_t *bufs, void *scope); extern void sunalloc(salloc_t *bufs); /* These routines use salloc() and can be seen as a prototype. */ extern char *__kinet_ntoa(__u32 a, void *s); #define kinet_ntoa(a) __kinet_ntoa((a), __builtin_return_address(0)) extern char *__kinet6_ntoa(const struct in6_addr *a, void *s); #define kinet6_ntoa(a) __kinet6_ntoa((a), __builtin_return_address(0)) extern void ntoa_unalloc(void); #endif