xref: /onnv-gate/usr/src/uts/common/fs/zfs/sys/zfs_dir.h (revision 11935:538c866aaac6)
1789Sahrens /*
2789Sahrens  * CDDL HEADER START
3789Sahrens  *
4789Sahrens  * The contents of this file are subject to the terms of the
53280Sck153898  * Common Development and Distribution License (the "License").
63280Sck153898  * You may not use this file except in compliance with the License.
7789Sahrens  *
8789Sahrens  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9789Sahrens  * or http://www.opensolaris.org/os/licensing.
10789Sahrens  * See the License for the specific language governing permissions
11789Sahrens  * and limitations under the License.
12789Sahrens  *
13789Sahrens  * When distributing Covered Code, include this CDDL HEADER in each
14789Sahrens  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15789Sahrens  * If applicable, add the following below this CDDL HEADER, with the
16789Sahrens  * fields enclosed by brackets "[]" replaced with your own identifying
17789Sahrens  * information: Portions Copyright [yyyy] [name of copyright owner]
18789Sahrens  *
19789Sahrens  * CDDL HEADER END
20789Sahrens  */
21789Sahrens /*
22*11935SMark.Shellenbaum@Sun.COM  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
23789Sahrens  * Use is subject to license terms.
24789Sahrens  */
25789Sahrens 
26789Sahrens #ifndef	_SYS_FS_ZFS_DIR_H
27789Sahrens #define	_SYS_FS_ZFS_DIR_H
28789Sahrens 
295331Samw #include <sys/pathname.h>
30789Sahrens #include <sys/dmu.h>
31789Sahrens #include <sys/zfs_znode.h>
32789Sahrens 
33789Sahrens #ifdef	__cplusplus
34789Sahrens extern "C" {
35789Sahrens #endif
36789Sahrens 
37789Sahrens /* zfs_dirent_lock() flags */
38789Sahrens #define	ZNEW		0x0001		/* entry should not exist */
39789Sahrens #define	ZEXISTS		0x0002		/* entry should exist */
40789Sahrens #define	ZSHARED		0x0004		/* shared access (zfs_dirlook()) */
41789Sahrens #define	ZXATTR		0x0008		/* we want the xattr dir */
42789Sahrens #define	ZRENAMING	0x0010		/* znode is being renamed */
435331Samw #define	ZCILOOK		0x0020		/* case-insensitive lookup requested */
445331Samw #define	ZCIEXACT	0x0040		/* c-i requires c-s match (rename) */
4511321SSanjeev.Bagewadi@Sun.COM #define	ZHAVELOCK	0x0080		/* z_name_lock is already held */
46789Sahrens 
47789Sahrens /* mknode flags */
48789Sahrens #define	IS_ROOT_NODE	0x01		/* create a root node */
49789Sahrens #define	IS_XATTR	0x02		/* create an extended attribute node */
50789Sahrens 
51789Sahrens extern int zfs_dirent_lock(zfs_dirlock_t **, znode_t *, char *, znode_t **,
525331Samw     int, int *, pathname_t *);
53789Sahrens extern void zfs_dirent_unlock(zfs_dirlock_t *);
54789Sahrens extern int zfs_link_create(zfs_dirlock_t *, znode_t *, dmu_tx_t *, int);
553461Sahrens extern int zfs_link_destroy(zfs_dirlock_t *, znode_t *, dmu_tx_t *, int,
563461Sahrens     boolean_t *);
575331Samw extern int zfs_dirlook(znode_t *, char *, vnode_t **, int, int *,
585331Samw     pathname_t *);
595446Sahrens extern void zfs_mknode(znode_t *, vattr_t *, dmu_tx_t *, cred_t *,
60*11935SMark.Shellenbaum@Sun.COM     uint_t, znode_t **, zfs_acl_ids_t *);
61789Sahrens extern void zfs_rmnode(znode_t *);
625331Samw extern void zfs_dl_name_switch(zfs_dirlock_t *dl, char *new, char **old);
63789Sahrens extern boolean_t zfs_dirempty(znode_t *);
643461Sahrens extern void zfs_unlinked_add(znode_t *, dmu_tx_t *);
653461Sahrens extern void zfs_unlinked_drain(zfsvfs_t *zfsvfs);
66789Sahrens extern int zfs_sticky_remove_access(znode_t *, znode_t *, cred_t *cr);
673280Sck153898 extern int zfs_get_xattrdir(znode_t *, vnode_t **, cred_t *, int);
68789Sahrens extern int zfs_make_xattrdir(znode_t *, vattr_t *, vnode_t **, cred_t *);
69789Sahrens 
70789Sahrens #ifdef	__cplusplus
71789Sahrens }
72789Sahrens #endif
73789Sahrens 
74789Sahrens #endif	/* _SYS_FS_ZFS_DIR_H */
75