abolish ino32_t
[unleashed.git] / include / sys / dirent.h
blob4219b2b5f03d94d8220c5d03cac7cb33804ab7cb
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
21 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
22 /* All Rights Reserved */
26 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
28 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
29 * Use is subject to license terms.
32 #ifndef _SYS_DIRENT_H
33 #define _SYS_DIRENT_H
35 #include <sys/feature_tests.h>
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
42 * File-system independent directory entry.
44 typedef struct dirent {
45 ino_t d_ino; /* "inode number" of entry */
46 off_t d_off; /* offset of disk directory entry */
47 unsigned short d_reclen; /* length of this record */
48 char d_name[1]; /* name of file */
49 } dirent_t;
51 #if defined(_SYSCALL32)
53 /* kernel's view of user ILP32 dirent */
55 typedef struct dirent32 {
56 ino_t d_ino; /* "inode number" of entry */
57 off_t d_off; /* offset of disk directory entry */
58 uint16_t d_reclen; /* length of this record */
59 char d_name[1]; /* name of file */
60 } dirent32_t;
62 #endif /* _SYSCALL32 */
64 #ifdef _LARGEFILE64_SOURCE
67 * transitional large file interface version AND kernel internal version
69 typedef struct dirent64 {
70 ino64_t d_ino; /* "inode number" of entry */
71 off64_t d_off; /* offset of disk directory entry */
72 unsigned short d_reclen; /* length of this record */
73 char d_name[1]; /* name of file */
74 } dirent64_t;
76 #endif /* _LARGEFILE64_SOURCE */
78 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
79 #if defined(_KERNEL)
80 #define DIRENT64_RECLEN(namelen) \
81 ((offsetof(dirent64_t, d_name[0]) + 1 + (namelen) + 7) & ~ 7)
82 #define DIRENT64_NAMELEN(reclen) \
83 ((reclen) - (offsetof(dirent64_t, d_name[0])))
84 #define DIRENT32_RECLEN(namelen) \
85 ((offsetof(dirent32_t, d_name[0]) + 1 + (namelen) + 3) & ~ 3)
86 #define DIRENT32_NAMELEN(reclen) \
87 ((reclen) - (offsetof(dirent32_t, d_name[0])))
88 #endif
91 * This is the maximum number of bytes that getdents(2) will store in
92 * user-supplied dirent buffers.
94 #define MAXGETDENTS_SIZE (64 * 1024)
96 #if !defined(_KERNEL)
98 extern int getdents(int, struct dirent *, size_t);
100 /* N.B.: transitional large file interface version deliberately not provided */
102 #endif /* !defined(_KERNEL) */
103 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
105 #ifdef __cplusplus
107 #endif
109 #endif /* _SYS_DIRENT_H */