refactor
This commit is contained in:
parent
683494295e
commit
072d42e0fa
|
@ -27,38 +27,35 @@ typedef struct {
|
||||||
int id;
|
int id;
|
||||||
} SDiskID;
|
} SDiskID;
|
||||||
|
|
||||||
// tfs.c
|
// tfs.c ====================================
|
||||||
int tfsInit(SDiskCfg *pDiskCfg, int ndisk);
|
int tfsInit(SDiskCfg *pDiskCfg, int ndisk);
|
||||||
void tfsDestroy();
|
void tfsDestroy();
|
||||||
int tfsUpdateInfo();
|
int tfsUpdateInfo();
|
||||||
int tfsCreateDir(char *dirname);
|
|
||||||
int tfsRemoveDir(char *dirname);
|
|
||||||
int tfsRename(char *oldpath, char *newpath);
|
|
||||||
|
|
||||||
|
const char *tfsGetDiskName(int level, int id);
|
||||||
const char *tfsPrimaryPath();
|
const char *tfsPrimaryPath();
|
||||||
|
|
||||||
// tfcntl.c
|
// tfcntl.c ====================================
|
||||||
typedef struct TFSFILE TFSFILE;
|
typedef struct TFSFILE TFSFILE;
|
||||||
typedef struct TFSDIR TFSDIR;
|
|
||||||
|
|
||||||
TFSDIR * tfsOpenDir(char *dir);
|
|
||||||
void tfsCloseDir(TFSDIR *tdir);
|
|
||||||
const TFSFILE *tfsReadDir(TFSDIR *tdir);
|
|
||||||
|
|
||||||
const char *tfsAbsName(TFSFILE *pfile);
|
const char *tfsAbsName(TFSFILE *pfile);
|
||||||
const char *tfsRelName(TFSFILE *pfile);
|
const char *tfsRelName(TFSFILE *pfile);
|
||||||
void tfsDirName(TFSFILE *pfile, char dest[]);
|
void tfsDirName(TFSFILE *pfile, char dest[]);
|
||||||
void tfsBaseName(TFSFILE *pfile, char dest[]);
|
void tfsBaseName(TFSFILE *pfile, char dest[]);
|
||||||
|
int tfsopen(TFSFILE *pfile, int flags);
|
||||||
|
int tfsclose(int fd);
|
||||||
|
TFSFILE * tfsCreateFiles(int level, int nfile, ...);
|
||||||
|
int tfsRemoveFiles(int nfile, ...);
|
||||||
|
SDiskID tfsFileID(TFSFILE *pfile);
|
||||||
|
|
||||||
int tfsopen(TFSFILE *pfile, int flags);
|
typedef struct TFSDIR TFSDIR;
|
||||||
int tfsclose(int fd);
|
|
||||||
|
|
||||||
TFSFILE *tfsCreateFiles(int level, int nfile, ...);
|
int tfsCreateDir(char *dirname);
|
||||||
int tfsRemoveFiles(int nfile, ...);
|
int tfsRemoveDir(char *dirname);
|
||||||
|
int tfsRename(char *oldpath, char *newpath);
|
||||||
SDiskID tfsFileID(TFSFILE *pfile);
|
TFSDIR * tfsOpenDir(char *dir);
|
||||||
|
void tfsCloseDir(TFSDIR *tdir);
|
||||||
const char *tfsGetDiskName(int level, int id);
|
const TFSFILE *tfsReadDir(TFSDIR *tdir);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,13 @@ int tfsUpdateDiskInfo(SDisk *pDisk);
|
||||||
const char *tfsDiskDir(SDisk *pDisk);
|
const char *tfsDiskDir(SDisk *pDisk);
|
||||||
|
|
||||||
// ttier.c
|
// ttier.c
|
||||||
typedef struct STier STier;
|
#define TSDB_MAX_DISK_PER_TIER 16
|
||||||
|
|
||||||
|
typedef struct STier {
|
||||||
|
int level;
|
||||||
|
int ndisk;
|
||||||
|
SDisk *disks[TSDB_MAX_DISK_PER_TIER];
|
||||||
|
} STier;
|
||||||
|
|
||||||
#define DISK_AT_TIER(pTier, id) ((pTier)->disks[id])
|
#define DISK_AT_TIER(pTier, id) ((pTier)->disks[id])
|
||||||
|
|
||||||
|
|
|
@ -17,13 +17,6 @@
|
||||||
#include "tfsint.h"
|
#include "tfsint.h"
|
||||||
#include "taoserror.h"
|
#include "taoserror.h"
|
||||||
|
|
||||||
#define TSDB_MAX_DISK_PER_TIER 16
|
|
||||||
struct STier {
|
|
||||||
int level;
|
|
||||||
int ndisk;
|
|
||||||
SDisk *disks[TSDB_MAX_DISK_PER_TIER];
|
|
||||||
};
|
|
||||||
|
|
||||||
// PROTECTED ==========================================
|
// PROTECTED ==========================================
|
||||||
void tfsInitTier(STier *pTier, int level) {
|
void tfsInitTier(STier *pTier, int level) {
|
||||||
pTier->level = level;
|
pTier->level = level;
|
||||||
|
|
Loading…
Reference in New Issue