1 /*	$NetBSD: extdirent.h,v 1.1 2009/08/07 20:57:57 haad Exp $	*/
2 
3 /*
4  * CDDL HEADER START
5  *
6  * The contents of this file are subject to the terms of the
7  * Common Development and Distribution License (the "License").
8  * You may not use this file except in compliance with the License.
9  *
10  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11  * or http://www.opensolaris.org/os/licensing.
12  * See the License for the specific language governing permissions
13  * and limitations under the License.
14  *
15  * When distributing Covered Code, include this CDDL HEADER in each
16  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17  * If applicable, add the following below this CDDL HEADER, with the
18  * fields enclosed by brackets "[]" replaced with your own identifying
19  * information: Portions Copyright [yyyy] [name of copyright owner]
20  *
21  * CDDL HEADER END
22  */
23 /*
24  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  */
27 
28 #ifndef _SYS_EXTDIRENT_H
29 #define	_SYS_EXTDIRENT_H
30 
31 #pragma ident	"%Z%%M%	%I%	%E% SMI"
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 #include <sys/types.h>
38 
39 #if defined(_KERNEL)
40 
41 /*
42  * Extended file-system independent directory entry.  This style of
43  * dirent provides additional informational flag bits for each
44  * directory entry.  This dirent will be returned instead of the
45  * standard dirent if a VOP_READDIR() requests dirent flags via
46  * V_RDDIR_ENTFLAGS, and if the file system supports the flags.
47  */
48 typedef struct edirent {
49 	ino64_t		ed_ino;		/* "inode number" of entry */
50 	off64_t		ed_off;		/* offset of disk directory entry */
51 	uint32_t	ed_eflags;	/* per-entry flags */
52 	unsigned short	ed_reclen;	/* length of this record */
53 	char		ed_name[1];	/* name of file */
54 } edirent_t;
55 
56 #define	EDIRENT_RECLEN(namelen)	\
57 	((offsetof(edirent_t, ed_name[0]) + 1 + (namelen) + 7) & ~ 7)
58 #define	EDIRENT_NAMELEN(reclen)	\
59 	((reclen) - (offsetof(edirent_t, ed_name[0])))
60 
61 /*
62  * Extended entry flags
63  *	Extended entries include a bitfield of extra information
64  *	regarding that entry.
65  */
66 #define	ED_CASE_CONFLICT  0x10  /* Disconsidering case, entry is not unique */
67 
68 /*
69  * Extended flags accessor function
70  */
71 #define	ED_CASE_CONFLICTS(x)	((x)->ed_eflags & ED_CASE_CONFLICT)
72 
73 #endif /* defined(_KERNEL) */
74 
75 #ifdef	__cplusplus
76 }
77 #endif
78 
79 #endif	/* _SYS_EXTDIRENT_H */
80