xref: /openbsd/regress/usr.bin/grep/t14.in (revision 76d0caae)
1typedef u_int32_t	recno_t;
2
3/* Key/data structure -- a Data-Base Thang. */
4typedef struct {
5	void	*data;			/* data */
6	size_t	 size;			/* data length */
7} DBT;
8
9/* Routine flags. */
10#define	R_CURSOR	1		/* del, put, seq */
11#define	__R_UNUSED	2		/* UNUSED */
12#define	R_FIRST		3		/* seq */
13#define	R_IAFTER	4		/* put (RECNO) */
14#define	R_IBEFORE	5		/* put (RECNO) */
15#define	R_LAST		6		/* seq (BTREE, RECNO) */
16#define	R_NEXT		7		/* seq */
17#define	R_NOOVERWRITE	8		/* put */
18#define	R_PREV		9		/* seq (BTREE, RECNO) */
19#define	R_SETCURSOR	10		/* put (RECNO) */
20#define	R_RECNOSYNC	11		/* sync (RECNO) */
21
22typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE;
23
24/*
25 * !!!
26 * The following flags are included in the dbopen(3) call as part of the
27 * open(2) flags.  In order to avoid conflicts with the open flags, start
28 * at the top of the 16 or 32-bit number space and work our way down.  If
29 * the open flags were significantly expanded in the future, it could be
30 * a problem.  Wish I'd left another flags word in the dbopen call.
31 *
32 * !!!
33 * None of this stuff is implemented yet.  The only reason that it's here
34 * is so that the access methods can skip copying the key/data pair when
35 * the DB_LOCK flag isn't set.
36 */
37#if UINT_MAX > 65535
38#define	DB_LOCK		0x20000000	/* Do locking. */
39#define	DB_SHMEM	0x40000000	/* Use shared memory. */
40#define	DB_TXN		0x80000000	/* Do transactions. */
41#else
42#define	DB_LOCK		    0x2000	/* Do locking. */
43#define	DB_SHMEM	    0x4000	/* Use shared memory. */
44#define	DB_TXN		    0x8000	/* Do transactions. */
45#endif
46
47/* Access method description structure. */
48typedef struct __db {
49	DBTYPE type;			/* Underlying db type. */
50	int (*close)(struct __db *);
51	int (*del)(const struct __db *, const DBT *, u_int);
52