提交 4fed357a 编写于 作者: H Hongze Cheng

refact TDB

上级 0a602259
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
#define _TD_TDB_INTERNAL_H_ #define _TD_TDB_INTERNAL_H_
#include "os.h" #include "os.h"
#include "tlist.h"
#include "tlockfree.h"
#include "tdb.h" #include "tdb.h"
...@@ -52,18 +50,18 @@ typedef u32 SPgno; ...@@ -52,18 +50,18 @@ typedef u32 SPgno;
// fileid // fileid
#define TDB_FILE_ID_LEN 24 #define TDB_FILE_ID_LEN 24
// pgid_t // SPgid
typedef struct { typedef struct {
uint8_t fileid[TDB_FILE_ID_LEN]; uint8_t fileid[TDB_FILE_ID_LEN];
SPgno pgno; SPgno pgno;
} pgid_t, SPgid; } SPgid;
#define TDB_IVLD_PGID (pgid_t){0, TDB_IVLD_PGNO}; #define TDB_IVLD_PGID (SPgid){0, TDB_IVLD_PGNO};
static FORCE_INLINE int tdbCmprPgId(const void *p1, const void *p2) { static FORCE_INLINE int tdbCmprPgId(const void *p1, const void *p2) {
pgid_t *pgid1 = (pgid_t *)p1; SPgid *pgid1 = (SPgid *)p1;
pgid_t *pgid2 = (pgid_t *)p2; SPgid *pgid2 = (SPgid *)p2;
int rcode; int rcode;
rcode = memcmp(pgid1->fileid, pgid2->fileid, TDB_FILE_ID_LEN); rcode = memcmp(pgid1->fileid, pgid2->fileid, TDB_FILE_ID_LEN);
if (rcode) { if (rcode) {
...@@ -96,10 +94,6 @@ static FORCE_INLINE int tdbCmprPgId(const void *p1, const void *p2) { ...@@ -96,10 +94,6 @@ static FORCE_INLINE int tdbCmprPgId(const void *p1, const void *p2) {
// tdb_log // tdb_log
#define tdbError(var) #define tdbError(var)
typedef TD_DLIST(STDB) STDbList;
typedef TD_DLIST(SPgFile) SPgFileList;
typedef TD_DLIST_NODE(SPgFile) SPgFileListNode;
#define TERR_A(val, op, flag) \ #define TERR_A(val, op, flag) \
do { \ do { \
if (((val) = (op)) != 0) { \ if (((val) = (op)) != 0) { \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册