xref: /freebsd/crypto/krb5/src/plugins/kdb/db2/libdb2/include/db-ndbm.h (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1*7f2fe78bSCy Schubert /*-
2*7f2fe78bSCy Schubert  * Copyright (c) 1990, 1993
3*7f2fe78bSCy Schubert  *	The Regents of the University of California.  All rights reserved.
4*7f2fe78bSCy Schubert  *
5*7f2fe78bSCy Schubert  * This code is derived from software contributed to Berkeley by
6*7f2fe78bSCy Schubert  * Margo Seltzer.
7*7f2fe78bSCy Schubert  *
8*7f2fe78bSCy Schubert  * Redistribution and use in source and binary forms, with or without
9*7f2fe78bSCy Schubert  * modification, are permitted provided that the following conditions
10*7f2fe78bSCy Schubert  * are met:
11*7f2fe78bSCy Schubert  * 1. Redistributions of source code must retain the above copyright
12*7f2fe78bSCy Schubert  *    notice, this list of conditions and the following disclaimer.
13*7f2fe78bSCy Schubert  * 2. Redistributions in binary form must reproduce the above copyright
14*7f2fe78bSCy Schubert  *    notice, this list of conditions and the following disclaimer in the
15*7f2fe78bSCy Schubert  *    documentation and/or other materials provided with the distribution.
16*7f2fe78bSCy Schubert  * 3. All advertising materials mentioning features or use of this software
17*7f2fe78bSCy Schubert  *    must display the following acknowledgement:
18*7f2fe78bSCy Schubert  *	This product includes software developed by the University of
19*7f2fe78bSCy Schubert  *	California, Berkeley and its contributors.
20*7f2fe78bSCy Schubert  * 4. Neither the name of the University nor the names of its contributors
21*7f2fe78bSCy Schubert  *    may be used to endorse or promote products derived from this software
22*7f2fe78bSCy Schubert  *    without specific prior written permission.
23*7f2fe78bSCy Schubert  *
24*7f2fe78bSCy Schubert  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25*7f2fe78bSCy Schubert  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26*7f2fe78bSCy Schubert  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27*7f2fe78bSCy Schubert  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28*7f2fe78bSCy Schubert  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29*7f2fe78bSCy Schubert  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30*7f2fe78bSCy Schubert  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31*7f2fe78bSCy Schubert  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32*7f2fe78bSCy Schubert  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33*7f2fe78bSCy Schubert  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34*7f2fe78bSCy Schubert  * SUCH DAMAGE.
35*7f2fe78bSCy Schubert  *
36*7f2fe78bSCy Schubert  *	@(#)ndbm.h	8.1 (Berkeley) 6/2/93
37*7f2fe78bSCy Schubert  */
38*7f2fe78bSCy Schubert 
39*7f2fe78bSCy Schubert #ifndef _NDBM_H_
40*7f2fe78bSCy Schubert #define	_NDBM_H_
41*7f2fe78bSCy Schubert 
42*7f2fe78bSCy Schubert #include "db.h"
43*7f2fe78bSCy Schubert 
44*7f2fe78bSCy Schubert /* Map dbm interface onto db(3). */
45*7f2fe78bSCy Schubert #define DBM_RDONLY	O_RDONLY
46*7f2fe78bSCy Schubert 
47*7f2fe78bSCy Schubert /* Flags to dbm_store(). */
48*7f2fe78bSCy Schubert #define DBM_INSERT      0
49*7f2fe78bSCy Schubert #define DBM_REPLACE     1
50*7f2fe78bSCy Schubert 
51*7f2fe78bSCy Schubert /*
52*7f2fe78bSCy Schubert  * The db(3) support for ndbm(3) always appends this suffix to the
53*7f2fe78bSCy Schubert  * file name to avoid overwriting the user's original database.
54*7f2fe78bSCy Schubert  */
55*7f2fe78bSCy Schubert #define	DBM_SUFFIX	".db"
56*7f2fe78bSCy Schubert 
57*7f2fe78bSCy Schubert typedef struct {
58*7f2fe78bSCy Schubert 	char *dptr;
59*7f2fe78bSCy Schubert 	int dsize;
60*7f2fe78bSCy Schubert } datum;
61*7f2fe78bSCy Schubert 
62*7f2fe78bSCy Schubert typedef DB DBM;
63*7f2fe78bSCy Schubert #define	dbm_pagfno(a)	DBM_PAGFNO_NOT_AVAILABLE
64*7f2fe78bSCy Schubert 
65*7f2fe78bSCy Schubert #define dbm_close	kdb2_dbm_close
66*7f2fe78bSCy Schubert #define dbm_delete	kdb2_dbm_delete
67*7f2fe78bSCy Schubert #define dbm_fetch	kdb2_dbm_fetch
68*7f2fe78bSCy Schubert #define dbm_firstkey	kdb2_dbm_firstkey
69*7f2fe78bSCy Schubert #define dbm_forder	kdb2_dbm_forder
70*7f2fe78bSCy Schubert #define dbm_nextkey	kdb2_dbm_nextkey
71*7f2fe78bSCy Schubert #define dbm_open	kdb2_dbm_open
72*7f2fe78bSCy Schubert #define dbm_store	kdb2_dbm_store
73*7f2fe78bSCy Schubert #define dbm_dirfno	kdb2_dbm_dirfno
74*7f2fe78bSCy Schubert #define dbm_error	kdb2_dbm_error
75*7f2fe78bSCy Schubert #define dbm_clearerr	kdb2_dbm_clearerr
76*7f2fe78bSCy Schubert 
77*7f2fe78bSCy Schubert __BEGIN_DECLS
78*7f2fe78bSCy Schubert void	 dbm_close __P((DBM *));
79*7f2fe78bSCy Schubert int	 dbm_delete __P((DBM *, datum));
80*7f2fe78bSCy Schubert datum	 dbm_fetch __P((DBM *, datum));
81*7f2fe78bSCy Schubert datum	 dbm_firstkey __P((DBM *));
82*7f2fe78bSCy Schubert long	 dbm_forder __P((DBM *, datum));
83*7f2fe78bSCy Schubert datum	 dbm_nextkey __P((DBM *));
84*7f2fe78bSCy Schubert DBM	*dbm_open __P((const char *, int, int));
85*7f2fe78bSCy Schubert int	 dbm_store __P((DBM *, datum, datum, int));
86*7f2fe78bSCy Schubert int	 dbm_dirfno __P((DBM *));
87*7f2fe78bSCy Schubert int	 dbm_error __P((DBM *db));
88*7f2fe78bSCy Schubert int	 dbm_clearerr __P((DBM *db));
89*7f2fe78bSCy Schubert __END_DECLS
90*7f2fe78bSCy Schubert 
91*7f2fe78bSCy Schubert #endif /* !_NDBM_H_ */
92