da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER START
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The contents of this file are subject to the terms of the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Common Development and Distribution License (the "License").
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You may not use this file except in compliance with the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * See the License for the specific language governing permissions
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * and limitations under the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * When distributing Covered Code, include this CDDL HEADER in each
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If applicable, add the following below this CDDL HEADER, with the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * fields enclosed by brackets "[]" replaced with your own identifying
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * information: Portions Copyright [yyyy] [name of copyright owner]
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER END
b38741657f2b4824e5595acf790b1d2eb9d761f0John Harres * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Use is subject to license terms.
e0d35c4478bf9fd4080951b5b9d1f9a38948ba69marksextern "C" {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwtypedef enum {
4c841f6070b4f88f9dc008de526b313bbebd4e32marks * Estimate space needed for one more fuid table entry.
4c841f6070b4f88f9dc008de526b313bbebd4e32marks * for now assume its current size + 1K
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens#define FUID_SIZE_ESTIMATE(z) ((z)->z_fuid_size + (SPA_MINBLOCKSIZE << 1))
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens#define FUID_ENCODE(idx, rid) (((uint64_t)(idx) << 32) | (rid))
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * FUIDs cause problems for the intent log
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * we need to replay the creation of the FUID,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * but we can't count on the idmapper to be around
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * and during replay the FUID index may be different than
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * before. Also, if an ACL has 100 ACEs and 12 different
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * domains we don't want to log 100 domain strings, but rather
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * just the unique 12.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The FUIDs in the log will index into
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * domain string table and the bottom half will be the rid.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Used for mapping ephemeral uid/gid during ACL setting to FUIDs
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/* list of unique domains */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * FUID information necessary for logging create, setattr, and setacl.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw size_t z_domain_str_sz; /* len of domain strings z_domain list */
e0d35c4478bf9fd4080951b5b9d1f9a38948ba69marksextern uid_t zfs_fuid_map_id(zfsvfs_t *, uint64_t, cred_t *, zfs_fuid_type_t);
b38741657f2b4824e5595acf790b1d2eb9d761f0John Harresextern void zfs_fuid_node_add(zfs_fuid_info_t **, const char *, uint32_t,
e0d35c4478bf9fd4080951b5b9d1f9a38948ba69marksextern uint64_t zfs_fuid_create_cred(zfsvfs_t *, zfs_fuid_type_t,
bda89588bd7667394a834e8a9a34612cce2ae9c3jpextern uint64_t zfs_fuid_create(zfsvfs_t *, uint64_t, cred_t *, zfs_fuid_type_t,
89459e17032b6bb1d59eebd2b7c0d06859d4657cMark Shellenbaumextern void zfs_fuid_map_ids(struct znode *zp, cred_t *cr,
89459e17032b6bb1d59eebd2b7c0d06859d4657cMark Shellenbaumextern void zfs_fuid_info_free(zfs_fuid_info_t *);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwextern boolean_t zfs_groupmember(zfsvfs_t *, uint64_t, cred_t *);
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrensextern int zfs_fuid_find_by_domain(zfsvfs_t *, const char *domain,
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrensextern const char *zfs_fuid_find_by_idx(zfsvfs_t *zfsvfs, uint32_t idx);
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrensextern void zfs_fuid_txhold(zfsvfs_t *zfsvfs, dmu_tx_t *tx);
89459e17032b6bb1d59eebd2b7c0d06859d4657cMark Shellenbaumvoid zfs_fuid_avl_tree_create(avl_tree_t *, avl_tree_t *);
e0d35c4478bf9fd4080951b5b9d1f9a38948ba69marksuint64_t zfs_fuid_table_load(objset_t *, uint64_t, avl_tree_t *, avl_tree_t *);
e0d35c4478bf9fd4080951b5b9d1f9a38948ba69marksvoid zfs_fuid_table_destroy(avl_tree_t *, avl_tree_t *);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#endif /* _SYS_FS_ZFS_FUID_H */