1185029Spjd/*
2185029Spjd * CDDL HEADER START
3185029Spjd *
4185029Spjd * The contents of this file are subject to the terms of the
5185029Spjd * Common Development and Distribution License (the "License").
6185029Spjd * You may not use this file except in compliance with the License.
7185029Spjd *
8185029Spjd * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9185029Spjd * or http://www.opensolaris.org/os/licensing.
10185029Spjd * See the License for the specific language governing permissions
11185029Spjd * and limitations under the License.
12185029Spjd *
13185029Spjd * When distributing Covered Code, include this CDDL HEADER in each
14185029Spjd * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15185029Spjd * If applicable, add the following below this CDDL HEADER, with the
16185029Spjd * fields enclosed by brackets "[]" replaced with your own identifying
17185029Spjd * information: Portions Copyright [yyyy] [name of copyright owner]
18185029Spjd *
19185029Spjd * CDDL HEADER END
20185029Spjd */
21185029Spjd/*
22219089Spjd * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23332525Smav * Copyright (c) 2013, 2015 by Delphix. All rights reserved.
24185029Spjd */
25185029Spjd
26185029Spjd#ifndef	_SYS_DSL_DELEG_H
27185029Spjd#define	_SYS_DSL_DELEG_H
28185029Spjd
29185029Spjd#include <sys/dmu.h>
30185029Spjd#include <sys/dsl_pool.h>
31185029Spjd#include <sys/zfs_context.h>
32185029Spjd
33185029Spjd#ifdef	__cplusplus
34185029Spjdextern "C" {
35185029Spjd#endif
36185029Spjd
37185029Spjd#define	ZFS_DELEG_PERM_NONE		""
38185029Spjd#define	ZFS_DELEG_PERM_CREATE		"create"
39185029Spjd#define	ZFS_DELEG_PERM_DESTROY		"destroy"
40185029Spjd#define	ZFS_DELEG_PERM_SNAPSHOT		"snapshot"
41185029Spjd#define	ZFS_DELEG_PERM_ROLLBACK		"rollback"
42185029Spjd#define	ZFS_DELEG_PERM_CLONE		"clone"
43185029Spjd#define	ZFS_DELEG_PERM_PROMOTE		"promote"
44185029Spjd#define	ZFS_DELEG_PERM_RENAME		"rename"
45185029Spjd#define	ZFS_DELEG_PERM_MOUNT		"mount"
46185029Spjd#define	ZFS_DELEG_PERM_SHARE		"share"
47185029Spjd#define	ZFS_DELEG_PERM_SEND		"send"
48185029Spjd#define	ZFS_DELEG_PERM_RECEIVE		"receive"
49185029Spjd#define	ZFS_DELEG_PERM_ALLOW		"allow"
50185029Spjd#define	ZFS_DELEG_PERM_USERPROP		"userprop"
51185029Spjd#define	ZFS_DELEG_PERM_VSCAN		"vscan"
52209962Smm#define	ZFS_DELEG_PERM_USERQUOTA	"userquota"
53209962Smm#define	ZFS_DELEG_PERM_GROUPQUOTA	"groupquota"
54209962Smm#define	ZFS_DELEG_PERM_USERUSED		"userused"
55209962Smm#define	ZFS_DELEG_PERM_GROUPUSED	"groupused"
56219089Spjd#define	ZFS_DELEG_PERM_HOLD		"hold"
57219089Spjd#define	ZFS_DELEG_PERM_RELEASE		"release"
58219089Spjd#define	ZFS_DELEG_PERM_DIFF		"diff"
59260183Sdelphij#define	ZFS_DELEG_PERM_BOOKMARK		"bookmark"
60332525Smav#define	ZFS_DELEG_PERM_REMAP		"remap"
61185029Spjd
62185029Spjd/*
63185029Spjd * Note: the names of properties that are marked delegatable are also
64185029Spjd * valid delegated permissions
65185029Spjd */
66185029Spjd
67185029Spjdint dsl_deleg_get(const char *ddname, nvlist_t **nvp);
68185029Spjdint dsl_deleg_set(const char *ddname, nvlist_t *nvp, boolean_t unset);
69185029Spjdint dsl_deleg_access(const char *ddname, const char *perm, cred_t *cr);
70248571Smmint dsl_deleg_access_impl(struct dsl_dataset *ds, const char *perm, cred_t *cr);
71185029Spjdvoid dsl_deleg_set_create_perms(dsl_dir_t *dd, dmu_tx_t *tx, cred_t *cr);
72185029Spjdint dsl_deleg_can_allow(char *ddname, nvlist_t *nvp, cred_t *cr);
73185029Spjdint dsl_deleg_can_unallow(char *ddname, nvlist_t *nvp, cred_t *cr);
74185029Spjdint dsl_deleg_destroy(objset_t *os, uint64_t zapobj, dmu_tx_t *tx);
75185029Spjdboolean_t dsl_delegation_on(objset_t *os);
76185029Spjd
77185029Spjd#ifdef	__cplusplus
78185029Spjd}
79185029Spjd#endif
80185029Spjd
81185029Spjd#endif	/* _SYS_DSL_DELEG_H */
82