8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / libbc / inc / include / sys / dirent.h
blobf4a154290a15f85a088a935d60a19c33ac72cc62
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 1989 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984 AT&T */
28 /* All Rights Reserved */
30 #pragma ident "%Z%%M% %I% %E% SMI"
33 * Filesystem-independent directory information.
34 * Directory entry structures are of variable length.
35 * Each directory entry is a struct dirent containing its file number, the
36 * offset of the next entry (a cookie interpretable only the filesystem
37 * type that generated it), the length of the entry, and the length of the
38 * name contained in the entry. These are followed by the name. The
39 * entire entry is padded with null bytes to a 4 byte boundary. All names
40 * are guaranteed null terminated. The maximum length of a name in a
41 * directory is MAXNAMLEN, plus a null byte.
44 #ifndef __sys_dirent_h
45 #define __sys_dirent_h
47 struct dirent {
48 off_t d_off; /* offset of next disk dir entry */
49 unsigned long d_fileno; /* file number of entry */
50 unsigned short d_reclen; /* length of this record */
51 unsigned short d_namlen; /* length of string in d_name */
52 char d_name[255+1]; /* name (up to MAXNAMLEN + 1) */
55 #ifndef _POSIX_SOURCE
57 * It's unlikely to change, but make sure that sizeof d_name above is
58 * at least MAXNAMLEN + 1 (more may be added for padding).
60 #define MAXNAMLEN 255
62 * The macro DIRSIZ(dp) gives the minimum amount of space required to represent
63 * a directory entry. For any directory entry dp->d_reclen >= DIRSIZ(dp).
64 * Specific filesystem types may use this macro to construct the value
65 * for d_reclen.
67 #undef DIRSIZ
68 #define DIRSIZ(dp) \
69 (((sizeof(struct dirent) - (MAXNAMLEN+1) + ((dp)->d_namlen+1)) +3) & ~3)
71 #endif /* !_POSIX_SOURCE */
72 #endif /* !__sys_dirent_h */