xref: /onnv-gate/usr/src/uts/common/fs/zfs/sys/zfs_ctldir.h (revision 12079:13822b941977)
1789Sahrens /*
2789Sahrens  * CDDL HEADER START
3789Sahrens  *
4789Sahrens  * The contents of this file are subject to the terms of the
54543Smarks  * Common Development and Distribution License (the "License").
64543Smarks  * 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*12079SMark.Shellenbaum@Sun.COM  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23789Sahrens  */
24789Sahrens 
25789Sahrens #ifndef	_ZFS_CTLDIR_H
26789Sahrens #define	_ZFS_CTLDIR_H
27789Sahrens 
28789Sahrens #include <sys/pathname.h>
29789Sahrens #include <sys/vnode.h>
30789Sahrens #include <sys/zfs_vfsops.h>
31789Sahrens #include <sys/zfs_znode.h>
32789Sahrens 
33789Sahrens #ifdef	__cplusplus
34789Sahrens extern "C" {
35789Sahrens #endif
36789Sahrens 
37789Sahrens #define	ZFS_CTLDIR_NAME		".zfs"
38789Sahrens 
39789Sahrens #define	zfs_has_ctldir(zdp)	\
40789Sahrens 	((zdp)->z_id == (zdp)->z_zfsvfs->z_root && \
41789Sahrens 	((zdp)->z_zfsvfs->z_ctldir != NULL))
42789Sahrens #define	zfs_show_ctldir(zdp)	\
43789Sahrens 	(zfs_has_ctldir(zdp) && \
44789Sahrens 	((zdp)->z_zfsvfs->z_show_ctldir))
45789Sahrens 
46789Sahrens void zfsctl_create(zfsvfs_t *);
47789Sahrens void zfsctl_destroy(zfsvfs_t *);
48789Sahrens vnode_t *zfsctl_root(znode_t *);
49789Sahrens void zfsctl_init(void);
50789Sahrens void zfsctl_fini(void);
51*12079SMark.Shellenbaum@Sun.COM boolean_t zfsctl_is_node(vnode_t *);
52789Sahrens 
53789Sahrens int zfsctl_rename_snapshot(const char *from, const char *to);
54789Sahrens int zfsctl_destroy_snapshot(const char *snapname, int force);
55789Sahrens int zfsctl_umount_snapshots(vfs_t *, int, cred_t *);
56789Sahrens 
57789Sahrens int zfsctl_root_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, pathname_t *pnp,
585331Samw     int flags, vnode_t *rdir, cred_t *cr, caller_context_t *ct,
595331Samw     int *direntflags, pathname_t *realpnp);
60789Sahrens 
61789Sahrens int zfsctl_make_fid(zfsvfs_t *zfsvfsp, uint64_t object, uint32_t gen,
62789Sahrens     fid_t *fidp);
63789Sahrens int zfsctl_lookup_objset(vfs_t *vfsp, uint64_t objsetid, zfsvfs_t **zfsvfsp);
64789Sahrens 
65789Sahrens #define	ZFSCTL_INO_ROOT		0x1
66789Sahrens #define	ZFSCTL_INO_SNAPDIR	0x2
678845Samw@Sun.COM #define	ZFSCTL_INO_SHARES	0x3
68789Sahrens 
69789Sahrens #ifdef	__cplusplus
70789Sahrens }
71789Sahrens #endif
72789Sahrens 
73789Sahrens #endif	/* _ZFS_CTLDIR_H */
74