From 222987c002125434357038c16636366ab115e779 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Wed, 13 Apr 2022 16:39:36 +0800 Subject: [PATCH] Revert "fix(grant): taosd -k." This reverts commit 11e772d4d4074c9160db4f5089770a1664ffb2a0. --- .../inc/mndGrant.h => include/common/tgrant.h | 4 +-- include/os/osFile.h | 2 +- include/os/osSystem.h | 7 ---- source/dnode/mgmt/CMakeLists.txt | 2 +- source/dnode/mgmt/exe/dndMain.c | 2 +- source/dnode/mnode/impl/CMakeLists.txt | 7 ---- source/dnode/mnode/impl/src/mndGrant.c | 6 ++-- source/dnode/mnode/impl/src/mnode.c | 2 -- source/os/src/osFile.c | 2 +- source/os/src/osSystem.c | 32 ------------------- 10 files changed, 9 insertions(+), 57 deletions(-) rename source/dnode/mnode/impl/inc/mndGrant.h => include/common/tgrant.h (92%) diff --git a/source/dnode/mnode/impl/inc/mndGrant.h b/include/common/tgrant.h similarity index 92% rename from source/dnode/mnode/impl/inc/mndGrant.h rename to include/common/tgrant.h index ad3dc7f79d..962af0ddc4 100644 --- a/source/dnode/mnode/impl/inc/mndGrant.h +++ b/include/common/tgrant.h @@ -36,8 +36,8 @@ typedef enum { TSDB_GRANT_CPU_CORES, } EGrantType; -int32_t mndInitGrant(); -void mndCleanupGrant(); +int32_t grantInit(); +void grantCleanUp(); void grantParseParameter(); int32_t grantCheck(EGrantType grant); void grantReset(EGrantType grant, uint64_t value); diff --git a/include/os/osFile.h b/include/os/osFile.h index 36ca6fb8bb..89b58cdd65 100644 --- a/include/os/osFile.h +++ b/include/os/osFile.h @@ -79,7 +79,7 @@ int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset) int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count); void taosFprintfFile(TdFilePtr pFile, const char *format, ...); -int64_t taosGetLineFile(TdFilePtr pFile, char ** __restrict ptrBuf); +int64_t taosGetLineFile(TdFilePtr pFile, char ** __restrict__ ptrBuf); int32_t taosEOFFile(TdFilePtr pFile); diff --git a/include/os/osSystem.h b/include/os/osSystem.h index 33b0a46ee9..15959a2d8c 100644 --- a/include/os/osSystem.h +++ b/include/os/osSystem.h @@ -29,13 +29,6 @@ extern "C" { #define tcgetattr TCGETATTR_FUNC_TAOS_FORBID #endif -typedef struct TdCmd *TdCmdPtr; - -TdCmdPtr taosOpenCmd(const char *cmd); -int64_t taosGetLineCmd(TdCmdPtr pCmd, char ** __restrict ptrBuf); -int32_t taosEOFCmd(TdCmdPtr pCmd); -int64_t taosCloseCmd(TdCmdPtr *ppCmd); - void* taosLoadDll(const char* filename); void* taosLoadSym(void* handle, char* name); void taosCloseDll(void* handle); diff --git a/source/dnode/mgmt/CMakeLists.txt b/source/dnode/mgmt/CMakeLists.txt index 8fb4b02479..297e3a08d7 100644 --- a/source/dnode/mgmt/CMakeLists.txt +++ b/source/dnode/mgmt/CMakeLists.txt @@ -20,7 +20,6 @@ add_executable(taosd ${EXEC_SRC}) target_include_directories( taosd PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" - PRIVATE "${TD_SOURCE_DIR}/source/dnode/mnode/impl/inc" ) target_link_libraries(taosd dnode) @@ -29,6 +28,7 @@ IF (TD_GRANT) ENDIF () IF (TD_USB_DONGLE) TARGET_LINK_LIBRARIES(taosd usb_dongle) +else() ENDIF () if(${BUILD_TEST}) diff --git a/source/dnode/mgmt/exe/dndMain.c b/source/dnode/mgmt/exe/dndMain.c index 80c431fe36..66ab2a6dcd 100644 --- a/source/dnode/mgmt/exe/dndMain.c +++ b/source/dnode/mgmt/exe/dndMain.c @@ -16,7 +16,7 @@ #define _DEFAULT_SOURCE #include "dndInt.h" #include "tconfig.h" -#include "mndGrant.h" +#include "tgrant.h" static struct { bool dumpConfig; diff --git a/source/dnode/mnode/impl/CMakeLists.txt b/source/dnode/mnode/impl/CMakeLists.txt index 8cb5e2a528..341dbf6135 100644 --- a/source/dnode/mnode/impl/CMakeLists.txt +++ b/source/dnode/mnode/impl/CMakeLists.txt @@ -9,13 +9,6 @@ target_link_libraries( mnode scheduler sdb wal transport cjson sync monitor executor qworker stream parser ) -IF (TD_GRANT) - TARGET_LINK_LIBRARIES(mnode grant) -ENDIF () -IF (TD_USB_DONGLE) - TARGET_LINK_LIBRARIES(mnode usb_dongle) -ENDIF () - if(${BUILD_TEST}) add_subdirectory(test) endif(${BUILD_TEST}) diff --git a/source/dnode/mnode/impl/src/mndGrant.c b/source/dnode/mnode/impl/src/mndGrant.c index 37f87142e6..cdf3271789 100644 --- a/source/dnode/mnode/impl/src/mndGrant.c +++ b/source/dnode/mnode/impl/src/mndGrant.c @@ -17,11 +17,11 @@ #ifndef _GRANT #include "os.h" #include "taoserror.h" -#include "mndGrant.h" +#include "tgrant.h" #include "mndInt.h" -int32_t mndInitGrant(SMnode *pMnode) { return TSDB_CODE_SUCCESS; } -void mndCleanupGrant() {} +int32_t grantInit() { return TSDB_CODE_SUCCESS; } +void grantCleanUp() {} void grantParseParameter() { mError("can't parsed parameter k"); } int32_t grantCheck(EGrantType grant) { return TSDB_CODE_SUCCESS; } void grantReset(EGrantType grant, uint64_t value) {} diff --git a/source/dnode/mnode/impl/src/mnode.c b/source/dnode/mnode/impl/src/mnode.c index cad6396338..5a1780530c 100644 --- a/source/dnode/mnode/impl/src/mnode.c +++ b/source/dnode/mnode/impl/src/mnode.c @@ -40,7 +40,6 @@ #include "mndUser.h" #include "mndVgroup.h" #include "mndQuery.h" -#include "mndGrant.h" #define MQ_TIMER_MS 3000 #define TRNAS_TIMER_MS 6000 @@ -198,7 +197,6 @@ static int32_t mndInitSteps(SMnode *pMnode, bool deploy) { if (mndAllocStep(pMnode, "mnode-qnode", mndInitBnode, mndCleanupBnode) != 0) return -1; if (mndAllocStep(pMnode, "mnode-dnode", mndInitDnode, mndCleanupDnode) != 0) return -1; if (mndAllocStep(pMnode, "mnode-user", mndInitUser, mndCleanupUser) != 0) return -1; - if (mndAllocStep(pMnode, "mnode-grant", mndInitGrant, mndCleanupGrant) != 0) return -1; if (mndAllocStep(pMnode, "mnode-auth", mndInitAuth, mndCleanupAuth) != 0) return -1; if (mndAllocStep(pMnode, "mnode-acct", mndInitAcct, mndCleanupAcct) != 0) return -1; if (mndAllocStep(pMnode, "mnode-stream", mndInitStream, mndCleanupStream) != 0) return -1; diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index 4b55d4912c..4bd6b9e5cd 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -768,7 +768,7 @@ int32_t taosUmaskFile(int32_t maskVal) { } int32_t taosGetErrorFile(TdFilePtr pFile) { return errno; } -int64_t taosGetLineFile(TdFilePtr pFile, char **__restrict ptrBuf) { +int64_t taosGetLineFile(TdFilePtr pFile, char **__restrict__ ptrBuf) { if (pFile == NULL) { return -1; } diff --git a/source/os/src/osSystem.c b/source/os/src/osSystem.c index 665f6370e1..a36b3d41d0 100644 --- a/source/os/src/osSystem.c +++ b/source/os/src/osSystem.c @@ -29,8 +29,6 @@ struct termios oldtio; #endif -typedef struct FILE TdCmd; - void* taosLoadDll(const char* filename) { #if defined(WINDOWS) return NULL; @@ -180,33 +178,3 @@ void resetTerminalMode() { } #endif } - -TdCmdPtr taosOpenCmd(const char *cmd) { - if (cmd == NULL) return NULL; - return (TdCmdPtr)popen(cmd, "r"); -} - -int64_t taosGetLineCmd(TdCmdPtr pCmd, char ** __restrict ptrBuf) { - if (pCmd == NULL) { - return -1; - } - - size_t len = 0; - return getline(ptrBuf, &len, (FILE*)pCmd); -} - -int32_t taosEOFCmd(TdCmdPtr pCmd) { - if (pCmd == NULL) { - return 0; - } - return feof((FILE*)pCmd); -} - -int64_t taosCloseCmd(TdCmdPtr *ppCmd) { - if (ppCmd == NULL || *ppCmd == NULL) { - return 0; - } - pclose((FILE*)(*ppCmd)); - *ppCmd = NULL; - return 0; -} -- GitLab