xref: /illumos-gate/usr/src/uts/common/fs/zfs/sys/zfs_dir.h (revision 88f8b78a88cbdc6d8c1af5c3e54bc49d25095c98)
1 /*
2  * CDDL HEADER START
3  *
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
7  * with the License.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_FS_ZFS_DIR_H
28 #define	_SYS_FS_ZFS_DIR_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/dmu.h>
33 #include <sys/zfs_znode.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 /* zfs_dirent_lock() flags */
40 #define	ZNEW		0x0001		/* entry should not exist */
41 #define	ZEXISTS		0x0002		/* entry should exist */
42 #define	ZSHARED		0x0004		/* shared access (zfs_dirlook()) */
43 #define	ZXATTR		0x0008		/* we want the xattr dir */
44 #define	ZRENAMING	0x0010		/* znode is being renamed */
45 
46 /* mknode flags */
47 #define	IS_ROOT_NODE	0x01		/* create a root node */
48 #define	IS_XATTR	0x02		/* create an extended attribute node */
49 #define	IS_REPLAY	0x04		/* we are replaying intent log */
50 
51 extern int zfs_dirent_lock(zfs_dirlock_t **, znode_t *, char *, znode_t **,
52     int);
53 extern void zfs_dirent_unlock(zfs_dirlock_t *);
54 extern int zfs_link_create(zfs_dirlock_t *, znode_t *, dmu_tx_t *, int);
55 extern int zfs_link_destroy(zfs_dirlock_t *, znode_t *, dmu_tx_t *, int, int *);
56 extern int zfs_dirlook(znode_t *, char *, vnode_t **);
57 extern void zfs_mknode(znode_t *, vattr_t *, uint64_t *,
58     dmu_tx_t *, cred_t *, uint_t, znode_t **, int);
59 extern void zfs_rmnode(znode_t *);
60 extern boolean_t zfs_dirempty(znode_t *);
61 extern void zfs_dq_add(znode_t *, dmu_tx_t *);
62 extern int zfs_sticky_remove_access(znode_t *, znode_t *, cred_t *cr);
63 extern int zfs_get_xattrdir(znode_t *, vnode_t **, cred_t *);
64 extern int zfs_make_xattrdir(znode_t *, vattr_t *, vnode_t **, cred_t *);
65 
66 #ifdef	__cplusplus
67 }
68 #endif
69 
70 #endif	/* _SYS_FS_ZFS_DIR_H */
71