zfs_deleg.h revision 148434217c040ea38dc844384f6ba68d9b325906
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks/*
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks * CDDL HEADER START
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks *
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks * The contents of this file are subject to the terms of the
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks * Common Development and Distribution License (the "License").
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks * You may not use this file except in compliance with the License.
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks *
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks * or http://www.opensolaris.org/os/licensing.
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks * See the License for the specific language governing permissions
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks * and limitations under the License.
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks *
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks * When distributing Covered Code, include this CDDL HEADER in each
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks * If applicable, add the following below this CDDL HEADER, with the
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks * fields enclosed by brackets "[]" replaced with your own identifying
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks * information: Portions Copyright [yyyy] [name of copyright owner]
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks *
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks * CDDL HEADER END
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks */
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks/*
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks * Use is subject to license terms.
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks */
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#ifndef _ZFS_DELEG_H
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#define _ZFS_DELEG_H
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#include <sys/fs/zfs.h>
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#ifdef __cplusplus
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarksextern "C" {
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#endif
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#define ZFS_DELEG_SET_NAME_CHR '@' /* set name lead char */
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#define ZFS_DELEG_FIELD_SEP_CHR '$' /* field separator */
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks/*
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks * Max name length for a delegation attribute
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks */
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#define ZFS_MAX_DELEG_NAME 128
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#define ZFS_DELEG_LOCAL 'l'
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#define ZFS_DELEG_DESCENDENT 'd'
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#define ZFS_DELEG_NA '-'
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1markstypedef enum {
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1marks ZFS_DELEG_NOTE_CREATE,
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1marks ZFS_DELEG_NOTE_DESTROY,
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1marks ZFS_DELEG_NOTE_SNAPSHOT,
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1marks ZFS_DELEG_NOTE_ROLLBACK,
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1marks ZFS_DELEG_NOTE_CLONE,
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1marks ZFS_DELEG_NOTE_PROMOTE,
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1marks ZFS_DELEG_NOTE_RENAME,
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1marks ZFS_DELEG_NOTE_RECEIVE,
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1marks ZFS_DELEG_NOTE_ALLOW,
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1marks ZFS_DELEG_NOTE_USERPROP,
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1marks ZFS_DELEG_NOTE_MOUNT,
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1marks ZFS_DELEG_NOTE_SHARE,
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens ZFS_DELEG_NOTE_USERQUOTA,
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens ZFS_DELEG_NOTE_GROUPQUOTA,
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens ZFS_DELEG_NOTE_USERUSED,
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens ZFS_DELEG_NOTE_GROUPUSED,
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1marks ZFS_DELEG_NOTE_NONE
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1marks} zfs_deleg_note_t;
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1marks
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1markstypedef struct zfs_deleg_perm_tab {
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1marks char *z_perm;
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1marks zfs_deleg_note_t z_note;
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1marks} zfs_deleg_perm_tab_t;
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1marks
6949a980ded6490cd1bcf4a93a1d074d46d9a6c1marksextern zfs_deleg_perm_tab_t zfs_deleg_perm_tab[];
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarksint zfs_deleg_verify_nvlist(nvlist_t *nvlist);
91ebeef555ce7f899b6270a3c2df47b51f7ad59aahrensvoid zfs_deleg_whokey(char *attr, zfs_deleg_who_type_t type,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks char checkflag, void *data);
91ebeef555ce7f899b6270a3c2df47b51f7ad59aahrensconst char *zfs_deleg_canonicalize_perm(const char *perm);
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#ifdef __cplusplus
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks}
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#endif
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#endif /* _ZFS_DELEG_H */