xref: /netbsd-src/sys/sys/cdbr.h (revision aceb213538ec08a74028e213127af18aa17bf1cf)
1*aceb2135Sjoerg /*	$NetBSD: cdbr.h,v 1.1 2013/12/11 01:24:08 joerg Exp $	*/
2*aceb2135Sjoerg /*-
3*aceb2135Sjoerg  * Copyright (c) 2010 The NetBSD Foundation, Inc.
4*aceb2135Sjoerg  * All rights reserved.
5*aceb2135Sjoerg  *
6*aceb2135Sjoerg  * This code is derived from software contributed to The NetBSD Foundation
7*aceb2135Sjoerg  * by Joerg Sonnenberger.
8*aceb2135Sjoerg  *
9*aceb2135Sjoerg  * Redistribution and use in source and binary forms, with or without
10*aceb2135Sjoerg  * modification, are permitted provided that the following conditions
11*aceb2135Sjoerg  * are met:
12*aceb2135Sjoerg  *
13*aceb2135Sjoerg  * 1. Redistributions of source code must retain the above copyright
14*aceb2135Sjoerg  *    notice, this list of conditions and the following disclaimer.
15*aceb2135Sjoerg  * 2. Redistributions in binary form must reproduce the above copyright
16*aceb2135Sjoerg  *    notice, this list of conditions and the following disclaimer in
17*aceb2135Sjoerg  *    the documentation and/or other materials provided with the
18*aceb2135Sjoerg  *    distribution.
19*aceb2135Sjoerg  *
20*aceb2135Sjoerg  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21*aceb2135Sjoerg  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22*aceb2135Sjoerg  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23*aceb2135Sjoerg  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
24*aceb2135Sjoerg  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25*aceb2135Sjoerg  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
26*aceb2135Sjoerg  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27*aceb2135Sjoerg  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28*aceb2135Sjoerg  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29*aceb2135Sjoerg  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30*aceb2135Sjoerg  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31*aceb2135Sjoerg  * SUCH DAMAGE.
32*aceb2135Sjoerg  */
33*aceb2135Sjoerg 
34*aceb2135Sjoerg #ifndef	_CDBR_H
35*aceb2135Sjoerg #define	_CDBR_H
36*aceb2135Sjoerg 
37*aceb2135Sjoerg #include <sys/cdefs.h>
38*aceb2135Sjoerg #if defined(_KERNEL) || defined(_STANDALONE)
39*aceb2135Sjoerg #include <sys/types.h>
40*aceb2135Sjoerg #else
41*aceb2135Sjoerg #include <inttypes.h>
42*aceb2135Sjoerg #include <stddef.h>
43*aceb2135Sjoerg #endif
44*aceb2135Sjoerg 
45*aceb2135Sjoerg #define	CDBR_DEFAULT	0
46*aceb2135Sjoerg 
47*aceb2135Sjoerg struct cdbr;
48*aceb2135Sjoerg 
49*aceb2135Sjoerg __BEGIN_DECLS
50*aceb2135Sjoerg 
51*aceb2135Sjoerg #if !defined(_KERNEL) && !defined(_STANDALONE)
52*aceb2135Sjoerg struct cdbr	*cdbr_open(const char *, int);
53*aceb2135Sjoerg #endif
54*aceb2135Sjoerg struct cdbr	*cdbr_open_mem(void *, size_t, int,
55*aceb2135Sjoerg     void (*)(void *, void *, size_t), void *);
56*aceb2135Sjoerg uint32_t	 cdbr_entries(struct cdbr *);
57*aceb2135Sjoerg int		 cdbr_get(struct cdbr *, uint32_t, const void **, size_t *);
58*aceb2135Sjoerg int		 cdbr_find(struct cdbr *, const void *, size_t,
59*aceb2135Sjoerg     const void **, size_t *);
60*aceb2135Sjoerg void		 cdbr_close(struct cdbr *);
61*aceb2135Sjoerg 
62*aceb2135Sjoerg __END_DECLS
63*aceb2135Sjoerg 
64*aceb2135Sjoerg #endif /* _CDBR_H */
65