diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c index 8b2f9880585202d7fb8d7a34e33f96bbbc384d24..a2f85d5ae0f999b46faa1b9edce4c471c8a733bf 100644 --- a/src/dnode/src/dnodeMain.c +++ b/src/dnode/src/dnodeMain.c @@ -186,7 +186,7 @@ static int32_t dnodeInitStorage() { dError("failed to init TFS since %s", tstrerror(terrno)); return -1; } - tfsPrimaryPath(tsDataDir); + snprintf(tsDataDir, tfsPrimaryPath(), TSDB_FILENAME_LEN); sprintf(tsMnodeDir, "%s/mnode", tsDataDir); sprintf(tsVnodeDir, "%s/vnode", tsDataDir); sprintf(tsDnodeDir, "%s/dnode", tsDataDir); diff --git a/src/inc/tfs.h b/src/inc/tfs.h index 40b38b32d59ae45778d157542ae6083f81c27601..8c57c09b83e3019f4d7fffa095faaaf2daae4241 100644 --- a/src/inc/tfs.h +++ b/src/inc/tfs.h @@ -31,11 +31,12 @@ typedef struct { int tfsInit(SDiskCfg *pDiskCfg, int ndisk); void tfsDestroy(); int tfsUpdateInfo(); -void tfsPrimaryPath(char *dst); int tfsCreateDir(char *dirname); int tfsRemoveDir(char *dirname); int tfsRename(char *oldpath, char *newpath); +const char *tfsPrimaryPath(); + // tfcntl.c typedef struct TFSFILE TFSFILE; typedef struct TFSDIR TFSDIR; diff --git a/src/tfs/inc/tfsint.h b/src/tfs/inc/tfsint.h index 745388f5d5eedfefe0793c4c4383374541c0341e..25b5467fef0b8a9456debc0f97cd5460d92b28da 100644 --- a/src/tfs/inc/tfsint.h +++ b/src/tfs/inc/tfsint.h @@ -35,6 +35,8 @@ SDisk *tfsNewDisk(int level, int id, char *dir); void tfsFreeDisk(SDisk *pDisk); int tfsUpdateDiskInfo(SDisk *pDisk); +const char *tfsDiskDir(SDisk *pDisk); + // ttier.c typedef struct STier STier; diff --git a/src/tfs/src/tdisk.c b/src/tfs/src/tdisk.c index d5593de651accc5495b4e4a65347f058588dd9d5..5a611d45d98cbaf0fd4d72a5b009f48a102d8adc 100644 --- a/src/tfs/src/tdisk.c +++ b/src/tfs/src/tdisk.c @@ -63,4 +63,6 @@ int tfsUpdateDiskInfo(SDisk *pDisk) { pDisk->dmeta.free = dstat.avail; return 0; -} \ No newline at end of file +} + +const char *tfsDiskDir(SDisk *pDisk) { return pDisk->dir; } \ No newline at end of file diff --git a/src/tfs/src/tfs.c b/src/tfs/src/tfs.c index 2d63371a40cb6c438dacd405551d6a7b6fc9ec9e..41335646f41df40404c96cf8c032e0e45ffebcd9 100644 --- a/src/tfs/src/tfs.c +++ b/src/tfs/src/tfs.c @@ -100,9 +100,7 @@ int tfsUpdateInfo() { tfsUnLock(); } -void tfsPrimaryPath(char *dst) { - strncpy(dst, DISK_AT(0, 0)->dir, TSDB_FILENAME_LEN); -} +const char *tfsPrimaryPath() { return tfsDiskDir(DISK_AT(0, 0)); } int tfsCreateDir(char *dirname) { char dirName[TSDB_FILENAME_LEN] = "\0";