add whiteout entry type
[unix-history] / usr / src / sys / sys / dirent.h
CommitLineData
bafa9907 1/*-
56559b70
KB
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
bafa9907
KM
4 *
5 * %sccs.include.redist.c%
6 *
1e3d3afd 7 * @(#)dirent.h 8.3 (Berkeley) %G%
bafa9907
KM
8 */
9
10/*
11 * The dirent structure defines the format of directory entries returned by
12 * the getdirentries(2) system call.
13 *
14 * A directory entry has a struct dirent at the front of it, containing its
15 * inode number, the length of the entry, and the length of the name
16 * contained in the entry. These are followed by the name padded to a 4
17 * byte boundary with null bytes. All names are guaranteed null terminated.
18 * The maximum length of a name in a directory is MAXNAMLEN.
19 */
20
21struct dirent {
b9d59a05
KB
22 u_int32_t d_fileno; /* file number of entry */
23 u_int16_t d_reclen; /* length of this record */
24 u_int8_t d_type; /* file type, see below */
25 u_int8_t d_namlen; /* length of string in d_name */
bafa9907
KM
26#ifdef _POSIX_SOURCE
27 char d_name[255 + 1]; /* name must be no longer than this */
28#else
29#define MAXNAMLEN 255
30 char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */
31#endif
32};
f5c71436
KM
33
34/*
35 * File types
36 */
add19925
KM
37#define DT_UNKNOWN 0
38#define DT_FIFO 1
39#define DT_CHR 2
40#define DT_DIR 4
41#define DT_BLK 6
42#define DT_REG 8
43#define DT_LNK 10
44#define DT_SOCK 12
1e3d3afd 45#define DT_WHT 14
add19925
KM
46
47/*
48 * Convert between stat structure types and directory types.
49 */
50#define IFTODT(mode) (((mode) & 0170000) >> 12)
51#define DTTOIF(dirtype) ((dirtype) << 12)