提交 dde48699 编写于 作者: H Hongze Cheng

refactor

上级 f2253189
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -64,3 +64,5 @@ int tfsUpdateDiskInfo(SDisk *pDisk) {
return 0;
}
const char *tfsDiskDir(SDisk *pDisk) { return pDisk->dir; }
\ No newline at end of file
......@@ -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";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册