zfs_dir.h revision 304671
176195Sbrian/*
276195Sbrian * CDDL HEADER START
378412Sbrian *
478412Sbrian * The contents of this file are subject to the terms of the
578412Sbrian * Common Development and Distribution License (the "License").
676195Sbrian * You may not use this file except in compliance with the License.
776195Sbrian *
876195Sbrian * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
976195Sbrian * or http://www.opensolaris.org/os/licensing.
1076195Sbrian * See the License for the specific language governing permissions
1176195Sbrian * and limitations under the License.
1276195Sbrian *
1376195Sbrian * When distributing Covered Code, include this CDDL HEADER in each
1476195Sbrian * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1576195Sbrian * If applicable, add the following below this CDDL HEADER, with the
1676195Sbrian * fields enclosed by brackets "[]" replaced with your own identifying
1776195Sbrian * information: Portions Copyright [yyyy] [name of copyright owner]
1876195Sbrian *
1976195Sbrian * CDDL HEADER END
2076195Sbrian */
2176195Sbrian/*
2276195Sbrian * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
2376195Sbrian * Use is subject to license terms.
2476195Sbrian */
2576195Sbrian
2676195Sbrian#ifndef	_SYS_FS_ZFS_DIR_H
2776195Sbrian#define	_SYS_FS_ZFS_DIR_H
2876195Sbrian
2976195Sbrian#include <sys/pathname.h>
3076195Sbrian#include <sys/dmu.h>
3176195Sbrian#include <sys/zfs_znode.h>
3276195Sbrian
3376195Sbrian#ifdef	__cplusplus
3476195Sbrianextern "C" {
3576705Sbrian#endif
3676195Sbrian
3776195Sbrian/* zfs_dirent_lock() flags */
3876195Sbrian#define	ZNEW		0x0001		/* entry should not exist */
3976195Sbrian#define	ZEXISTS		0x0002		/* entry should exist */
4076195Sbrian#define	ZSHARED		0x0004		/* shared access (zfs_dirlook()) */
4176195Sbrian#define	ZXATTR		0x0008		/* we want the xattr dir */
4276195Sbrian#define	ZRENAMING	0x0010		/* znode is being renamed */
4376705Sbrian#define	ZCILOOK		0x0020		/* case-insensitive lookup requested */
4476195Sbrian#define	ZCIEXACT	0x0040		/* c-i requires c-s match (rename) */
4576195Sbrian#define	ZHAVELOCK	0x0080		/* z_name_lock is already held */
4676195Sbrian
4776195Sbrian/* mknode flags */
4876195Sbrian#define	IS_ROOT_NODE	0x01		/* create a root node */
4976195Sbrian#define	IS_XATTR	0x02		/* create an extended attribute node */
5076195Sbrian
5176195Sbrianextern int zfs_dirent_lookup(znode_t *, const char *, znode_t **, int);
5276195Sbrianextern int zfs_link_create(znode_t *, const char *, znode_t *, dmu_tx_t *, int);
5376195Sbrianextern int zfs_link_destroy(znode_t *, const char *, znode_t *, dmu_tx_t *, int,
5476195Sbrian    boolean_t *);
5576195Sbrian#if 0
5676195Sbrianextern int zfs_dirlook(vnode_t *, const char *, vnode_t **, int);
5776195Sbrian#else
5876195Sbrianextern int zfs_dirlook(znode_t *, const char *name, znode_t **);
5976195Sbrian#endif
6078495Sbrianextern void zfs_mknode(znode_t *, vattr_t *, dmu_tx_t *, cred_t *,
6178495Sbrian    uint_t, znode_t **, zfs_acl_ids_t *);
62162711Sruextern void zfs_rmnode(znode_t *);
6378495Sbrianextern boolean_t zfs_dirempty(znode_t *);
6478495Sbrianextern void zfs_unlinked_add(znode_t *, dmu_tx_t *);
6578495Sbrianextern void zfs_unlinked_drain(zfsvfs_t *zfsvfs);
6678495Sbrianextern int zfs_sticky_remove_access(znode_t *, znode_t *, cred_t *cr);
67extern int zfs_get_xattrdir(znode_t *, vnode_t **, cred_t *, int);
68extern int zfs_make_xattrdir(znode_t *, vattr_t *, vnode_t **, cred_t *);
69
70#ifdef	__cplusplus
71}
72#endif
73
74#endif	/* _SYS_FS_ZFS_DIR_H */
75