fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER START
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The contents of this file are subject to the terms of the
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * Common Development and Distribution License (the "License").
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * You may not use this file except in compliance with the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fa9e4066f08beec538e775443c5be79dd423fcabahrens * or http://www.opensolaris.org/os/licensing.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * See the License for the specific language governing permissions
fa9e4066f08beec538e775443c5be79dd423fcabahrens * and limitations under the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
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 *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER END
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
cde58dbc6a23d4d38db7c8866312be83221c765fMatthew Ahrens * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#ifndef _SYS_BPLIST_H
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define _SYS_BPLIST_H
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/zfs_context.h>
cde58dbc6a23d4d38db7c8866312be83221c765fMatthew Ahrens#include <sys/spa.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#ifdef __cplusplus
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern "C" {
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif
fa9e4066f08beec538e775443c5be79dd423fcabahrens
cde58dbc6a23d4d38db7c8866312be83221c765fMatthew Ahrenstypedef struct bplist_entry {
cde58dbc6a23d4d38db7c8866312be83221c765fMatthew Ahrens blkptr_t bpe_blk;
cde58dbc6a23d4d38db7c8866312be83221c765fMatthew Ahrens list_node_t bpe_node;
cde58dbc6a23d4d38db7c8866312be83221c765fMatthew Ahrens} bplist_entry_t;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef struct bplist {
fa9e4066f08beec538e775443c5be79dd423fcabahrens kmutex_t bpl_lock;
cde58dbc6a23d4d38db7c8866312be83221c765fMatthew Ahrens list_t bpl_list;
fa9e4066f08beec538e775443c5be79dd423fcabahrens} bplist_t;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
cde58dbc6a23d4d38db7c8866312be83221c765fMatthew Ahrenstypedef int bplist_itor_t(void *arg, const blkptr_t *bp, dmu_tx_t *tx);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwick
cde58dbc6a23d4d38db7c8866312be83221c765fMatthew Ahrensvoid bplist_create(bplist_t *bpl);
cde58dbc6a23d4d38db7c8866312be83221c765fMatthew Ahrensvoid bplist_destroy(bplist_t *bpl);
cde58dbc6a23d4d38db7c8866312be83221c765fMatthew Ahrensvoid bplist_append(bplist_t *bpl, const blkptr_t *bp);
cde58dbc6a23d4d38db7c8866312be83221c765fMatthew Ahrensvoid bplist_iterate(bplist_t *bpl, bplist_itor_t *func,
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwick void *arg, dmu_tx_t *tx);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#ifdef __cplusplus
fa9e4066f08beec538e775443c5be79dd423fcabahrens}
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif /* _SYS_BPLIST_H */