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

refactor

上级 f2253189
...@@ -186,7 +186,7 @@ static int32_t dnodeInitStorage() { ...@@ -186,7 +186,7 @@ static int32_t dnodeInitStorage() {
dError("failed to init TFS since %s", tstrerror(terrno)); dError("failed to init TFS since %s", tstrerror(terrno));
return -1; return -1;
} }
tfsPrimaryPath(tsDataDir); snprintf(tsDataDir, tfsPrimaryPath(), TSDB_FILENAME_LEN);
sprintf(tsMnodeDir, "%s/mnode", tsDataDir); sprintf(tsMnodeDir, "%s/mnode", tsDataDir);
sprintf(tsVnodeDir, "%s/vnode", tsDataDir); sprintf(tsVnodeDir, "%s/vnode", tsDataDir);
sprintf(tsDnodeDir, "%s/dnode", tsDataDir); sprintf(tsDnodeDir, "%s/dnode", tsDataDir);
......
...@@ -31,11 +31,12 @@ typedef struct { ...@@ -31,11 +31,12 @@ typedef struct {
int tfsInit(SDiskCfg *pDiskCfg, int ndisk); int tfsInit(SDiskCfg *pDiskCfg, int ndisk);
void tfsDestroy(); void tfsDestroy();
int tfsUpdateInfo(); int tfsUpdateInfo();
void tfsPrimaryPath(char *dst);
int tfsCreateDir(char *dirname); int tfsCreateDir(char *dirname);
int tfsRemoveDir(char *dirname); int tfsRemoveDir(char *dirname);
int tfsRename(char *oldpath, char *newpath); int tfsRename(char *oldpath, char *newpath);
const char *tfsPrimaryPath();
// tfcntl.c // tfcntl.c
typedef struct TFSFILE TFSFILE; typedef struct TFSFILE TFSFILE;
typedef struct TFSDIR TFSDIR; typedef struct TFSDIR TFSDIR;
......
...@@ -35,6 +35,8 @@ SDisk *tfsNewDisk(int level, int id, char *dir); ...@@ -35,6 +35,8 @@ SDisk *tfsNewDisk(int level, int id, char *dir);
void tfsFreeDisk(SDisk *pDisk); void tfsFreeDisk(SDisk *pDisk);
int tfsUpdateDiskInfo(SDisk *pDisk); int tfsUpdateDiskInfo(SDisk *pDisk);
const char *tfsDiskDir(SDisk *pDisk);
// ttier.c // ttier.c
typedef struct STier STier; typedef struct STier STier;
......
...@@ -63,4 +63,6 @@ int tfsUpdateDiskInfo(SDisk *pDisk) { ...@@ -63,4 +63,6 @@ int tfsUpdateDiskInfo(SDisk *pDisk) {
pDisk->dmeta.free = dstat.avail; pDisk->dmeta.free = dstat.avail;
return 0; return 0;
} }
\ No newline at end of file
const char *tfsDiskDir(SDisk *pDisk) { return pDisk->dir; }
\ No newline at end of file
...@@ -100,9 +100,7 @@ int tfsUpdateInfo() { ...@@ -100,9 +100,7 @@ int tfsUpdateInfo() {
tfsUnLock(); tfsUnLock();
} }
void tfsPrimaryPath(char *dst) { const char *tfsPrimaryPath() { return tfsDiskDir(DISK_AT(0, 0)); }
strncpy(dst, DISK_AT(0, 0)->dir, TSDB_FILENAME_LEN);
}
int tfsCreateDir(char *dirname) { int tfsCreateDir(char *dirname) {
char dirName[TSDB_FILENAME_LEN] = "\0"; char dirName[TSDB_FILENAME_LEN] = "\0";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册