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