From 6d6b55ea9340d536f88ac56d17599591f9de9cee Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 5 Nov 2021 19:42:45 +0800 Subject: [PATCH] minor changes --- include/dnode/mnode/sdb/sdb.h | 6 ++--- source/dnode/mnode/sdb/inc/sdbInt.h | 42 +++++++++++++++++++++++++++++ source/dnode/mnode/sdb/src/sdb.c | 19 +------------ 3 files changed, 46 insertions(+), 21 deletions(-) create mode 100644 source/dnode/mnode/sdb/inc/sdbInt.h diff --git a/include/dnode/mnode/sdb/sdb.h b/include/dnode/mnode/sdb/sdb.h index 678052e615..7a029b8f10 100644 --- a/include/dnode/mnode/sdb/sdb.h +++ b/include/dnode/mnode/sdb/sdb.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef _TD_MNODE_SDB_H_ -#define _TD_MNODE_SDB_H_ +#ifndef _TD_SDB_H_ +#define _TD_SDB_H_ #include "cJSON.h" @@ -77,4 +77,4 @@ void sdbSetFp(EMnSdb, EMnKey, SdbDeployFp, SdbEncodeFp, SdbDecodeFp, int32_t dat } #endif -#endif /*_TD_MNODE_INT_H_*/ +#endif /*_TD_SDB_H_*/ diff --git a/source/dnode/mnode/sdb/inc/sdbInt.h b/source/dnode/mnode/sdb/inc/sdbInt.h new file mode 100644 index 0000000000..1eafb0518b --- /dev/null +++ b/source/dnode/mnode/sdb/inc/sdbInt.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef _TD_SDB_INT_H_ +#define _TD_SDB_INT_H_ + +#include "os.h" +#include "taosmsg.h" +#include "tlog.h" +#include "thash.h" +#include "tglobal.h" +#include "sdb.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// mnode log function +#define mFatal(...) { if (mDebugFlag & DEBUG_FATAL) { taosPrintLog("MND FATAL ", 255, __VA_ARGS__); }} +#define mError(...) { if (mDebugFlag & DEBUG_ERROR) { taosPrintLog("MND ERROR ", 255, __VA_ARGS__); }} +#define mWarn(...) { if (mDebugFlag & DEBUG_WARN) { taosPrintLog("MND WARN ", 255, __VA_ARGS__); }} +#define mInfo(...) { if (mDebugFlag & DEBUG_INFO) { taosPrintLog("MND ", 255, __VA_ARGS__); }} +#define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); }} +#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); }} + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_SDB_INT_H_*/ diff --git a/source/dnode/mnode/sdb/src/sdb.c b/source/dnode/mnode/sdb/src/sdb.c index f92c487c7d..145895798e 100644 --- a/source/dnode/mnode/sdb/src/sdb.c +++ b/source/dnode/mnode/sdb/src/sdb.c @@ -14,25 +14,8 @@ */ #define _DEFAULT_SOURCE -#include "os.h" -#include "thash.h" -#include "tglobal.h" #include "cJSON.h" -#include "sdb.h" - -#include "os.h" -#include "taosmsg.h" -#include "tlog.h" -extern int32_t mDebugFlag; - -// mnode log function -#define mFatal(...) { if (mDebugFlag & DEBUG_FATAL) { taosPrintLog("MND FATAL ", 255, __VA_ARGS__); }} -#define mError(...) { if (mDebugFlag & DEBUG_ERROR) { taosPrintLog("MND ERROR ", 255, __VA_ARGS__); }} -#define mWarn(...) { if (mDebugFlag & DEBUG_WARN) { taosPrintLog("MND WARN ", 255, __VA_ARGS__); }} -#define mInfo(...) { if (mDebugFlag & DEBUG_INFO) { taosPrintLog("MND ", 255, __VA_ARGS__); }} -#define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); }} -#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); }} - +#include "sdbInt.h" static struct { char currDir[PATH_MAX];