fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER START
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The contents of this file are subject to the terms of the
f65e61c04bc28ffd6bda04619c84330b420450b5ahrens * Common Development and Distribution License (the "License").
f65e61c04bc28ffd6bda04619c84330b420450b5ahrens * You may not use this file except in compliance with the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fa9e4066f08beec538e775443c5be79dd423fcabahrens * See the License for the specific language governing permissions
fa9e4066f08beec538e775443c5be79dd423fcabahrens * and limitations under the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * When distributing Covered Code, include this CDDL HEADER in each
fa9e4066f08beec538e775443c5be79dd423fcabahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * If applicable, add the following below this CDDL HEADER, with the
fa9e4066f08beec538e775443c5be79dd423fcabahrens * fields enclosed by brackets "[]" replaced with your own identifying
fa9e4066f08beec538e775443c5be79dd423fcabahrens * information: Portions Copyright [yyyy] [name of copyright owner]
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER END
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
ae9727953cac4bd427aafd9f27458e401590bcb5Matthew Ahrens * Copyright (c) 2013, 2016 by Delphix. All rights reserved.
bc9014e6a81272073b9854d9f65dd59e18d18c35Justin Gibbs * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
c3d26abc9ee97b4f60233556aadeb57e0bd30bb9Matthew Ahrens * Copyright (c) 2014 Integros [integros.com]
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern "C" {
f65e61c04bc28ffd6bda04619c84330b420450b5ahrens#define FZAP_BLOCK_SHIFT(zap) ((zap)->zap_f.zap_block_shift)
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint16_t mze_pad; /* in case we want to chain them someday */
fa9e4066f08beec538e775443c5be79dd423fcabahrens /* actually variable size depending on block size */
c1379625401dfbe1c39b79136dd384a571d47fdeJustin T. Gibbs (&zap_m_phys(zap)->mz_chunk[(mze)->mze_chunkid])
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The (fat) zap is stored in one object. It is an array of
f65e61c04bc28ffd6bda04619c84330b420450b5ahrens * 1<<FZAP_BLOCK_SHIFT byte blocks. The layout looks like one of:
fa9e4066f08beec538e775443c5be79dd423fcabahrens * ptrtbl fits in first block:
fa9e4066f08beec538e775443c5be79dd423fcabahrens * [zap_phys_t zap_ptrtbl_shift < 6] [zap_leaf_t] ...
fa9e4066f08beec538e775443c5be79dd423fcabahrens * ptrtbl too big for first block:
fa9e4066f08beec538e775443c5be79dd423fcabahrens * [zap_phys_t zap_ptrtbl_shift >= 6] [zap_leaf_t] [ptrtbl] ...
fa9e4066f08beec538e775443c5be79dd423fcabahrens/* any other values are ptrtbl blocks */
f65e61c04bc28ffd6bda04619c84330b420450b5ahrens * the embedded pointer table takes up half a block:
f65e61c04bc28ffd6bda04619c84330b420450b5ahrens * block size / entry size (2^3) / 2
f65e61c04bc28ffd6bda04619c84330b420450b5ahrens#define ZAP_EMBEDDED_PTRTBL_SHIFT(zap) (FZAP_BLOCK_SHIFT(zap) - 3 - 1)
f65e61c04bc28ffd6bda04619c84330b420450b5ahrens * The embedded pointer table starts half-way through the block. Since
f65e61c04bc28ffd6bda04619c84330b420450b5ahrens * the pointer table itself is half the block, it starts at (64-bit)
f65e61c04bc28ffd6bda04619c84330b420450b5ahrens * word number (1<<ZAP_EMBEDDED_PTRTBL_SHIFT(zap)).
fa9e4066f08beec538e775443c5be79dd423fcabahrens * TAKE NOTE:
fa9e4066f08beec538e775443c5be79dd423fcabahrens * If zap_phys_t is modified, zap_byteswap() must be modified.
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t zt_nextblk; /* next (larger) copy start block */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t zt_blks_copied; /* number source blocks copied */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t zap_salt; /* salt to stir into hash function */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint64_t zap_normflags; /* flags for u8_textprep_str() */
f65e61c04bc28ffd6bda04619c84330b420450b5ahrens * This structure is followed by padding, and then the embedded
f65e61c04bc28ffd6bda04619c84330b420450b5ahrens * pointer table. The embedded pointer table takes up second
f65e61c04bc28ffd6bda04619c84330b420450b5ahrens * half of the block. It is accessed using the
f65e61c04bc28ffd6bda04619c84330b420450b5ahrens * ZAP_EMBEDDED_PTRTBL_ENT() macro.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * zap_num_entries_mtx protects
fa9e4066f08beec538e775443c5be79dd423fcabahrens * zap_num_entries
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwboolean_t zap_match(zap_name_t *zn, const char *matchname);
fa9e4066f08beec538e775443c5be79dd423fcabahrensint zap_lockdir(objset_t *os, uint64_t obj, dmu_tx_t *tx,
ae9727953cac4bd427aafd9f27458e401590bcb5Matthew Ahrens krw_t lti, boolean_t fatreader, boolean_t adding, void *tag, zap_t **zapp);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwickzap_name_t *zap_name_alloc(zap_t *zap, const char *key, matchtype_t mt);
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZAP_HASH_IDX(hash, n) (((n) == 0) ? 0 : ((hash) >> (64 - (n))))
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint64_t integer_size, uint64_t num_integers, void *buf,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw char *realname, int rn_len, boolean_t *normalization_conflictp);
0c779ad424a92a84d1e07d47cab7f8009189202bMatthew Ahrensint fzap_count_write(zap_name_t *zn, int add, refcount_t *towrite,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwint fzap_add(zap_name_t *zn, uint64_t integer_size, uint64_t num_integers,
ae9727953cac4bd427aafd9f27458e401590bcb5Matthew Ahrens int integer_size, uint64_t num_integers, const void *val,
fa9e4066f08beec538e775443c5be79dd423fcabahrensint fzap_cursor_retrieve(zap_t *zap, zap_cursor_t *zc, zap_attribute_t *za);
ae9727953cac4bd427aafd9f27458e401590bcb5Matthew Ahrens const void *val, uint32_t cd, void *tag, dmu_tx_t *tx);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwickvoid fzap_upgrade(zap_t *zap, dmu_tx_t *tx, zap_flags_t flags);
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif /* _SYS_ZAP_IMPL_H */