osDir.h 2.1 KB
Newer Older
S
Shengliang Guan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 *
 * This program is free software: you can use, redistribute, and/or modify
 * it under the terms of the GNU Affero General Public License, version 3
 * or later ("AGPL"), as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

S
Shengliang Guan 已提交
16 17
#ifndef _TD_OS_DIR_H_
#define _TD_OS_DIR_H_
S
Shengliang Guan 已提交
18

wafwerar's avatar
wafwerar 已提交
19
// If the error is in a third-party library, place this header file under the third-party library header file.
wafwerar's avatar
wafwerar 已提交
20
// When you want to use this feature, you should find or add the same function in the following section.
wafwerar's avatar
wafwerar 已提交
21 22 23 24 25 26 27 28 29
#ifndef ALLOW_FORBID_FUNC
    #define opendir OPENDIR_FUNC_TAOS_FORBID
    #define readdir READDIR_FUNC_TAOS_FORBID
    #define closedir CLOSEDIR_FUNC_TAOS_FORBID
    #define dirname DIRNAME_FUNC_TAOS_FORBID
    #undef basename
    #define basename BASENAME_FUNC_TAOS_FORBID
#endif

S
Shengliang Guan 已提交
30 31 32 33
#ifdef __cplusplus
extern "C" {
#endif

wafwerar's avatar
wafwerar 已提交
34 35 36 37
typedef struct TdDir *TdDirPtr;
typedef struct TdDirEntry *TdDirEntryPtr;


38
void    taosRemoveDir(const char *dirname);
wafwerar's avatar
wafwerar 已提交
39
bool    taosDirExist(const char *dirname);
40
int32_t taosMkDir(const char *dirname);
wafwerar's avatar
wafwerar 已提交
41
int32_t taosMulMkDir(const char *dirname);
S
config  
Shengliang Guan 已提交
42
void    taosRemoveOldFiles(const char *dirname, int32_t keepDays);
S
config  
Shengliang Guan 已提交
43
int32_t taosExpandDir(const char *dirname, char *outname, int32_t maxlen);
wafwerar's avatar
wafwerar 已提交
44
int32_t taosRealPath(char *dirname, char *realPath, int32_t maxlen);
45
bool    taosIsDir(const char *dirname);
wafwerar's avatar
wafwerar 已提交
46 47 48 49 50 51 52
char*   taosDirName(char *dirname);
char*   taosDirEntryBaseName(char *dirname);

TdDirPtr      taosOpenDir(const char *dirname);
TdDirEntryPtr taosReadDir(TdDirPtr pDir);
bool          taosDirEntryIsDir(TdDirEntryPtr pDirEntry);
char*         taosGetDirEntryName(TdDirEntryPtr pDirEntry);
wafwerar's avatar
wafwerar 已提交
53
int32_t       taosCloseDir(TdDirPtr *ppDir);
S
Shengliang Guan 已提交
54 55 56 57 58

#ifdef __cplusplus
}
#endif

S
Shengliang Guan 已提交
59
#endif /*_TD_OS_DIR_H_*/