6811333 Remove prom_printf() message in emlxs driver
[opensolaris.git] / usr / src / uts / common / sys / dirent.h
blob2999e2b886f2f87282ad088c2e0895d5571ce628
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
22 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23 /* All Rights Reserved */
27 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
28 * Use is subject to license terms.
31 #ifndef _SYS_DIRENT_H
32 #define _SYS_DIRENT_H
34 #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 11.11 */
36 #include <sys/feature_tests.h>
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
43 * File-system independent directory entry.
45 typedef struct dirent {
46 ino_t d_ino; /* "inode number" of entry */
47 off_t d_off; /* offset of disk directory entry */
48 unsigned short d_reclen; /* length of this record */
49 char d_name[1]; /* name of file */
50 } dirent_t;
52 #if defined(_SYSCALL32)
54 /* kernel's view of user ILP32 dirent */
56 typedef struct dirent32 {
57 ino32_t d_ino; /* "inode number" of entry */
58 off32_t d_off; /* offset of disk directory entry */
59 uint16_t d_reclen; /* length of this record */
60 char d_name[1]; /* name of file */
61 } dirent32_t;
63 #endif /* _SYSCALL32 */
65 #ifdef _LARGEFILE64_SOURCE
68 * transitional large file interface version AND kernel internal version
70 typedef struct dirent64 {
71 ino64_t d_ino; /* "inode number" of entry */
72 off64_t d_off; /* offset of disk directory entry */
73 unsigned short d_reclen; /* length of this record */
74 char d_name[1]; /* name of file */
75 } dirent64_t;
77 #endif /* _LARGEFILE64_SOURCE */
79 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
80 #if defined(_KERNEL)
81 #define DIRENT64_RECLEN(namelen) \
82 ((offsetof(dirent64_t, d_name[0]) + 1 + (namelen) + 7) & ~ 7)
83 #define DIRENT64_NAMELEN(reclen) \
84 ((reclen) - (offsetof(dirent64_t, d_name[0])))
85 #define DIRENT32_RECLEN(namelen) \
86 ((offsetof(dirent32_t, d_name[0]) + 1 + (namelen) + 3) & ~ 3)
87 #define DIRENT32_NAMELEN(reclen) \
88 ((reclen) - (offsetof(dirent32_t, d_name[0])))
89 #endif
91 #if !defined(_KERNEL)
94 * large file compilation environment setup
96 * In the LP64 compilation environment, map large file interfaces
97 * back to native versions where possible. (This only works because
98 * a 'struct dirent' == 'struct dirent64').
101 #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
102 #ifdef __PRAGMA_REDEFINE_EXTNAME
103 #pragma redefine_extname getdents getdents64
104 #else
105 #define getdents getdents64
106 #endif
107 #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */
109 #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
110 #ifdef __PRAGMA_REDEFINE_EXTNAME
111 #pragma redefine_extname getdents64 getdents
112 #else
113 #define getdents64 getdents
114 #define dirent64 dirent
115 #define dirent64_t dirent_t
116 #endif
117 #endif /* _LP64 && _LARGEFILE64_SOURCE */
119 #if defined(__STDC__)
120 extern int getdents(int, struct dirent *, size_t);
121 #else
122 extern int getdents();
123 #endif
125 /* N.B.: transitional large file interface version deliberately not provided */
127 #endif /* !defined(_KERNEL) */
128 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
130 #ifdef __cplusplus
132 #endif
134 #endif /* _SYS_DIRENT_H */