xref: /freebsd/sys/contrib/openzfs/include/sys/objlist.h (revision e25152834cdf3b353892835a4f3b157e066a8ed4)
1 /*
2  * CDDL HEADER START
3  *
4  * This file and its contents are supplied under the terms of the
5  * Common Development and Distribution License ("CDDL"), version 1.0.
6  * You may only use this file in accordance with the terms of version
7  * 1.0 of the CDDL.
8  *
9  * A full copy of the text of the CDDL should have accompanied this
10  * source.  A copy of the CDDL is also available via the Internet at
11  * http://www.illumos.org/license/CDDL.
12  *
13  * CDDL HEADER END
14  */
15 /*
16  * Copyright (c) 2018 by Delphix. All rights reserved.
17  */
18 
19 #ifndef	_OBJLIST_H
20 #define	_OBJLIST_H
21 
22 #ifdef	__cplusplus
23 extern "C" {
24 #endif
25 
26 #include	<sys/zfs_context.h>
27 
28 typedef struct objlist_node {
29 	list_node_t	on_node;
30 	uint64_t	on_object;
31 } objlist_node_t;
32 
33 typedef struct objlist {
34 	list_t		ol_list; /* List of struct objnode. */
35 	/*
36 	 * Last object looked up. Used to assert that objects are being looked
37 	 * up in ascending order.
38 	 */
39 	uint64_t	ol_last_lookup;
40 } objlist_t;
41 
42 objlist_t *objlist_create(void);
43 void objlist_destroy(objlist_t *);
44 boolean_t objlist_exists(objlist_t *, uint64_t);
45 void objlist_insert(objlist_t *, uint64_t);
46 
47 #ifdef	__cplusplus
48 }
49 #endif
50 
51 #endif	/* _OBJLIST_H */
52