xref: /illumos-gate/usr/src/uts/common/fs/zfs/sys/dsl_deleg.h (revision b77b9231da168bb31490f65bf2697f6031b7f601)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 #ifndef	_SYS_DSL_DELEG_H
26 #define	_SYS_DSL_DELEG_H
27 
28 #include <sys/dmu.h>
29 #include <sys/dsl_pool.h>
30 #include <sys/zfs_context.h>
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #define	ZFS_DELEG_PERM_NONE		""
37 #define	ZFS_DELEG_PERM_CREATE		"create"
38 #define	ZFS_DELEG_PERM_DESTROY		"destroy"
39 #define	ZFS_DELEG_PERM_SNAPSHOT		"snapshot"
40 #define	ZFS_DELEG_PERM_ROLLBACK		"rollback"
41 #define	ZFS_DELEG_PERM_CLONE		"clone"
42 #define	ZFS_DELEG_PERM_PROMOTE		"promote"
43 #define	ZFS_DELEG_PERM_RENAME		"rename"
44 #define	ZFS_DELEG_PERM_MOUNT		"mount"
45 #define	ZFS_DELEG_PERM_SHARE		"share"
46 #define	ZFS_DELEG_PERM_SEND		"send"
47 #define	ZFS_DELEG_PERM_RECEIVE		"receive"
48 #define	ZFS_DELEG_PERM_ALLOW		"allow"
49 #define	ZFS_DELEG_PERM_USERPROP		"userprop"
50 #define	ZFS_DELEG_PERM_VSCAN		"vscan"
51 #define	ZFS_DELEG_PERM_USERQUOTA	"userquota"
52 #define	ZFS_DELEG_PERM_GROUPQUOTA	"groupquota"
53 #define	ZFS_DELEG_PERM_USERUSED		"userused"
54 #define	ZFS_DELEG_PERM_GROUPUSED	"groupused"
55 #define	ZFS_DELEG_PERM_HOLD		"hold"
56 #define	ZFS_DELEG_PERM_RELEASE		"release"
57 #define	ZFS_DELEG_PERM_DIFF		"diff"
58 
59 /*
60  * Note: the names of properties that are marked delegatable are also
61  * valid delegated permissions
62  */
63 
64 int dsl_deleg_get(const char *ddname, nvlist_t **nvp);
65 int dsl_deleg_set(const char *ddname, nvlist_t *nvp, boolean_t unset);
66 int dsl_deleg_access(const char *ddname, const char *perm, cred_t *cr);
67 int dsl_deleg_access_impl(struct dsl_dataset *ds, const char *perm, cred_t *cr);
68 void dsl_deleg_set_create_perms(dsl_dir_t *dd, dmu_tx_t *tx, cred_t *cr);
69 int dsl_deleg_can_allow(char *ddname, nvlist_t *nvp, cred_t *cr);
70 int dsl_deleg_can_unallow(char *ddname, nvlist_t *nvp, cred_t *cr);
71 int dsl_deleg_destroy(objset_t *os, uint64_t zapobj, dmu_tx_t *tx);
72 boolean_t dsl_delegation_on(objset_t *os);
73 
74 #ifdef	__cplusplus
75 }
76 #endif
77 
78 #endif	/* _SYS_DSL_DELEG_H */
79