xref: /onnv-gate/usr/src/common/zfs/zfs_deleg.h (revision 13043:8c712bbb18ea)
14543Smarks /*
24543Smarks  * CDDL HEADER START
34543Smarks  *
44543Smarks  * The contents of this file are subject to the terms of the
54543Smarks  * Common Development and Distribution License (the "License").
64543Smarks  * You may not use this file except in compliance with the License.
74543Smarks  *
84543Smarks  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
94543Smarks  * or http://www.opensolaris.org/os/licensing.
104543Smarks  * See the License for the specific language governing permissions
114543Smarks  * and limitations under the License.
124543Smarks  *
134543Smarks  * When distributing Covered Code, include this CDDL HEADER in each
144543Smarks  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
154543Smarks  * If applicable, add the following below this CDDL HEADER, with the
164543Smarks  * fields enclosed by brackets "[]" replaced with your own identifying
174543Smarks  * information: Portions Copyright [yyyy] [name of copyright owner]
184543Smarks  *
194543Smarks  * CDDL HEADER END
204543Smarks  */
214543Smarks /*
22*13043STim.Haley@Sun.COM  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
234543Smarks  */
244543Smarks 
254543Smarks #ifndef	_ZFS_DELEG_H
264543Smarks #define	_ZFS_DELEG_H
274543Smarks 
284543Smarks #include <sys/fs/zfs.h>
294543Smarks 
304543Smarks #ifdef	__cplusplus
314543Smarks extern "C" {
324543Smarks #endif
334543Smarks 
344543Smarks #define	ZFS_DELEG_SET_NAME_CHR		'@'		/* set name lead char */
354543Smarks #define	ZFS_DELEG_FIELD_SEP_CHR		'$'		/* field separator */
364543Smarks 
374543Smarks /*
384543Smarks  * Max name length for a delegation attribute
394543Smarks  */
404543Smarks #define	ZFS_MAX_DELEG_NAME	128
414543Smarks 
424543Smarks #define	ZFS_DELEG_LOCAL		'l'
434543Smarks #define	ZFS_DELEG_DESCENDENT	'd'
444543Smarks #define	ZFS_DELEG_NA		'-'
454543Smarks 
465993Smarks typedef enum {
475993Smarks 	ZFS_DELEG_NOTE_CREATE,
485993Smarks 	ZFS_DELEG_NOTE_DESTROY,
495993Smarks 	ZFS_DELEG_NOTE_SNAPSHOT,
505993Smarks 	ZFS_DELEG_NOTE_ROLLBACK,
515993Smarks 	ZFS_DELEG_NOTE_CLONE,
525993Smarks 	ZFS_DELEG_NOTE_PROMOTE,
535993Smarks 	ZFS_DELEG_NOTE_RENAME,
545993Smarks 	ZFS_DELEG_NOTE_RECEIVE,
555993Smarks 	ZFS_DELEG_NOTE_ALLOW,
565993Smarks 	ZFS_DELEG_NOTE_USERPROP,
575993Smarks 	ZFS_DELEG_NOTE_MOUNT,
585993Smarks 	ZFS_DELEG_NOTE_SHARE,
599396SMatthew.Ahrens@Sun.COM 	ZFS_DELEG_NOTE_USERQUOTA,
609396SMatthew.Ahrens@Sun.COM 	ZFS_DELEG_NOTE_GROUPQUOTA,
619396SMatthew.Ahrens@Sun.COM 	ZFS_DELEG_NOTE_USERUSED,
629396SMatthew.Ahrens@Sun.COM 	ZFS_DELEG_NOTE_GROUPUSED,
6310242Schris.kirby@sun.com 	ZFS_DELEG_NOTE_HOLD,
6410242Schris.kirby@sun.com 	ZFS_DELEG_NOTE_RELEASE,
65*13043STim.Haley@Sun.COM 	ZFS_DELEG_NOTE_DIFF,
665993Smarks 	ZFS_DELEG_NOTE_NONE
675993Smarks } zfs_deleg_note_t;
685993Smarks 
695993Smarks typedef struct zfs_deleg_perm_tab {
705993Smarks 	char *z_perm;
715993Smarks 	zfs_deleg_note_t z_note;
725993Smarks } zfs_deleg_perm_tab_t;
735993Smarks 
745993Smarks extern zfs_deleg_perm_tab_t zfs_deleg_perm_tab[];
754543Smarks 
764543Smarks int zfs_deleg_verify_nvlist(nvlist_t *nvlist);
774787Sahrens void zfs_deleg_whokey(char *attr, zfs_deleg_who_type_t type,
784543Smarks     char checkflag, void *data);
794787Sahrens const char *zfs_deleg_canonicalize_perm(const char *perm);
804543Smarks 
814543Smarks #ifdef	__cplusplus
824543Smarks }
834543Smarks #endif
844543Smarks 
854543Smarks #endif	/* _ZFS_DELEG_H */
86