xref: /onnv-gate/usr/src/uts/common/fs/zfs/sys/bplist.h (revision 12470:54258108784b)
1789Sahrens /*
2789Sahrens  * CDDL HEADER START
3789Sahrens  *
4789Sahrens  * The contents of this file are subject to the terms of the
51544Seschrock  * Common Development and Distribution License (the "License").
61544Seschrock  * You may not use this file except in compliance with the License.
7789Sahrens  *
8789Sahrens  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9789Sahrens  * or http://www.opensolaris.org/os/licensing.
10789Sahrens  * See the License for the specific language governing permissions
11789Sahrens  * and limitations under the License.
12789Sahrens  *
13789Sahrens  * When distributing Covered Code, include this CDDL HEADER in each
14789Sahrens  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15789Sahrens  * If applicable, add the following below this CDDL HEADER, with the
16789Sahrens  * fields enclosed by brackets "[]" replaced with your own identifying
17789Sahrens  * information: Portions Copyright [yyyy] [name of copyright owner]
18789Sahrens  *
19789Sahrens  * CDDL HEADER END
20789Sahrens  */
21789Sahrens /*
22*12470SMatthew.Ahrens@Sun.COM  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23789Sahrens  */
24789Sahrens 
25789Sahrens #ifndef	_SYS_BPLIST_H
26789Sahrens #define	_SYS_BPLIST_H
27789Sahrens 
28*12470SMatthew.Ahrens@Sun.COM #include <sys/zfs_context.h>
29789Sahrens #include <sys/spa.h>
30789Sahrens 
31789Sahrens #ifdef	__cplusplus
32789Sahrens extern "C" {
33789Sahrens #endif
34789Sahrens 
35*12470SMatthew.Ahrens@Sun.COM typedef struct bplist_entry {
36*12470SMatthew.Ahrens@Sun.COM 	blkptr_t	bpe_blk;
37*12470SMatthew.Ahrens@Sun.COM 	list_node_t	bpe_node;
38*12470SMatthew.Ahrens@Sun.COM } bplist_entry_t;
39789Sahrens 
40789Sahrens typedef struct bplist {
41789Sahrens 	kmutex_t	bpl_lock;
42*12470SMatthew.Ahrens@Sun.COM 	list_t		bpl_list;
43789Sahrens } bplist_t;
44789Sahrens 
45*12470SMatthew.Ahrens@Sun.COM typedef int bplist_itor_t(void *arg, const blkptr_t *bp, dmu_tx_t *tx);
4610922SJeff.Bonwick@Sun.COM 
47*12470SMatthew.Ahrens@Sun.COM void bplist_create(bplist_t *bpl);
48*12470SMatthew.Ahrens@Sun.COM void bplist_destroy(bplist_t *bpl);
49*12470SMatthew.Ahrens@Sun.COM void bplist_append(bplist_t *bpl, const blkptr_t *bp);
50*12470SMatthew.Ahrens@Sun.COM void bplist_iterate(bplist_t *bpl, bplist_itor_t *func,
5110922SJeff.Bonwick@Sun.COM     void *arg, dmu_tx_t *tx);
52789Sahrens 
53789Sahrens #ifdef	__cplusplus
54789Sahrens }
55789Sahrens #endif
56789Sahrens 
57789Sahrens #endif /* _SYS_BPLIST_H */
58