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