File: sys_dirent.h

package info (click to toggle)
cern-httpd 3.0A-1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 5,392 kB
  • ctags: 6,554
  • sloc: ansic: 37,902; makefile: 1,746; perl: 535; csh: 167; sh: 143
file content (52 lines) | stat: -rw-r--r-- 1,896 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* this file was adapted for VMS. NOT ALL UNIX FEATURES WORK */

/*
 *------> THE DESCRIPTION BELOW IS FOR UNIX... <----- 
 * Filesystem-independent directory information.
 * Directory entry structures are of variable length.
 * Each directory entry is a struct dirent containing its file number, the
 * offset of the next entry (a cookie interpretable only the filesystem
 * type that generated it), the length of the entry, and the length of the
 * name contained in the entry.  These are followed by the name. The
 * entire entry is padded with null bytes to a 4 byte boundary. All names
 * are guaranteed null terminated. The maximum length of a name in a
 * directory is MAXNAMLEN, plus a null byte.
 *------> THE DESCRIPTION BELOW IS FOR VMS... <----- 
 * for VMS only d_name, d_namlen and d_ino are defined.
 * d_fileno is a nonzero number to make you think the file is there. The number
 *          has no other meaning.
 */

#ifndef	__sys_dirent_h
#define	__sys_dirent_h

struct	dirent {
#if 0
	off_t		d_off;		/* offset of next disk dir entry */
#endif
	unsigned long	d_fileno;	/* file number of entry */
#if 0
	unsigned short	d_reclen;	/* length of this record */
#endif
	unsigned short	d_namlen;	/* length of string in d_name */
	char		d_name[255+1];	/* name (up to MAXNAMLEN + 1) */
};

#ifndef	_POSIX_SOURCE
/*
 * It's unlikely to change, but make sure that sizeof d_name above is
 * at least MAXNAMLEN + 1 (more may be added for padding).
 */
#define	MAXNAMLEN	255
/*
 * The macro DIRSIZ(dp) gives the minimum amount of space required to represent
 * a directory entry.  For any directory entry dp->d_reclen >= DIRSIZ(dp).
 * Specific filesystem types may use this macro to construct the value
 * for d_reclen.
 */
#undef	DIRSIZ
#define	DIRSIZ(dp) \
	(((sizeof(struct dirent) - (MAXNAMLEN+1) + ((dp)->d_namlen+1)) +3) & ~3)

#endif	/* !_POSIX_SOURCE */
#endif	/* !__sys_dirent_h */