1ecd6cf80Smarks /*
2ecd6cf80Smarks  * CDDL HEADER START
3ecd6cf80Smarks  *
4ecd6cf80Smarks  * The contents of this file are subject to the terms of the
5ecd6cf80Smarks  * Common Development and Distribution License (the "License").
6ecd6cf80Smarks  * You may not use this file except in compliance with the License.
7ecd6cf80Smarks  *
8ecd6cf80Smarks  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9ecd6cf80Smarks  * or http://www.opensolaris.org/os/licensing.
10ecd6cf80Smarks  * See the License for the specific language governing permissions
11ecd6cf80Smarks  * and limitations under the License.
12ecd6cf80Smarks  *
13ecd6cf80Smarks  * When distributing Covered Code, include this CDDL HEADER in each
14ecd6cf80Smarks  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15ecd6cf80Smarks  * If applicable, add the following below this CDDL HEADER, with the
16ecd6cf80Smarks  * fields enclosed by brackets "[]" replaced with your own identifying
17ecd6cf80Smarks  * information: Portions Copyright [yyyy] [name of copyright owner]
18ecd6cf80Smarks  *
19ecd6cf80Smarks  * CDDL HEADER END
20ecd6cf80Smarks  */
21ecd6cf80Smarks /*
22a7f53a56SChris Kirby  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
235cabbc6bSPrashanth Sreenivasa  * Copyright (c) 2013, 2015 by Delphix. All rights reserved.
24ecd6cf80Smarks  */
25ecd6cf80Smarks 
2691ebeef5Sahrens #ifndef	_SYS_DSL_DELEG_H
2791ebeef5Sahrens #define	_SYS_DSL_DELEG_H
28ecd6cf80Smarks 
29ecd6cf80Smarks #include <sys/dmu.h>
30ecd6cf80Smarks #include <sys/dsl_pool.h>
31ecd6cf80Smarks #include <sys/zfs_context.h>
32ecd6cf80Smarks 
33ecd6cf80Smarks #ifdef	__cplusplus
34ecd6cf80Smarks extern "C" {
35ecd6cf80Smarks #endif
36ecd6cf80Smarks 
37ecd6cf80Smarks #define	ZFS_DELEG_PERM_NONE		""
38ecd6cf80Smarks #define	ZFS_DELEG_PERM_CREATE		"create"
39ecd6cf80Smarks #define	ZFS_DELEG_PERM_DESTROY		"destroy"
40ecd6cf80Smarks #define	ZFS_DELEG_PERM_SNAPSHOT		"snapshot"
41ecd6cf80Smarks #define	ZFS_DELEG_PERM_ROLLBACK		"rollback"
42ecd6cf80Smarks #define	ZFS_DELEG_PERM_CLONE		"clone"
43ecd6cf80Smarks #define	ZFS_DELEG_PERM_PROMOTE		"promote"
44ecd6cf80Smarks #define	ZFS_DELEG_PERM_RENAME		"rename"
45ecd6cf80Smarks #define	ZFS_DELEG_PERM_MOUNT		"mount"
46ecd6cf80Smarks #define	ZFS_DELEG_PERM_SHARE		"share"
47ecd6cf80Smarks #define	ZFS_DELEG_PERM_SEND		"send"
48ecd6cf80Smarks #define	ZFS_DELEG_PERM_RECEIVE		"receive"
49ecd6cf80Smarks #define	ZFS_DELEG_PERM_ALLOW		"allow"
50ecd6cf80Smarks #define	ZFS_DELEG_PERM_USERPROP		"userprop"
51da6c28aaSamw #define	ZFS_DELEG_PERM_VSCAN		"vscan"
5214843421SMatthew Ahrens #define	ZFS_DELEG_PERM_USERQUOTA	"userquota"
5314843421SMatthew Ahrens #define	ZFS_DELEG_PERM_GROUPQUOTA	"groupquota"
54*f67950b2SNasf-Fan #define	ZFS_DELEG_PERM_USEROBJQUOTA	"userobjquota"
55*f67950b2SNasf-Fan #define	ZFS_DELEG_PERM_GROUPOBJQUOTA	"groupobjquota"
5614843421SMatthew Ahrens #define	ZFS_DELEG_PERM_USERUSED		"userused"
5714843421SMatthew Ahrens #define	ZFS_DELEG_PERM_GROUPUSED	"groupused"
58*f67950b2SNasf-Fan #define	ZFS_DELEG_PERM_USEROBJUSED	"userobjused"
59*f67950b2SNasf-Fan #define	ZFS_DELEG_PERM_GROUPOBJUSED	"groupobjused"
60842727c2SChris Kirby #define	ZFS_DELEG_PERM_HOLD		"hold"
61842727c2SChris Kirby #define	ZFS_DELEG_PERM_RELEASE		"release"
6299d5e173STim Haley #define	ZFS_DELEG_PERM_DIFF		"diff"
6378f17100SMatthew Ahrens #define	ZFS_DELEG_PERM_BOOKMARK		"bookmark"
645cabbc6bSPrashanth Sreenivasa #define	ZFS_DELEG_PERM_REMAP		"remap"
65eb633035STom Caputi #define	ZFS_DELEG_PERM_LOAD_KEY		"load-key"
66eb633035STom Caputi #define	ZFS_DELEG_PERM_CHANGE_KEY	"change-key"
67*f67950b2SNasf-Fan #define	ZFS_DELEG_PERM_PROJECTUSED	"projectused"
68*f67950b2SNasf-Fan #define	ZFS_DELEG_PERM_PROJECTQUOTA	"projectquota"
69*f67950b2SNasf-Fan #define	ZFS_DELEG_PERM_PROJECTOBJUSED	"projectobjused"
70*f67950b2SNasf-Fan #define	ZFS_DELEG_PERM_PROJECTOBJQUOTA	"projectobjquota"
7191ebeef5Sahrens 
7291ebeef5Sahrens /*
7391ebeef5Sahrens  * Note: the names of properties that are marked delegatable are also
7491ebeef5Sahrens  * valid delegated permissions
7591ebeef5Sahrens  */
76ecd6cf80Smarks 
77ecd6cf80Smarks int dsl_deleg_get(const char *ddname, nvlist_t **nvp);
78ecd6cf80Smarks int dsl_deleg_set(const char *ddname, nvlist_t *nvp, boolean_t unset);
79ecd6cf80Smarks int dsl_deleg_access(const char *ddname, const char *perm, cred_t *cr);
804445fffbSMatthew Ahrens int dsl_deleg_access_impl(struct dsl_dataset *ds, const char *perm, cred_t *cr);
81ecd6cf80Smarks void dsl_deleg_set_create_perms(dsl_dir_t *dd, dmu_tx_t *tx, cred_t *cr);
82ecd6cf80Smarks int dsl_deleg_can_allow(char *ddname, nvlist_t *nvp, cred_t *cr);
83ecd6cf80Smarks int dsl_deleg_can_unallow(char *ddname, nvlist_t *nvp, cred_t *cr);
84ecd6cf80Smarks int dsl_deleg_destroy(objset_t *os, uint64_t zapobj, dmu_tx_t *tx);
8591ebeef5Sahrens boolean_t dsl_delegation_on(objset_t *os);
86ecd6cf80Smarks 
87ecd6cf80Smarks #ifdef	__cplusplus
88ecd6cf80Smarks }
89ecd6cf80Smarks #endif
90ecd6cf80Smarks 
9191ebeef5Sahrens #endif	/* _SYS_DSL_DELEG_H */
92