1*61145dc2SMartin Matuska // SPDX-License-Identifier: CDDL-1.0 2eda14cbcSMatt Macy /* 3eda14cbcSMatt Macy * CDDL HEADER START 4eda14cbcSMatt Macy * 5eda14cbcSMatt Macy * The contents of this file are subject to the terms of the 6eda14cbcSMatt Macy * Common Development and Distribution License (the "License"). 7eda14cbcSMatt Macy * You may not use this file except in compliance with the License. 8eda14cbcSMatt Macy * 9eda14cbcSMatt Macy * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10271171e0SMartin Matuska * or https://opensource.org/licenses/CDDL-1.0. 11eda14cbcSMatt Macy * See the License for the specific language governing permissions 12eda14cbcSMatt Macy * and limitations under the License. 13eda14cbcSMatt Macy * 14eda14cbcSMatt Macy * When distributing Covered Code, include this CDDL HEADER in each 15eda14cbcSMatt Macy * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16eda14cbcSMatt Macy * If applicable, add the following below this CDDL HEADER, with the 17eda14cbcSMatt Macy * fields enclosed by brackets "[]" replaced with your own identifying 18eda14cbcSMatt Macy * information: Portions Copyright [yyyy] [name of copyright owner] 19eda14cbcSMatt Macy * 20eda14cbcSMatt Macy * CDDL HEADER END 21eda14cbcSMatt Macy */ 22eda14cbcSMatt Macy /* 23eda14cbcSMatt Macy * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 24eda14cbcSMatt Macy * Copyright 2010 Nexenta Systems, Inc. All rights reserved. 25eda14cbcSMatt Macy * Copyright (c) 2013, 2015 by Delphix. All rights reserved. 26eda14cbcSMatt Macy */ 27eda14cbcSMatt Macy 28eda14cbcSMatt Macy #ifndef _ZFS_DELEG_H 2916038816SMartin Matuska #define _ZFS_DELEG_H extern __attribute__((visibility("default"))) 30eda14cbcSMatt Macy 31eda14cbcSMatt Macy #include <sys/fs/zfs.h> 32eda14cbcSMatt Macy 33eda14cbcSMatt Macy #ifdef __cplusplus 34eda14cbcSMatt Macy extern "C" { 35eda14cbcSMatt Macy #endif 36eda14cbcSMatt Macy 37eda14cbcSMatt Macy #define ZFS_DELEG_SET_NAME_CHR '@' /* set name lead char */ 38eda14cbcSMatt Macy #define ZFS_DELEG_FIELD_SEP_CHR '$' /* field separator */ 39eda14cbcSMatt Macy 40eda14cbcSMatt Macy /* 41eda14cbcSMatt Macy * Max name length for a delegation attribute 42eda14cbcSMatt Macy */ 43eda14cbcSMatt Macy #define ZFS_MAX_DELEG_NAME 128 44eda14cbcSMatt Macy 45eda14cbcSMatt Macy #define ZFS_DELEG_LOCAL 'l' 46eda14cbcSMatt Macy #define ZFS_DELEG_DESCENDENT 'd' 47eda14cbcSMatt Macy #define ZFS_DELEG_NA '-' 48eda14cbcSMatt Macy 49eda14cbcSMatt Macy typedef enum { 50eda14cbcSMatt Macy ZFS_DELEG_NOTE_CREATE, 51eda14cbcSMatt Macy ZFS_DELEG_NOTE_DESTROY, 52eda14cbcSMatt Macy ZFS_DELEG_NOTE_SNAPSHOT, 53eda14cbcSMatt Macy ZFS_DELEG_NOTE_ROLLBACK, 54eda14cbcSMatt Macy ZFS_DELEG_NOTE_CLONE, 55eda14cbcSMatt Macy ZFS_DELEG_NOTE_PROMOTE, 56eda14cbcSMatt Macy ZFS_DELEG_NOTE_RENAME, 57eda14cbcSMatt Macy ZFS_DELEG_NOTE_SEND, 58eda14cbcSMatt Macy ZFS_DELEG_NOTE_RECEIVE, 59eda14cbcSMatt Macy ZFS_DELEG_NOTE_ALLOW, 60eda14cbcSMatt Macy ZFS_DELEG_NOTE_USERPROP, 61eda14cbcSMatt Macy ZFS_DELEG_NOTE_MOUNT, 62eda14cbcSMatt Macy ZFS_DELEG_NOTE_SHARE, 63eda14cbcSMatt Macy ZFS_DELEG_NOTE_USERQUOTA, 64eda14cbcSMatt Macy ZFS_DELEG_NOTE_GROUPQUOTA, 65eda14cbcSMatt Macy ZFS_DELEG_NOTE_USERUSED, 66eda14cbcSMatt Macy ZFS_DELEG_NOTE_GROUPUSED, 67eda14cbcSMatt Macy ZFS_DELEG_NOTE_USEROBJQUOTA, 68eda14cbcSMatt Macy ZFS_DELEG_NOTE_GROUPOBJQUOTA, 69eda14cbcSMatt Macy ZFS_DELEG_NOTE_USEROBJUSED, 70eda14cbcSMatt Macy ZFS_DELEG_NOTE_GROUPOBJUSED, 71eda14cbcSMatt Macy ZFS_DELEG_NOTE_HOLD, 72eda14cbcSMatt Macy ZFS_DELEG_NOTE_RELEASE, 73eda14cbcSMatt Macy ZFS_DELEG_NOTE_DIFF, 74eda14cbcSMatt Macy ZFS_DELEG_NOTE_BOOKMARK, 75eda14cbcSMatt Macy ZFS_DELEG_NOTE_LOAD_KEY, 76eda14cbcSMatt Macy ZFS_DELEG_NOTE_CHANGE_KEY, 77eda14cbcSMatt Macy ZFS_DELEG_NOTE_PROJECTUSED, 78eda14cbcSMatt Macy ZFS_DELEG_NOTE_PROJECTQUOTA, 79eda14cbcSMatt Macy ZFS_DELEG_NOTE_PROJECTOBJUSED, 80eda14cbcSMatt Macy ZFS_DELEG_NOTE_PROJECTOBJQUOTA, 81eda14cbcSMatt Macy ZFS_DELEG_NOTE_NONE 82eda14cbcSMatt Macy } zfs_deleg_note_t; 83eda14cbcSMatt Macy 84eda14cbcSMatt Macy typedef struct zfs_deleg_perm_tab { 85a0b956f5SMartin Matuska const char *z_perm; 86eda14cbcSMatt Macy zfs_deleg_note_t z_note; 87eda14cbcSMatt Macy } zfs_deleg_perm_tab_t; 88eda14cbcSMatt Macy 89e92ffd9bSMartin Matuska _ZFS_DELEG_H const zfs_deleg_perm_tab_t zfs_deleg_perm_tab[]; 90eda14cbcSMatt Macy 9116038816SMartin Matuska _ZFS_DELEG_H int zfs_deleg_verify_nvlist(nvlist_t *nvlist); 9216038816SMartin Matuska _ZFS_DELEG_H void zfs_deleg_whokey(char *attr, zfs_deleg_who_type_t type, 93eda14cbcSMatt Macy char checkflag, void *data); 9416038816SMartin Matuska _ZFS_DELEG_H const char *zfs_deleg_canonicalize_perm(const char *perm); 95eda14cbcSMatt Macy 96eda14cbcSMatt Macy #ifdef __cplusplus 97eda14cbcSMatt Macy } 98eda14cbcSMatt Macy #endif 99eda14cbcSMatt Macy 100eda14cbcSMatt Macy #endif /* _ZFS_DELEG_H */ 101