4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_FS_ZFS_ACL_H
27 #define _SYS_FS_ZFS_ACL_H
29 #pragma ident "%Z%%M% %I% %E% SMI"
43 #define ACCESS_UNDETERMINED -1
45 #define ACE_SLOT_CNT 6
47 typedef struct zfs_znode_acl {
48 uint64_t z_acl_extern_obj; /* ext acl pieces */
49 uint32_t z_acl_count; /* Number of ACEs */
50 uint16_t z_acl_version; /* acl version */
51 uint16_t z_acl_pad; /* pad */
52 ace_t z_ace_data[ACE_SLOT_CNT]; /* 6 standard ACEs */
55 #define ACL_DATA_ALLOCED 0x1
58 * Max ACL size is prepended deny for all entries + the
59 * canonical six tacked on * the end.
61 #define MAX_ACL_SIZE (MAX_ACL_ENTRIES * 2 + 6)
63 typedef struct zfs_acl {
64 int z_slots; /* number of allocated slots for ACEs */
70 #define ZFS_ACL_SIZE(aclcnt) (sizeof (ace_t) * (aclcnt))
73 * Property values for acl_mode and acl_inherit.
75 * acl_mode can take discard, noallow, groupmask and passthrough.
76 * whereas acl_inherit has secure instead of groupmask.
79 #define ZFS_ACL_DISCARD 0
80 #define ZFS_ACL_NOALLOW 1
81 #define ZFS_ACL_GROUPMASK 2
82 #define ZFS_ACL_PASSTHROUGH 3
83 #define ZFS_ACL_SECURE 4
88 void zfs_perm_init(struct znode *, struct znode *, int, vattr_t *,
89 dmu_tx_t *, cred_t *);
91 int zfs_getacl(struct znode *, vsecattr_t *, cred_t *);
93 int zfs_mode_update(struct znode *, uint64_t, dmu_tx_t *);
95 int zfs_setacl(struct znode *, vsecattr_t *, cred_t *);
97 void zfs_acl_rele(void *);
98 void zfs_ace_byteswap(ace_t *, int);
99 extern int zfs_zaccess(struct znode *, int, cred_t *);
100 extern int zfs_zaccess_rwx(struct znode *, mode_t, cred_t *);
101 extern int zfs_acl_access(struct znode *, int, cred_t *);
102 int zfs_acl_chmod_setattr(struct znode *, uint64_t, dmu_tx_t *);
103 int zfs_zaccess_delete(struct znode *, struct znode *, cred_t *);
104 int zfs_zaccess_rename(struct znode *, struct znode *,
105 struct znode *, struct znode *, cred_t *cr);
106 int zfs_zaccess_v4_perm(struct znode *, int, cred_t *);
107 void zfs_acl_free(zfs_acl_t *);
115 #endif /* !ZFS_NO_ACL */