usr/src/common/zfs/zfs_deleg.h
author Chris Kirby <chris.kirby@sun.com>
Sat, 01 Aug 2009 15:09:50 -0600
changeset 10242 c40d075fbca6
parent 9396 f41cf682d0d3
child 13055 8c712bbb18ea
permissions -rw-r--r--
PSARC/2009/297 zfs snapshot holds 6803121 want user-settable refcounts on snapshots 6851824 zfs_ioc_rename() can be called with a NULL zc_name
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4543
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
     1
/*
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
     2
 * CDDL HEADER START
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
     3
 *
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
     5
 * Common Development and Distribution License (the "License").
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
     6
 * You may not use this file except in compliance with the License.
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
     7
 *
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    11
 * and limitations under the License.
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    12
 *
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    18
 *
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    19
 * CDDL HEADER END
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    20
 */
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    21
/*
9396
f41cf682d0d3 PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents: 5993
diff changeset
    22
 * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
4543
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    23
 * Use is subject to license terms.
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    24
 */
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    25
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    26
#ifndef	_ZFS_DELEG_H
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    27
#define	_ZFS_DELEG_H
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    28
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    29
#include <sys/fs/zfs.h>
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    30
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    31
#ifdef	__cplusplus
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    32
extern "C" {
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    33
#endif
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    34
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    35
#define	ZFS_DELEG_SET_NAME_CHR		'@'		/* set name lead char */
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    36
#define	ZFS_DELEG_FIELD_SEP_CHR		'$'		/* field separator */
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    37
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    38
/*
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    39
 * Max name length for a delegation attribute
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    40
 */
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    41
#define	ZFS_MAX_DELEG_NAME	128
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    42
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    43
#define	ZFS_DELEG_LOCAL		'l'
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    44
#define	ZFS_DELEG_DESCENDENT	'd'
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    45
#define	ZFS_DELEG_NA		'-'
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    46
5993
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    47
typedef enum {
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    48
	ZFS_DELEG_NOTE_CREATE,
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    49
	ZFS_DELEG_NOTE_DESTROY,
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    50
	ZFS_DELEG_NOTE_SNAPSHOT,
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    51
	ZFS_DELEG_NOTE_ROLLBACK,
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    52
	ZFS_DELEG_NOTE_CLONE,
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    53
	ZFS_DELEG_NOTE_PROMOTE,
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    54
	ZFS_DELEG_NOTE_RENAME,
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    55
	ZFS_DELEG_NOTE_RECEIVE,
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    56
	ZFS_DELEG_NOTE_ALLOW,
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    57
	ZFS_DELEG_NOTE_USERPROP,
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    58
	ZFS_DELEG_NOTE_MOUNT,
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    59
	ZFS_DELEG_NOTE_SHARE,
9396
f41cf682d0d3 PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents: 5993
diff changeset
    60
	ZFS_DELEG_NOTE_USERQUOTA,
f41cf682d0d3 PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents: 5993
diff changeset
    61
	ZFS_DELEG_NOTE_GROUPQUOTA,
f41cf682d0d3 PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents: 5993
diff changeset
    62
	ZFS_DELEG_NOTE_USERUSED,
f41cf682d0d3 PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents: 5993
diff changeset
    63
	ZFS_DELEG_NOTE_GROUPUSED,
10242
c40d075fbca6 PSARC/2009/297 zfs snapshot holds
Chris Kirby <chris.kirby@sun.com>
parents: 9396
diff changeset
    64
	ZFS_DELEG_NOTE_HOLD,
c40d075fbca6 PSARC/2009/297 zfs snapshot holds
Chris Kirby <chris.kirby@sun.com>
parents: 9396
diff changeset
    65
	ZFS_DELEG_NOTE_RELEASE,
5993
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    66
	ZFS_DELEG_NOTE_NONE
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    67
} zfs_deleg_note_t;
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    68
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    69
typedef struct zfs_deleg_perm_tab {
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    70
	char *z_perm;
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    71
	zfs_deleg_note_t z_note;
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    72
} zfs_deleg_perm_tab_t;
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    73
6309c3c0a28f 6576659 zfs allow should list delegatable perms
marks
parents: 4787
diff changeset
    74
extern zfs_deleg_perm_tab_t zfs_deleg_perm_tab[];
4543
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    75
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    76
int zfs_deleg_verify_nvlist(nvlist_t *nvlist);
4787
602d3f97842c 6393351 unique_* could be improved
ahrens
parents: 4543
diff changeset
    77
void zfs_deleg_whokey(char *attr, zfs_deleg_who_type_t type,
4543
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    78
    char checkflag, void *data);
4787
602d3f97842c 6393351 unique_* could be improved
ahrens
parents: 4543
diff changeset
    79
const char *zfs_deleg_canonicalize_perm(const char *perm);
4543
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    80
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    81
#ifdef	__cplusplus
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    82
}
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    83
#endif
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    84
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents:
diff changeset
    85
#endif	/* _ZFS_DELEG_H */