xref: /illumos-gate/usr/src/common/zfs/zfs_deleg.h (revision f67950b21e185934ccabe311516f4dcbdb00ef79)
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 /*
2299d5e173STim Haley  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
231af68beaSAlexander Stetsenko  * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
245cabbc6bSPrashanth Sreenivasa  * Copyright (c) 2013, 2015 by Delphix. All rights reserved.
25ecd6cf80Smarks  */
26ecd6cf80Smarks 
27ecd6cf80Smarks #ifndef	_ZFS_DELEG_H
28ecd6cf80Smarks #define	_ZFS_DELEG_H
29ecd6cf80Smarks 
30ecd6cf80Smarks #include <sys/fs/zfs.h>
31ecd6cf80Smarks 
32ecd6cf80Smarks #ifdef	__cplusplus
33ecd6cf80Smarks extern "C" {
34ecd6cf80Smarks #endif
35ecd6cf80Smarks 
36ecd6cf80Smarks #define	ZFS_DELEG_SET_NAME_CHR		'@'		/* set name lead char */
37ecd6cf80Smarks #define	ZFS_DELEG_FIELD_SEP_CHR		'$'		/* field separator */
38ecd6cf80Smarks 
39ecd6cf80Smarks /*
40ecd6cf80Smarks  * Max name length for a delegation attribute
41ecd6cf80Smarks  */
42ecd6cf80Smarks #define	ZFS_MAX_DELEG_NAME	128
43ecd6cf80Smarks 
44ecd6cf80Smarks #define	ZFS_DELEG_LOCAL		'l'
45ecd6cf80Smarks #define	ZFS_DELEG_DESCENDENT	'd'
46ecd6cf80Smarks #define	ZFS_DELEG_NA		'-'
47ecd6cf80Smarks 
486949a980Smarks typedef enum {
496949a980Smarks 	ZFS_DELEG_NOTE_CREATE,
506949a980Smarks 	ZFS_DELEG_NOTE_DESTROY,
516949a980Smarks 	ZFS_DELEG_NOTE_SNAPSHOT,
526949a980Smarks 	ZFS_DELEG_NOTE_ROLLBACK,
536949a980Smarks 	ZFS_DELEG_NOTE_CLONE,
546949a980Smarks 	ZFS_DELEG_NOTE_PROMOTE,
556949a980Smarks 	ZFS_DELEG_NOTE_RENAME,
561af68beaSAlexander Stetsenko 	ZFS_DELEG_NOTE_SEND,
576949a980Smarks 	ZFS_DELEG_NOTE_RECEIVE,
586949a980Smarks 	ZFS_DELEG_NOTE_ALLOW,
596949a980Smarks 	ZFS_DELEG_NOTE_USERPROP,
606949a980Smarks 	ZFS_DELEG_NOTE_MOUNT,
616949a980Smarks 	ZFS_DELEG_NOTE_SHARE,
6214843421SMatthew Ahrens 	ZFS_DELEG_NOTE_USERQUOTA,
6314843421SMatthew Ahrens 	ZFS_DELEG_NOTE_GROUPQUOTA,
6414843421SMatthew Ahrens 	ZFS_DELEG_NOTE_USERUSED,
6514843421SMatthew Ahrens 	ZFS_DELEG_NOTE_GROUPUSED,
66*f67950b2SNasf-Fan 	ZFS_DELEG_NOTE_USEROBJQUOTA,
67*f67950b2SNasf-Fan 	ZFS_DELEG_NOTE_GROUPOBJQUOTA,
68*f67950b2SNasf-Fan 	ZFS_DELEG_NOTE_USEROBJUSED,
69*f67950b2SNasf-Fan 	ZFS_DELEG_NOTE_GROUPOBJUSED,
70842727c2SChris Kirby 	ZFS_DELEG_NOTE_HOLD,
71842727c2SChris Kirby 	ZFS_DELEG_NOTE_RELEASE,
7299d5e173STim Haley 	ZFS_DELEG_NOTE_DIFF,
7378f17100SMatthew Ahrens 	ZFS_DELEG_NOTE_BOOKMARK,
745cabbc6bSPrashanth Sreenivasa 	ZFS_DELEG_NOTE_REMAP,
75eb633035STom Caputi 	ZFS_DELEG_NOTE_LOAD_KEY,
76eb633035STom Caputi 	ZFS_DELEG_NOTE_CHANGE_KEY,
77*f67950b2SNasf-Fan 	ZFS_DELEG_NOTE_PROJECTUSED,
78*f67950b2SNasf-Fan 	ZFS_DELEG_NOTE_PROJECTQUOTA,
79*f67950b2SNasf-Fan 	ZFS_DELEG_NOTE_PROJECTOBJUSED,
80*f67950b2SNasf-Fan 	ZFS_DELEG_NOTE_PROJECTOBJQUOTA,
816949a980Smarks 	ZFS_DELEG_NOTE_NONE
826949a980Smarks } zfs_deleg_note_t;
836949a980Smarks 
846949a980Smarks typedef struct zfs_deleg_perm_tab {
856949a980Smarks 	char *z_perm;
866949a980Smarks 	zfs_deleg_note_t z_note;
876949a980Smarks } zfs_deleg_perm_tab_t;
886949a980Smarks 
896949a980Smarks extern zfs_deleg_perm_tab_t zfs_deleg_perm_tab[];
90ecd6cf80Smarks 
91ecd6cf80Smarks int zfs_deleg_verify_nvlist(nvlist_t *nvlist);
9291ebeef5Sahrens void zfs_deleg_whokey(char *attr, zfs_deleg_who_type_t type,
93ecd6cf80Smarks     char checkflag, void *data);
9491ebeef5Sahrens const char *zfs_deleg_canonicalize_perm(const char *perm);
95ecd6cf80Smarks 
96ecd6cf80Smarks #ifdef	__cplusplus
97ecd6cf80Smarks }
98ecd6cf80Smarks #endif
99ecd6cf80Smarks 
100ecd6cf80Smarks #endif	/* _ZFS_DELEG_H */
101