1 /* 2 ** Distributed under the terms of the Haiku License. 3 */ 4 #ifndef _DIRENT_H 5 #define _DIRENT_H 6 7 8 #include <sys/types.h> 9 10 11 typedef struct dirent { 12 dev_t d_dev; /* device */ 13 dev_t d_pdev; /* parent device (only for queries) */ 14 ino_t d_ino; /* inode number */ 15 ino_t d_pino; /* parent inode (only for queries) */ 16 unsigned short d_reclen; /* length of this record, not the name */ 17 char d_name[1]; /* name of the entry (null byte terminated) */ 18 } dirent_t; 19 20 typedef struct { 21 int fd; 22 struct dirent ent; 23 } DIR; 24 25 #ifndef MAXNAMLEN 26 # ifdef NAME_MAX 27 # define MAXNAMLEN NAME_MAX 28 # else 29 # define MAXNAMLEN 256 30 # endif 31 #endif 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 DIR *opendir(const char *dirname); 38 struct dirent *readdir(DIR *dir); 39 int readdir_r(DIR *dir, struct dirent *entry, struct dirent **_result); 40 int closedir(DIR *dir); 41 void rewinddir(DIR *dir); 42 void seekdir(DIR *dir, long int loc); 43 long int telldir(DIR *); 44 45 #ifdef __cplusplus 46 } 47 #endif 48 49 #endif /* _DIRENT_H */ 50