diff --git a/source/dnode/mgmt/CMakeLists.txt b/source/dnode/mgmt/CMakeLists.txt index bdc9f1741d..d38f185409 100644 --- a/source/dnode/mgmt/CMakeLists.txt +++ b/source/dnode/mgmt/CMakeLists.txt @@ -1,5 +1,5 @@ add_subdirectory(node_mgmt) -add_subdirectory(node_common) +add_subdirectory(node_util) add_subdirectory(mgmt_bnode) add_subdirectory(mgmt_mnode) add_subdirectory(mgmt_qnode) diff --git a/source/dnode/mgmt/mgmt_bnode/CMakeLists.txt b/source/dnode/mgmt/mgmt_bnode/CMakeLists.txt index 4c35a4ade6..0a6cf52fb8 100644 --- a/source/dnode/mgmt/mgmt_bnode/CMakeLists.txt +++ b/source/dnode/mgmt/mgmt_bnode/CMakeLists.txt @@ -5,5 +5,5 @@ target_include_directories( PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) target_link_libraries( - mgmt_bnode node_common + mgmt_bnode node_util ) \ No newline at end of file diff --git a/source/dnode/mgmt/mgmt_bnode/inc/bmInt.h b/source/dnode/mgmt/mgmt_bnode/inc/bmInt.h index dccf5790e4..0ae0e7ef70 100644 --- a/source/dnode/mgmt/mgmt_bnode/inc/bmInt.h +++ b/source/dnode/mgmt/mgmt_bnode/inc/bmInt.h @@ -16,7 +16,7 @@ #ifndef _TD_DND_BNODE_INT_H_ #define _TD_DND_BNODE_INT_H_ -#include "dmInt.h" +#include "dmUtil.h" #include "bnode.h" diff --git a/source/dnode/mgmt/mgmt_mnode/CMakeLists.txt b/source/dnode/mgmt/mgmt_mnode/CMakeLists.txt index 54171a2daf..04118590a2 100644 --- a/source/dnode/mgmt/mgmt_mnode/CMakeLists.txt +++ b/source/dnode/mgmt/mgmt_mnode/CMakeLists.txt @@ -5,5 +5,5 @@ target_include_directories( PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) target_link_libraries( - mgmt_mnode node_common + mgmt_mnode node_util ) \ No newline at end of file diff --git a/source/dnode/mgmt/mgmt_mnode/inc/mmInt.h b/source/dnode/mgmt/mgmt_mnode/inc/mmInt.h index 125325b16c..4b34406b77 100644 --- a/source/dnode/mgmt/mgmt_mnode/inc/mmInt.h +++ b/source/dnode/mgmt/mgmt_mnode/inc/mmInt.h @@ -16,7 +16,7 @@ #ifndef _TD_DND_MNODE_INT_H_ #define _TD_DND_MNODE_INT_H_ -#include "dmInt.h" +#include "dmUtil.h" #include "mnode.h" #ifdef __cplusplus diff --git a/source/dnode/mgmt/mgmt_qnode/CMakeLists.txt b/source/dnode/mgmt/mgmt_qnode/CMakeLists.txt index 56c136db3d..64f8a45ac4 100644 --- a/source/dnode/mgmt/mgmt_qnode/CMakeLists.txt +++ b/source/dnode/mgmt/mgmt_qnode/CMakeLists.txt @@ -5,5 +5,5 @@ target_include_directories( PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) target_link_libraries( - mgmt_qnode node_common + mgmt_qnode node_util ) \ No newline at end of file diff --git a/source/dnode/mgmt/mgmt_qnode/inc/qmInt.h b/source/dnode/mgmt/mgmt_qnode/inc/qmInt.h index 46b7552e38..0213cdb61e 100644 --- a/source/dnode/mgmt/mgmt_qnode/inc/qmInt.h +++ b/source/dnode/mgmt/mgmt_qnode/inc/qmInt.h @@ -16,7 +16,7 @@ #ifndef _TD_DND_QNODE_INT_H_ #define _TD_DND_QNODE_INT_H_ -#include "dmInt.h" +#include "dmUtil.h" #include "qnode.h" diff --git a/source/dnode/mgmt/mgmt_snode/CMakeLists.txt b/source/dnode/mgmt/mgmt_snode/CMakeLists.txt index 0fb5e90666..62dc41a0ae 100644 --- a/source/dnode/mgmt/mgmt_snode/CMakeLists.txt +++ b/source/dnode/mgmt/mgmt_snode/CMakeLists.txt @@ -5,5 +5,5 @@ target_include_directories( PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) target_link_libraries( - mgmt_snode node_common + mgmt_snode node_util ) \ No newline at end of file diff --git a/source/dnode/mgmt/mgmt_snode/inc/smInt.h b/source/dnode/mgmt/mgmt_snode/inc/smInt.h index 3a2a448633..ca1865c484 100644 --- a/source/dnode/mgmt/mgmt_snode/inc/smInt.h +++ b/source/dnode/mgmt/mgmt_snode/inc/smInt.h @@ -16,7 +16,7 @@ #ifndef _TD_DND_SNODE_INT_H_ #define _TD_DND_SNODE_INT_H_ -#include "dmInt.h" +#include "dmUtil.h" #include "snode.h" diff --git a/source/dnode/mgmt/mgmt_vnode/CMakeLists.txt b/source/dnode/mgmt/mgmt_vnode/CMakeLists.txt index d6dc3ee948..15b822ad92 100644 --- a/source/dnode/mgmt/mgmt_vnode/CMakeLists.txt +++ b/source/dnode/mgmt/mgmt_vnode/CMakeLists.txt @@ -5,5 +5,5 @@ target_include_directories( PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) target_link_libraries( - mgmt_vnode node_common + mgmt_vnode node_util ) \ No newline at end of file diff --git a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h index 2ade6c129b..8b79c4221a 100644 --- a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h +++ b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h @@ -16,7 +16,7 @@ #ifndef _TD_DND_VNODES_INT_H_ #define _TD_DND_VNODES_INT_H_ -#include "dmInt.h" +#include "dmUtil.h" #include "sync.h" #include "vnode.h" diff --git a/source/dnode/mgmt/node_common/CMakeLists.txt b/source/dnode/mgmt/node_common/CMakeLists.txt deleted file mode 100644 index 524f5f76d8..0000000000 --- a/source/dnode/mgmt/node_common/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -aux_source_directory(src DNODE_INTERFACE) -add_library(node_common STATIC ${DNODE_INTERFACE}) -target_include_directories( - node_common - PUBLIC "${TD_SOURCE_DIR}/include/dnode/mgmt" - PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/inc" -) -target_link_libraries( - node_common cjson mnode vnode qnode snode bnode wal sync taos_static tfs monitor -) \ No newline at end of file diff --git a/source/dnode/mgmt/node_util/CMakeLists.txt b/source/dnode/mgmt/node_util/CMakeLists.txt new file mode 100644 index 0000000000..5d879fdbcf --- /dev/null +++ b/source/dnode/mgmt/node_util/CMakeLists.txt @@ -0,0 +1,10 @@ +aux_source_directory(src NODE_UTIL) +add_library(node_util STATIC ${NODE_UTIL}) +target_include_directories( + node_util + PUBLIC "${TD_SOURCE_DIR}/include/dnode/mgmt" + PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/inc" +) +target_link_libraries( + node_util cjson mnode vnode qnode snode bnode wal sync taos_static tfs monitor +) \ No newline at end of file diff --git a/source/dnode/mgmt/node_common/inc/dmInt.h b/source/dnode/mgmt/node_util/inc/dmUtil.h similarity index 99% rename from source/dnode/mgmt/node_common/inc/dmInt.h rename to source/dnode/mgmt/node_util/inc/dmUtil.h index b453595030..f43787989a 100644 --- a/source/dnode/mgmt/node_common/inc/dmInt.h +++ b/source/dnode/mgmt/node_util/inc/dmUtil.h @@ -133,6 +133,7 @@ typedef struct { const char *dmStatStr(EDndRunStatus stype); const char *dmNodeLogName(EDndNodeType ntype); const char *dmNodeProcName(EDndNodeType ntype); +const char *dmNodeName(EDndNodeType ntype); const char *dmEventStr(EDndEvent etype); const char *dmProcStr(EDndProcType ptype); void *dmSetMgmtHandle(SArray *pArray, tmsg_t msgType, void *nodeMsgFp, bool needCheckVgId); diff --git a/source/dnode/mgmt/node_common/src/dmEnv.c b/source/dnode/mgmt/node_util/src/dmEnv.c similarity index 98% rename from source/dnode/mgmt/node_common/src/dmEnv.c rename to source/dnode/mgmt/node_util/src/dmEnv.c index 4bc618bca8..e9a7d56450 100644 --- a/source/dnode/mgmt/node_common/src/dmEnv.c +++ b/source/dnode/mgmt/node_util/src/dmEnv.c @@ -14,7 +14,7 @@ */ #define _DEFAULT_SOURCE -#include "dmInt.h" +#include "dmUtil.h" static int8_t once = DND_ENV_INIT; diff --git a/source/dnode/mgmt/node_common/src/dmFile.c b/source/dnode/mgmt/node_util/src/dmFile.c similarity index 99% rename from source/dnode/mgmt/node_common/src/dmFile.c rename to source/dnode/mgmt/node_util/src/dmFile.c index a49d4ae9e7..1eea9ad234 100644 --- a/source/dnode/mgmt/node_common/src/dmFile.c +++ b/source/dnode/mgmt/node_util/src/dmFile.c @@ -14,7 +14,7 @@ */ #define _DEFAULT_SOURCE -#include "dmInt.h" +#include "dmUtil.h" #define MAXLEN 1024 diff --git a/source/dnode/mgmt/node_common/src/dmUtil.c b/source/dnode/mgmt/node_util/src/dmUtil.c similarity index 90% rename from source/dnode/mgmt/node_common/src/dmUtil.c rename to source/dnode/mgmt/node_util/src/dmUtil.c index 157272611c..8a3893b93c 100644 --- a/source/dnode/mgmt/node_common/src/dmUtil.c +++ b/source/dnode/mgmt/node_util/src/dmUtil.c @@ -14,7 +14,7 @@ */ #define _DEFAULT_SOURCE -#include "dmInt.h" +#include "dmUtil.h" const char *dmStatStr(EDndRunStatus stype) { @@ -64,6 +64,23 @@ const char *dmNodeProcName(EDndNodeType ntype) { } } +const char *dmNodeName(EDndNodeType ntype) { + switch (ntype) { + case VNODE: + return "vnode"; + case QNODE: + return "qnode"; + case SNODE: + return "snode"; + case MNODE: + return "mnode"; + case BNODE: + return "bnode"; + default: + return "dnode"; + } +} + const char *dmEventStr(EDndEvent ev) { switch (ev) { case DND_EVENT_START: