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