]>
git.proxmox.com Git - mirror_zfs.git/blob - zfs/lib/libzpool/include/sys/zfs_fuid.h
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 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_FS_ZFS_FUID_H
27 #define _SYS_FS_ZFS_FUID_H
29 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <sys/kidmap.h>
35 #include <sys/zfs_vfsops.h>
51 * Estimate space needed for one more fuid table entry.
52 * for now assume its current size + 1K
54 #define FUID_SIZE_ESTIMATE(z) (z->z_fuid_size + (SPA_MINBLOCKSIZE << 1))
56 #define FUID_INDEX(x) (x >> 32)
57 #define FUID_RID(x) (x & 0xffffffff)
58 #define FUID_ENCODE(idx, rid) ((idx << 32) | rid)
60 * FUIDs cause problems for the intent log
61 * we need to replay the creation of the FUID,
62 * but we can't count on the idmapper to be around
63 * and during replay the FUID index may be different than
64 * before. Also, if an ACL has 100 ACEs and 12 different
65 * domains we don't want to log 100 domain strings, but rather
70 * The FUIDs in the log will index into
71 * domain string table and the bottom half will be the rid.
72 * Used for mapping ephemeral uid/gid during ACL setting to FUIDs
74 typedef struct zfs_fuid
{
76 uint64_t z_id
; /* uid/gid being converted to fuid */
77 uint64_t z_domidx
; /* index in AVL domain table */
78 uint64_t z_logfuid
; /* index for domain in log */
81 /* list of unique domains */
82 typedef struct zfs_fuid_domain
{
84 uint64_t z_domidx
; /* AVL tree idx */
85 const char *z_domain
; /* domain string */
89 * FUID information necessary for logging create, setattr, and setacl.
91 typedef struct zfs_fuid_info
{
94 uint64_t z_fuid_owner
;
95 uint64_t z_fuid_group
;
96 char **z_domain_table
; /* Used during replay */
97 uint32_t z_fuid_cnt
; /* How many fuids in z_fuids */
98 uint32_t z_domain_cnt
; /* How many domains */
99 size_t z_domain_str_sz
; /* len of domain strings z_domain list */
104 extern uid_t
zfs_fuid_map_id(zfsvfs_t
*, uint64_t, cred_t
*, zfs_fuid_type_t
);
105 extern void zfs_fuid_destroy(zfsvfs_t
*);
106 extern uint64_t zfs_fuid_create_cred(zfsvfs_t
*, zfs_fuid_type_t
,
107 dmu_tx_t
*, cred_t
*, zfs_fuid_info_t
**);
108 extern uint64_t zfs_fuid_create(zfsvfs_t
*, uint64_t, cred_t
*, zfs_fuid_type_t
,
109 dmu_tx_t
*, zfs_fuid_info_t
**);
110 extern void zfs_fuid_map_ids(struct znode
*zp
, cred_t
*cr
, uid_t
*uid
,
112 extern zfs_fuid_info_t
*zfs_fuid_info_alloc(void);
113 extern void zfs_fuid_info_free();
114 extern boolean_t
zfs_groupmember(zfsvfs_t
*, uint64_t, cred_t
*);
117 char *zfs_fuid_idx_domain(avl_tree_t
*, uint32_t);
118 uint64_t zfs_fuid_table_load(objset_t
*, uint64_t, avl_tree_t
*, avl_tree_t
*);
119 void zfs_fuid_table_destroy(avl_tree_t
*, avl_tree_t
*);
125 #endif /* _SYS_FS_ZFS_FUID_H */