This commit is contained in:
Hongze Cheng 2021-12-13 21:18:43 +08:00
parent d66cba75e1
commit aaf9ca18c5
3 changed files with 21 additions and 14 deletions

View File

@ -31,28 +31,35 @@ extern "C" {
struct TYPE *sl_head_; \
}
#define TD_SLIST_NODE_NEXT(sln) (sln)->sl_next_
#define TD_SLIST_HEAD(sl) ((sl)->sl_head_)
#define TD_SLIST_NODE_NEXT(sln) ((sln)->sl_next_)
#define tSListInit(sl) \
do { \
(sl)->sl_head_ = NULL; \
} while (0)
#define tSListPrepend(sl, sln) \
do { \
TD_SLIST_NODE_NEXT(sln) = TD_SLIST_HEAD(sl); \
TD_SLIST_HEAD(sl) = (sln); \
} while (0);
// Double linked list
#define TD_DLIST_NODE(S) \
#define TD_DLIST_NODE(TYPE) \
struct { \
S *prev_; \
S *next_; \
TYPE *prev_; \
TYPE *next_; \
}
#define TD_DLIST(S) \
#define TD_DLIST(TYPE) \
struct { \
S * head_; \
S * tail_; \
TYPE *head_; \
TYPE *tail_; \
int neles_; \
}
#define tlistInit(l) \
#define tDListInit(l) \
(l)->head_ = (l)->tail_ = NULL; \
(l)->neles_ = 0;

View File

@ -27,7 +27,7 @@ SVMemAllocator *vmaCreate(uint64_t capacity, uint64_t ssize, uint64_t lsize) {
pVMA->capacity = capacity;
pVMA->ssize = ssize;
pVMA->lsize = lsize;
tlistInit(&(pVMA->nlist));
tDListInit(&(pVMA->nlist));
SVArenaNode *pNode = vArenaNodeNew(capacity);
if (pNode == NULL) {

View File

@ -35,8 +35,8 @@ int vnodeOpenBufPool(SVnode *pVnode) {
return -1;
}
tlistInit(&(pVnode->pBufPool->free));
tlistInit(&(pVnode->pBufPool->incycle));
tDListInit(&(pVnode->pBufPool->free));
tDListInit(&(pVnode->pBufPool->incycle));
pVnode->pBufPool->inuse = NULL;