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]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _SYS_FS_CACHEFS_DIR_H
28 #define _SYS_FS_CACHEFS_DIR_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <sys/types.h>
33 #include <sys/fs/cachefs_fs.h>
40 * c_dirent is stored on disk, so it needs to be the same 32-bit vs. 64-bit.
43 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
48 uint_t d_length
; /* entry length */
49 uint_t d_flag
; /* entry flags */
50 cfs_cid_t d_id
; /* file id */
51 offset_t d_offset
; /* disk offset of this entry */
52 cfs_fid_t d_cookie
; /* back fid */
53 ushort_t d_namelen
; /* name length, without null */
54 char d_name
[1]; /* name */
57 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
61 #define C_DIRSIZ(dp) \
62 (((dp)->d_namelen + (uint_t)sizeof (struct c_dirent) + 7) & ~7)
64 #define CDE_SIZE(NM) \
65 ((strlen(NM) + sizeof (struct c_dirent) + 7) & ~7)
68 * Various flags stored in c_dirent flag field.
70 #define CDE_VALID 0x1 /* entry is valid */
71 #define CDE_COMPLETE 0x2 /* entry is complete */
74 #if defined(_KERNEL) && defined(__STDC__)
75 int cachefs_dir_look(cnode_t
*dcp
, char *nm
, fid_t
*cookiep
, uint_t
*flagp
,
76 u_offset_t
*d_offsetp
, cfs_cid_t
*cidp
);
77 int cachefs_dir_new(cnode_t
*dcp
, cnode_t
*cp
);
78 int cachefs_dir_enter(cnode_t
*dcp
, char *nm
, fid_t
*cookiep
, cfs_cid_t
*cidp
,
80 int cachefs_dir_rmentry(cnode_t
*dcp
, char *nm
);
81 void cachefs_dir_modentry(cnode_t
*dcp
, u_offset_t offset
, fid_t
*cookiep
,
83 int cachefs_dir_read(struct cnode
*dcp
, struct uio
*uiop
, int *eofp
);
84 int cachefs_dir_fill(cnode_t
*dcp
, cred_t
*cr
);
85 int cachefs_dir_empty(cnode_t
*dcp
);
86 int cachefs_async_populate_dir(struct cachefs_populate_req
*, cred_t
*,
87 vnode_t
*, vnode_t
*);
89 #endif /* defined(_KERNEL) && defined(__STDC__) */
95 #endif /* _SYS_FS_CACHEFS_DIR_H */