1 /* 2 * Copyright (C) 2018-2020 Alibaba Group Holding Limited 3 */ 4 5 #ifndef _DIRENT_H 6 #define _DIRENT_H 7 8 #ifdef __cplusplus 9 extern "C" { 10 #endif 11 12 #include <stdint.h> 13 #include <sys/stat.h> 14 #include <aos/vfs.h> 15 16 /* file types. */ 17 #define DT_UNKNOWN 0 18 #define DT_FIFO 1 19 #define DT_CHR 2 20 #define DT_DIR 4 21 #define DT_BLK 6 22 #define DT_REG 8 23 #define DT_LNK 10 24 #define DT_SOCK 12 25 #define DT_WHT 14 26 27 #define DIRSIZ(dp) (offsetof(struct dirent, d_name) + ((strlen((dp)->d_name) + 1 + 3) & ~3)) 28 29 typedef aos_dir_t DIR; 30 31 struct dirent { 32 int d_ino; /* file number */ 33 uint8_t d_type; /* type of file */ 34 char d_name[]; /* file name */ 35 }; 36 37 DIR * opendir(const char *dirname); 38 int closedir(DIR *dirp); 39 struct dirent *readdir(DIR *dirp); 40 long telldir(DIR *dirp); 41 void seekdir(DIR *dirp, long loc); 42 int mkdir(const char *path, mode_t mode); 43 int rmdir(const char *path); 44 void rewinddir(DIR *dirp); 45 int chdir(const char *path); 46 47 #ifdef __cplusplus 48 } 49 #endif 50 51 #endif /* _DIRENT_H */ 52