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_; \ 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) \ #define tSListInit(sl) \
do { \ do { \
(sl)->sl_head_ = NULL; \ (sl)->sl_head_ = NULL; \
} while (0) } 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 // Double linked list
#define TD_DLIST_NODE(S) \ #define TD_DLIST_NODE(TYPE) \
struct { \ struct { \
S *prev_; \ TYPE *prev_; \
S *next_; \ TYPE *next_; \
} }
#define TD_DLIST(S) \ #define TD_DLIST(TYPE) \
struct { \ struct { \
S * head_; \ TYPE *head_; \
S * tail_; \ TYPE *tail_; \
int neles_; \ int neles_; \
} }
#define tlistInit(l) \ #define tDListInit(l) \
(l)->head_ = (l)->tail_ = NULL; \ (l)->head_ = (l)->tail_ = NULL; \
(l)->neles_ = 0; (l)->neles_ = 0;

View File

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

View File

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