1 /* 2 ** Distributed under the terms of the MIT License. 3 */ 4 #ifndef _FSSH_DIRENT_H 5 #define _FSSH_DIRENT_H 6 7 8 #include "fssh_defs.h" 9 10 11 typedef struct fssh_dirent { 12 fssh_dev_t d_dev; /* device */ 13 fssh_dev_t d_pdev; /* parent device (only for queries) */ 14 fssh_ino_t d_ino; /* inode number */ 15 fssh_ino_t d_pino; /* parent inode (only for queries) */ 16 unsigned short d_reclen; /* length of this record, not the name */ 17 #if __GNUC__ == 2 18 char d_name[0]; /* name of the entry (null byte terminated) */ 19 #else 20 char d_name[]; /* name of the entry (null byte terminated) */ 21 #endif 22 } fssh_dirent_t; 23 24 typedef struct { 25 int fd; 26 struct fssh_dirent ent; 27 } fssh_DIR; 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 fssh_DIR *fssh_opendir(const char *dirname); 34 struct fssh_dirent *fssh_readdir(fssh_DIR *dir); 35 int fssh_readdir_r(fssh_DIR *dir, struct fssh_dirent *entry, 36 struct fssh_dirent **_result); 37 int fssh_closedir(fssh_DIR *dir); 38 void fssh_rewinddir(fssh_DIR *dir); 39 void fssh_seekdir(fssh_DIR *dir, long int loc); 40 long int fssh_telldir(fssh_DIR *); 41 42 #ifdef __cplusplus 43 } 44 #endif 45 46 #endif /* _FSSH_DIRENT_H */ 47