refactor
This commit is contained in:
parent
f2253189b7
commit
dde486998c
|
@ -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;
|
||||
|
||||
|
|
|
@ -63,4 +63,6 @@ int tfsUpdateDiskInfo(SDisk *pDisk) {
|
|||
pDisk->dmeta.free = dstat.avail;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
const char *tfsDiskDir(SDisk *pDisk) { return pDisk->dir; }
|
|
@ -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";
|
||||
|
|
Loading…
Reference in New Issue