• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * sys/dirent.h
3  */
4 
5 #ifndef DIRENT_H
6 #define DIRENT_H
7 
8 #include <stdint.h>
9 #include <sys/types.h>
10 
11 #ifndef NAME_MAX
12 #define NAME_MAX 255
13 #endif
14 
15 struct dirent {
16     uint32_t d_ino;
17     uint32_t d_off;
18     uint16_t d_reclen;
19     uint16_t d_type;
20     char d_name[NAME_MAX + 1];
21 };
22 
23 enum dirent_type {
24     DT_UNKNOWN	=  0,
25     DT_FIFO	=  1,
26     DT_CHR	=  2,
27     DT_DIR	=  4,
28     DT_BLK	=  6,
29     DT_REG	=  8,
30     DT_LNK	= 10,
31     DT_SOCK	= 12,
32     DT_WHT	= 14,
33 };
34 
35 /*
36  * Convert between stat structure mode types and directory types.
37  * The stat structure mode types are the same as in Linux.
38  */
39 #define IFTODT(mode)	(((mode) & 0170000) >> 12)
40 #define DTTOIF(dt)	((dt) << 12)
41 
42 struct _DIR_;
43 typedef struct _DIR_ DIR;
44 
45 #endif /* sys/dirent.h */
46