xref: /titanic_44/usr/src/common/zfs/zfs_deleg.h (revision 6949a980ded6490cd1bcf4a93a1d074d46d9a6c1)
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 /*
22*6949a980Smarks  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23ecd6cf80Smarks  * Use is subject to license terms.
24ecd6cf80Smarks  */
25ecd6cf80Smarks 
26ecd6cf80Smarks #ifndef	_ZFS_DELEG_H
27ecd6cf80Smarks #define	_ZFS_DELEG_H
28ecd6cf80Smarks 
29ecd6cf80Smarks #pragma ident	"%Z%%M%	%I%	%E% SMI"
30ecd6cf80Smarks 
31ecd6cf80Smarks #include <sys/fs/zfs.h>
32ecd6cf80Smarks 
33ecd6cf80Smarks #ifdef	__cplusplus
34ecd6cf80Smarks extern "C" {
35ecd6cf80Smarks #endif
36ecd6cf80Smarks 
37ecd6cf80Smarks #define	ZFS_DELEG_SET_NAME_CHR		'@'		/* set name lead char */
38ecd6cf80Smarks #define	ZFS_DELEG_FIELD_SEP_CHR		'$'		/* field separator */
39ecd6cf80Smarks 
40ecd6cf80Smarks /*
41ecd6cf80Smarks  * Max name length for a delegation attribute
42ecd6cf80Smarks  */
43ecd6cf80Smarks #define	ZFS_MAX_DELEG_NAME	128
44ecd6cf80Smarks 
45ecd6cf80Smarks #define	ZFS_DELEG_LOCAL		'l'
46ecd6cf80Smarks #define	ZFS_DELEG_DESCENDENT	'd'
47ecd6cf80Smarks #define	ZFS_DELEG_NA		'-'
48ecd6cf80Smarks 
49*6949a980Smarks typedef enum {
50*6949a980Smarks 	ZFS_DELEG_NOTE_CREATE,
51*6949a980Smarks 	ZFS_DELEG_NOTE_DESTROY,
52*6949a980Smarks 	ZFS_DELEG_NOTE_SNAPSHOT,
53*6949a980Smarks 	ZFS_DELEG_NOTE_ROLLBACK,
54*6949a980Smarks 	ZFS_DELEG_NOTE_CLONE,
55*6949a980Smarks 	ZFS_DELEG_NOTE_PROMOTE,
56*6949a980Smarks 	ZFS_DELEG_NOTE_RENAME,
57*6949a980Smarks 	ZFS_DELEG_NOTE_RECEIVE,
58*6949a980Smarks 	ZFS_DELEG_NOTE_ALLOW,
59*6949a980Smarks 	ZFS_DELEG_NOTE_USERPROP,
60*6949a980Smarks 	ZFS_DELEG_NOTE_MOUNT,
61*6949a980Smarks 	ZFS_DELEG_NOTE_SHARE,
62*6949a980Smarks 	ZFS_DELEG_NOTE_NONE
63*6949a980Smarks } zfs_deleg_note_t;
64*6949a980Smarks 
65*6949a980Smarks typedef struct zfs_deleg_perm_tab {
66*6949a980Smarks 	char *z_perm;
67*6949a980Smarks 	zfs_deleg_note_t z_note;
68*6949a980Smarks } zfs_deleg_perm_tab_t;
69*6949a980Smarks 
70*6949a980Smarks extern zfs_deleg_perm_tab_t zfs_deleg_perm_tab[];
71ecd6cf80Smarks 
72ecd6cf80Smarks int zfs_deleg_verify_nvlist(nvlist_t *nvlist);
7391ebeef5Sahrens void zfs_deleg_whokey(char *attr, zfs_deleg_who_type_t type,
74ecd6cf80Smarks     char checkflag, void *data);
7591ebeef5Sahrens const char *zfs_deleg_canonicalize_perm(const char *perm);
76ecd6cf80Smarks 
77ecd6cf80Smarks #ifdef	__cplusplus
78ecd6cf80Smarks }
79ecd6cf80Smarks #endif
80ecd6cf80Smarks 
81ecd6cf80Smarks #endif	/* _ZFS_DELEG_H */
82