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
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]
22 #pragma ident "%Z%%M% %I% %E% SMI"
25 * Filesystem-independent directory information.
26 * Directory entry structures are of variable length.
27 * Each directory entry is a struct direct containing its file number, the
28 * offset of the next entry (a cookie interpretable only the filesystem
29 * type that generated it), the length of the entry, and the length of the
30 * name contained in the entry. These are followed by the name. The
31 * entire entry is padded with null bytes to a 4 byte boundary. All names
32 * are guaranteed null terminated. The maximum length of a name in a
33 * directory is MAXNAMLEN, plus a null byte.
34 * Note: this file is present only for backwards compatibility. It is superseded
35 * by the files /usr/include/dirent.h and /usr/include/sys/dirent.h. It will
36 * disappear in a future major release.
45 off_t d_off
; /* offset of next disk directory entry */
46 u_long d_fileno
; /* file number of entry */
47 u_short d_reclen
; /* length of this record */
48 u_short d_namlen
; /* length of string in d_name */
49 char d_name
[MAXNAMLEN
+ 1]; /* name (up to MAXNAMLEN + 1) */
53 * The macro DIRSIZ(dp) gives the minimum amount of space required to represent
54 * a directory entry. For any directory entry dp->d_reclen >= DIRSIZ(dp).
55 * Specific filesystem typesm may use this macro to construct the value
60 (((sizeof (struct direct) - (MAXNAMLEN+1) + ((dp)->d_namlen+1)) + 3) & ~3)
63 #define d_ino d_fileno /* compatability */
67 * Definitions for library routines operating on directories.
70 typedef struct _dirdesc
{
71 int dd_fd
; /* file descriptor */
72 long dd_loc
; /* buf offset of entry from last readddir() */
73 long dd_size
; /* amount of valid data in buffer */
74 long dd_bsize
; /* amount of entries read at a time */
75 long dd_off
; /* Current offset in dir (for telldir) */
76 char *dd_buf
; /* directory data buffer */
82 extern DIR *opendir();
83 extern struct direct
*readdir();
84 extern long telldir();
85 extern void seekdir();
86 #define rewinddir(dirp) seekdir((dirp), (long)0)
87 extern int closedir();
90 #endif /*!_sys_dir_h*/