xref: /onnv-gate/usr/src/lib/krb5/plugins/kdb/db2/libdb2/btree/btree.h (revision 4960:a4746a82a247)
1*4960Swillf /*
2*4960Swillf  * Copyright (c) 1997-2000 by Sun Microsystems, Inc.
3*4960Swillf  * All rights reserved.
4*4960Swillf  */
5*4960Swillf 
6*4960Swillf #ifndef _KRB5_BTREE_H
7*4960Swillf #define	_KRB5_BTREE_H
8*4960Swillf 
9*4960Swillf #pragma ident	"%Z%%M%	%I%	%E% SMI"
10*4960Swillf 
11*4960Swillf #ifdef	__cplusplus
12*4960Swillf extern "C" {
13*4960Swillf #endif
14*4960Swillf 
15*4960Swillf 
16*4960Swillf /*-
17*4960Swillf  * Copyright (c) 1991, 1993, 1994
18*4960Swillf  *	The Regents of the University of California.  All rights reserved.
19*4960Swillf  *
20*4960Swillf  * This code is derived from software contributed to Berkeley by
21*4960Swillf  * Mike Olson.
22*4960Swillf  *
23*4960Swillf  * Redistribution and use in source and binary forms, with or without
24*4960Swillf  * modification, are permitted provided that the following conditions
25*4960Swillf  * are met:
26*4960Swillf  * 1. Redistributions of source code must retain the above copyright
27*4960Swillf  *    notice, this list of conditions and the following disclaimer.
28*4960Swillf  * 2. Redistributions in binary form must reproduce the above copyright
29*4960Swillf  *    notice, this list of conditions and the following disclaimer in the
30*4960Swillf  *    documentation and/or other materials provided with the distribution.
31*4960Swillf  * 3. All advertising materials mentioning features or use of this software
32*4960Swillf  *    must display the following acknowledgement:
33*4960Swillf  *	This product includes software developed by the University of
34*4960Swillf  *	California, Berkeley and its contributors.
35*4960Swillf  * 4. Neither the name of the University nor the names of its contributors
36*4960Swillf  *    may be used to endorse or promote products derived from this software
37*4960Swillf  *    without specific prior written permission.
38*4960Swillf  *
39*4960Swillf  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
40*4960Swillf  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41*4960Swillf  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
42*4960Swillf  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
43*4960Swillf  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
44*4960Swillf  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
45*4960Swillf  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46*4960Swillf  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
47*4960Swillf  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
48*4960Swillf  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
49*4960Swillf  * SUCH DAMAGE.
50*4960Swillf  *
51*4960Swillf  *	@(#)btree.h	8.11 (Berkeley) 8/17/94
52*4960Swillf  */
53*4960Swillf 
54*4960Swillf /* Macros to set/clear/test flags. */
55*4960Swillf #define	F_SET(p, f)	(p)->flags |= (f)
56*4960Swillf #define	F_CLR(p, f)	(p)->flags &= ~(f)
57*4960Swillf #define	F_ISSET(p, f)	((p)->flags & (f))
58*4960Swillf 
59*4960Swillf #include "mpool.h"
60*4960Swillf 
61*4960Swillf #define	DEFMINKEYPAGE	(2)		/* Minimum keys per page */
62*4960Swillf #define	MINCACHE	(5)		/* Minimum cached pages */
63*4960Swillf #define	MINPSIZE	(512)		/* Minimum page size */
64*4960Swillf 
65*4960Swillf /*
66*4960Swillf  * Page 0 of a btree file contains a copy of the meta-data.  This page is also
67*4960Swillf  * used as an out-of-band page, i.e. page pointers that point to nowhere point
68*4960Swillf  * to page 0.  Page 1 is the root of the btree.
69*4960Swillf  */
70*4960Swillf #define	P_INVALID	 0		/* Invalid tree page number. */
71*4960Swillf #define	P_META		 0		/* Tree metadata page number. */
72*4960Swillf #define	P_ROOT		 1		/* Tree root page number. */
73*4960Swillf 
74*4960Swillf /*
75*4960Swillf  * There are five page layouts in the btree: btree internal pages (BINTERNAL),
76*4960Swillf  * btree leaf pages (BLEAF), recno internal pages (RINTERNAL), recno leaf pages
77*4960Swillf  * (RLEAF) and overflow pages.  All five page types have a page header (PAGE).
78*4960Swillf  * This implementation requires that values within structures NOT be padded.
79*4960Swillf  * (ANSI C permits random padding.)  If your compiler pads randomly you'll have
80*4960Swillf  * to do some work to get this package to run.
81*4960Swillf  */
82*4960Swillf typedef struct _page {
83*4960Swillf 	db_pgno_t	pgno;			/* this page's page number */
84*4960Swillf 	db_pgno_t	prevpg;			/* left sibling */
85*4960Swillf 	db_pgno_t	nextpg;			/* right sibling */
86*4960Swillf 
87*4960Swillf #define	P_BINTERNAL	0x01		/* btree internal page */
88*4960Swillf #define	P_BLEAF		0x02		/* leaf page */
89*4960Swillf #define	P_OVERFLOW	0x04		/* overflow page */
90*4960Swillf #define	P_RINTERNAL	0x08		/* recno internal page */
91*4960Swillf #define	P_RLEAF		0x10		/* leaf page */
92*4960Swillf #define P_TYPE		0x1f		/* type mask */
93*4960Swillf #define	P_PRESERVE	0x20		/* never delete this chain of pages */
94*4960Swillf 	u_int32_t flags;
95*4960Swillf 
96*4960Swillf 	indx_t	lower;			/* lower bound of free space on page */
97*4960Swillf 	indx_t	upper;			/* upper bound of free space on page */
98*4960Swillf 	indx_t	linp[1];		/* indx_t-aligned VAR. LENGTH DATA */
99*4960Swillf } PAGE;
100*4960Swillf 
101*4960Swillf /* First and next index. */
102*4960Swillf #define	BTDATAOFF							\
103*4960Swillf 	(sizeof(db_pgno_t) + sizeof(db_pgno_t) + sizeof(db_pgno_t) +		\
104*4960Swillf 	    sizeof(u_int32_t) + sizeof(indx_t) + sizeof(indx_t))
105*4960Swillf #define	NEXTINDEX(p)	(((p)->lower - BTDATAOFF) / sizeof(indx_t))
106*4960Swillf 
107*4960Swillf /*
108*4960Swillf  * For pages other than overflow pages, there is an array of offsets into the
109*4960Swillf  * rest of the page immediately following the page header.  Each offset is to
110*4960Swillf  * an item which is unique to the type of page.  The h_lower offset is just
111*4960Swillf  * past the last filled-in index.  The h_upper offset is the first item on the
112*4960Swillf  * page.  Offsets are from the beginning of the page.
113*4960Swillf  *
114*4960Swillf  * If an item is too big to store on a single page, a flag is set and the item
115*4960Swillf  * is a { page, size } pair such that the page is the first page of an overflow
116*4960Swillf  * chain with size bytes of item.  Overflow pages are simply bytes without any
117*4960Swillf  * external structure.
118*4960Swillf  *
119*4960Swillf  * The page number and size fields in the items are db_pgno_t-aligned so they can
120*4960Swillf  * be manipulated without copying.  (This presumes that 32 bit items can be
121*4960Swillf  * manipulated on this system.)
122*4960Swillf  */
123*4960Swillf #define	LALIGN(n)	(((n) + sizeof(db_pgno_t) - 1) & ~(sizeof(db_pgno_t) - 1))
124*4960Swillf #define	NOVFLSIZE	(sizeof(db_pgno_t) + sizeof(u_int32_t))
125*4960Swillf 
126*4960Swillf /*
127*4960Swillf  * For the btree internal pages, the item is a key.  BINTERNALs are {key, pgno}
128*4960Swillf  * pairs, such that the key compares less than or equal to all of the records
129*4960Swillf  * on that page.  For a tree without duplicate keys, an internal page with two
130*4960Swillf  * consecutive keys, a and b, will have all records greater than or equal to a
131*4960Swillf  * and less than b stored on the page associated with a.  Duplicate keys are
132*4960Swillf  * somewhat special and can cause duplicate internal and leaf page records and
133*4960Swillf  * some minor modifications of the above rule.
134*4960Swillf  */
135*4960Swillf typedef struct _binternal {
136*4960Swillf 	u_int32_t ksize;		/* key size */
137*4960Swillf 	db_pgno_t	pgno;			/* page number stored on */
138*4960Swillf #define	P_BIGDATA	0x01		/* overflow data */
139*4960Swillf #define	P_BIGKEY	0x02		/* overflow key */
140*4960Swillf 	u_char	flags;
141*4960Swillf 	char	bytes[1];		/* data */
142*4960Swillf } BINTERNAL;
143*4960Swillf 
144*4960Swillf /* Get the page's BINTERNAL structure at index indx. */
145*4960Swillf #define	GETBINTERNAL(pg, indx)						\
146*4960Swillf 	((BINTERNAL *)((char *)(pg) + (pg)->linp[indx]))
147*4960Swillf 
148*4960Swillf /* Get the number of bytes in the entry. */
149*4960Swillf #define NBINTERNAL(len)							\
150*4960Swillf 	LALIGN(sizeof(u_int32_t) + sizeof(db_pgno_t) + sizeof(u_char) + (len))
151*4960Swillf 
152*4960Swillf /* Copy a BINTERNAL entry to the page. */
153*4960Swillf #define	WR_BINTERNAL(p, size, pgno, flags) {				\
154*4960Swillf 	*(u_int32_t *)p = size;						\
155*4960Swillf 	p += sizeof(u_int32_t);						\
156*4960Swillf 	*(db_pgno_t *)p = pgno;						\
157*4960Swillf 	p += sizeof(db_pgno_t);						\
158*4960Swillf 	*(u_char *)p = flags;						\
159*4960Swillf 	p += sizeof(u_char);						\
160*4960Swillf }
161*4960Swillf 
162*4960Swillf /*
163*4960Swillf  * For the recno internal pages, the item is a page number with the number of
164*4960Swillf  * keys found on that page and below.
165*4960Swillf  */
166*4960Swillf typedef struct _rinternal {
167*4960Swillf 	recno_t	nrecs;			/* number of records */
168*4960Swillf 	db_pgno_t	pgno;			/* page number stored below */
169*4960Swillf } RINTERNAL;
170*4960Swillf 
171*4960Swillf /* Get the page's RINTERNAL structure at index indx. */
172*4960Swillf #define	GETRINTERNAL(pg, indx)						\
173*4960Swillf 	((RINTERNAL *)((char *)(pg) + (pg)->linp[indx]))
174*4960Swillf 
175*4960Swillf /* Get the number of bytes in the entry. */
176*4960Swillf #define NRINTERNAL							\
177*4960Swillf 	LALIGN(sizeof(recno_t) + sizeof(db_pgno_t))
178*4960Swillf 
179*4960Swillf /* Copy a RINTERAL entry to the page. */
180*4960Swillf #define	WR_RINTERNAL(p, nrecs, pgno) {					\
181*4960Swillf 	*(recno_t *)p = nrecs;						\
182*4960Swillf 	p += sizeof(recno_t);						\
183*4960Swillf 	*(db_pgno_t *)p = pgno;						\
184*4960Swillf }
185*4960Swillf 
186*4960Swillf /* For the btree leaf pages, the item is a key and data pair. */
187*4960Swillf typedef struct _bleaf {
188*4960Swillf 	u_int32_t	ksize;		/* size of key */
189*4960Swillf 	u_int32_t	dsize;		/* size of data */
190*4960Swillf 	u_char	flags;			/* P_BIGDATA, P_BIGKEY */
191*4960Swillf 	char	bytes[1];		/* data */
192*4960Swillf } BLEAF;
193*4960Swillf 
194*4960Swillf /* Get the page's BLEAF structure at index indx. */
195*4960Swillf #define	GETBLEAF(pg, indx)						\
196*4960Swillf 	((BLEAF *)((char *)(pg) + (pg)->linp[indx]))
197*4960Swillf 
198*4960Swillf /* Get the number of bytes in the entry. */
199*4960Swillf #define NBLEAF(p)	NBLEAFDBT((p)->ksize, (p)->dsize)
200*4960Swillf 
201*4960Swillf /* Get the number of bytes in the user's key/data pair. */
202*4960Swillf #define NBLEAFDBT(ksize, dsize)						\
203*4960Swillf 	LALIGN(sizeof(u_int32_t) + sizeof(u_int32_t) + sizeof(u_char) +	\
204*4960Swillf 	    (ksize) + (dsize))
205*4960Swillf 
206*4960Swillf /* Copy a BLEAF entry to the page. */
207*4960Swillf #define	WR_BLEAF(p, key, data, flags) {					\
208*4960Swillf 	*(u_int32_t *)p = key->size;					\
209*4960Swillf 	p += sizeof(u_int32_t);						\
210*4960Swillf 	*(u_int32_t *)p = data->size;					\
211*4960Swillf 	p += sizeof(u_int32_t);						\
212*4960Swillf 	*(u_char *)p = flags;						\
213*4960Swillf 	p += sizeof(u_char);						\
214*4960Swillf 	memmove(p, key->data, key->size);				\
215*4960Swillf 	p += key->size;							\
216*4960Swillf 	memmove(p, data->data, data->size);				\
217*4960Swillf }
218*4960Swillf 
219*4960Swillf /* For the recno leaf pages, the item is a data entry. */
220*4960Swillf typedef struct _rleaf {
221*4960Swillf 	u_int32_t	dsize;		/* size of data */
222*4960Swillf 	u_char	flags;			/* P_BIGDATA */
223*4960Swillf 	char	bytes[1];
224*4960Swillf } RLEAF;
225*4960Swillf 
226*4960Swillf /* Get the page's RLEAF structure at index indx. */
227*4960Swillf #define	GETRLEAF(pg, indx)						\
228*4960Swillf 	((RLEAF *)((char *)(pg) + (pg)->linp[indx]))
229*4960Swillf 
230*4960Swillf /* Get the number of bytes in the entry. */
231*4960Swillf #define NRLEAF(p)	NRLEAFDBT((p)->dsize)
232*4960Swillf 
233*4960Swillf /* Get the number of bytes from the user's data. */
234*4960Swillf #define	NRLEAFDBT(dsize)						\
235*4960Swillf 	LALIGN(sizeof(u_int32_t) + sizeof(u_char) + (dsize))
236*4960Swillf 
237*4960Swillf /* Copy a RLEAF entry to the page. */
238*4960Swillf #define	WR_RLEAF(p, data, flags) {					\
239*4960Swillf 	*(u_int32_t *)p = data->size;					\
240*4960Swillf 	p += sizeof(u_int32_t);						\
241*4960Swillf 	*(u_char *)p = flags;						\
242*4960Swillf 	p += sizeof(u_char);						\
243*4960Swillf 	memmove(p, data->data, data->size);				\
244*4960Swillf }
245*4960Swillf 
246*4960Swillf /*
247*4960Swillf  * A record in the tree is either a pointer to a page and an index in the page
248*4960Swillf  * or a page number and an index.  These structures are used as a cursor, stack
249*4960Swillf  * entry and search returns as well as to pass records to other routines.
250*4960Swillf  *
251*4960Swillf  * One comment about searches.  Internal page searches must find the largest
252*4960Swillf  * record less than key in the tree so that descents work.  Leaf page searches
253*4960Swillf  * must find the smallest record greater than key so that the returned index
254*4960Swillf  * is the record's correct position for insertion.
255*4960Swillf  */
256*4960Swillf typedef struct _epgno {
257*4960Swillf 	db_pgno_t	pgno;			/* the page number */
258*4960Swillf 	indx_t	index;			/* the index on the page */
259*4960Swillf } EPGNO;
260*4960Swillf 
261*4960Swillf typedef struct _epg {
262*4960Swillf 	PAGE	*page;			/* the (pinned) page */
263*4960Swillf 	indx_t	 index;			/* the index on the page */
264*4960Swillf } EPG;
265*4960Swillf 
266*4960Swillf /*
267*4960Swillf  * About cursors.  The cursor (and the page that contained the key/data pair
268*4960Swillf  * that it referenced) can be deleted, which makes things a bit tricky.  If
269*4960Swillf  * there are no duplicates of the cursor key in the tree (i.e. B_NODUPS is set
270*4960Swillf  * or there simply aren't any duplicates of the key) we copy the key that it
271*4960Swillf  * referenced when it's deleted, and reacquire a new cursor key if the cursor
272*4960Swillf  * is used again.  If there are duplicates keys, we move to the next/previous
273*4960Swillf  * key, and set a flag so that we know what happened.  NOTE: if duplicate (to
274*4960Swillf  * the cursor) keys are added to the tree during this process, it is undefined
275*4960Swillf  * if they will be returned or not in a cursor scan.
276*4960Swillf  *
277*4960Swillf  * The flags determine the possible states of the cursor:
278*4960Swillf  *
279*4960Swillf  * CURS_INIT	The cursor references *something*.
280*4960Swillf  * CURS_ACQUIRE	The cursor was deleted, and a key has been saved so that
281*4960Swillf  *		we can reacquire the right position in the tree.
282*4960Swillf  * CURS_AFTER, CURS_BEFORE
283*4960Swillf  *		The cursor was deleted, and now references a key/data pair
284*4960Swillf  *		that has not yet been returned, either before or after the
285*4960Swillf  *		deleted key/data pair.
286*4960Swillf  * XXX
287*4960Swillf  * This structure is broken out so that we can eventually offer multiple
288*4960Swillf  * cursors as part of the DB interface.
289*4960Swillf  */
290*4960Swillf typedef struct _cursor {
291*4960Swillf 	EPGNO	 pg;			/* B: Saved tree reference. */
292*4960Swillf 	DBT	 key;			/* B: Saved key, or key.data == NULL. */
293*4960Swillf 	recno_t	 rcursor;		/* R: recno cursor (1-based) */
294*4960Swillf 
295*4960Swillf #define	CURS_ACQUIRE	0x01		/*  B: Cursor needs to be reacquired. */
296*4960Swillf #define	CURS_AFTER	0x02		/*  B: Unreturned cursor after key. */
297*4960Swillf #define	CURS_BEFORE	0x04		/*  B: Unreturned cursor before key. */
298*4960Swillf #define	CURS_INIT	0x08		/* RB: Cursor initialized. */
299*4960Swillf 	u_int8_t flags;
300*4960Swillf } CURSOR;
301*4960Swillf 
302*4960Swillf /*
303*4960Swillf  * The metadata of the tree.  The nrecs field is used only by the RECNO code.
304*4960Swillf  * This is because the btree doesn't really need it and it requires that every
305*4960Swillf  * put or delete call modify the metadata.
306*4960Swillf  */
307*4960Swillf typedef struct _btmeta {
308*4960Swillf 	u_int32_t	magic;		/* magic number */
309*4960Swillf 	u_int32_t	version;	/* version */
310*4960Swillf 	u_int32_t	psize;		/* page size */
311*4960Swillf 	u_int32_t	free;		/* page number of first free page */
312*4960Swillf 	u_int32_t	nrecs;		/* R: number of records */
313*4960Swillf 
314*4960Swillf #define	SAVEMETA	(B_NODUPS | R_RECNO)
315*4960Swillf 	u_int32_t	flags;		/* bt_flags & SAVEMETA */
316*4960Swillf } BTMETA;
317*4960Swillf 
318*4960Swillf /* The in-memory btree/recno data structure. */
319*4960Swillf typedef struct _btree {
320*4960Swillf 	MPOOL	 *bt_mp;		/* memory pool cookie */
321*4960Swillf 
322*4960Swillf 	DB	 *bt_dbp;		/* pointer to enclosing DB */
323*4960Swillf 
324*4960Swillf 	EPG	  bt_cur;		/* current (pinned) page */
325*4960Swillf 	PAGE	 *bt_pinned;		/* page pinned across calls */
326*4960Swillf 
327*4960Swillf 	CURSOR	  bt_cursor;		/* cursor */
328*4960Swillf 
329*4960Swillf #define	BT_PUSH(t, p, i) {						\
330*4960Swillf 	t->bt_sp->pgno = p; 						\
331*4960Swillf 	t->bt_sp->index = i; 						\
332*4960Swillf 	++t->bt_sp;							\
333*4960Swillf }
334*4960Swillf #define	BT_POP(t)	(t->bt_sp == t->bt_stack ? NULL : --t->bt_sp)
335*4960Swillf #define	BT_CLR(t)	(t->bt_sp = t->bt_stack)
336*4960Swillf 	EPGNO	  bt_stack[50];		/* stack of parent pages */
337*4960Swillf 	EPGNO	 *bt_sp;		/* current stack pointer */
338*4960Swillf 
339*4960Swillf 	DBT	  bt_rkey;		/* returned key */
340*4960Swillf 	DBT	  bt_rdata;		/* returned data */
341*4960Swillf 
342*4960Swillf 	int	  bt_fd;		/* tree file descriptor */
343*4960Swillf 
344*4960Swillf 	db_pgno_t	  bt_free;		/* next free page */
345*4960Swillf 	u_int32_t bt_psize;		/* page size */
346*4960Swillf 	indx_t	  bt_ovflsize;		/* cut-off for key/data overflow */
347*4960Swillf 	int	  bt_lorder;		/* byte order */
348*4960Swillf 					/* sorted order */
349*4960Swillf 	enum { NOT, BACK, FORWARD } bt_order;
350*4960Swillf 	EPGNO	  bt_last;		/* last insert */
351*4960Swillf 
352*4960Swillf 					/* B: key comparison function */
353*4960Swillf 	int	(*bt_cmp) __P((const DBT *, const DBT *));
354*4960Swillf 					/* B: prefix comparison function */
355*4960Swillf 	size_t	(*bt_pfx) __P((const DBT *, const DBT *));
356*4960Swillf 					/* R: recno input function */
357*4960Swillf 	int	(*bt_irec) __P((struct _btree *, recno_t));
358*4960Swillf 
359*4960Swillf 	FILE	 *bt_rfp;		/* R: record FILE pointer */
360*4960Swillf 	int	  bt_rfd;		/* R: record file descriptor */
361*4960Swillf 
362*4960Swillf 	caddr_t	  bt_cmap;		/* R: current point in mapped space */
363*4960Swillf 	caddr_t	  bt_smap;		/* R: start of mapped space */
364*4960Swillf 	caddr_t   bt_emap;		/* R: end of mapped space */
365*4960Swillf 	size_t	  bt_msize;		/* R: size of mapped region. */
366*4960Swillf 
367*4960Swillf 	recno_t	  bt_nrecs;		/* R: number of records */
368*4960Swillf 	size_t	  bt_reclen;		/* R: fixed record length */
369*4960Swillf 	u_char	  bt_bval;		/* R: delimiting byte/pad character */
370*4960Swillf 
371*4960Swillf /*
372*4960Swillf  * NB:
373*4960Swillf  * B_NODUPS and R_RECNO are stored on disk, and may not be changed.
374*4960Swillf  */
375*4960Swillf #define	B_INMEM		0x00001		/* in-memory tree */
376*4960Swillf #define	B_METADIRTY	0x00002		/* need to write metadata */
377*4960Swillf #define	B_MODIFIED	0x00004		/* tree modified */
378*4960Swillf #define	B_NEEDSWAP	0x00008		/* if byte order requires swapping */
379*4960Swillf #define	B_RDONLY	0x00010		/* read-only tree */
380*4960Swillf 
381*4960Swillf #define	B_NODUPS	0x00020		/* no duplicate keys permitted */
382*4960Swillf #define	R_RECNO		0x00080		/* record oriented tree */
383*4960Swillf 
384*4960Swillf #define	R_CLOSEFP	0x00040		/* opened a file pointer */
385*4960Swillf #define	R_EOF		0x00100		/* end of input file reached. */
386*4960Swillf #define	R_FIXLEN	0x00200		/* fixed length records */
387*4960Swillf #define	R_MEMMAPPED	0x00400		/* memory mapped file. */
388*4960Swillf #define	R_INMEM		0x00800		/* in-memory file */
389*4960Swillf #define	R_MODIFIED	0x01000		/* modified file */
390*4960Swillf #define	R_RDONLY	0x02000		/* read-only file */
391*4960Swillf 
392*4960Swillf #define	B_DB_LOCK	0x04000		/* DB_LOCK specified. */
393*4960Swillf #define	B_DB_SHMEM	0x08000		/* DB_SHMEM specified. */
394*4960Swillf #define	B_DB_TXN	0x10000		/* DB_TXN specified. */
395*4960Swillf 	u_int32_t flags;
396*4960Swillf } BTREE;
397*4960Swillf 
398*4960Swillf #include "extern.h"
399*4960Swillf 
400*4960Swillf #ifdef	__cplusplus
401*4960Swillf }
402*4960Swillf #endif
403*4960Swillf 
404*4960Swillf #endif	/* !_KRB5_BTREE_H */
405