sync with mit/kerberos db

This commit is contained in:
christos 2016-09-24 20:11:43 +00:00
parent 86147b1c32
commit 0ac50079c4
2 changed files with 32 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: db.h,v 1.26 2013/12/01 00:23:11 christos Exp $ */
/* $NetBSD: db.h,v 1.27 2016/09/24 20:11:43 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -69,6 +69,23 @@ typedef struct {
#define R_SETCURSOR 10 /* put (RECNO) */
#define R_RECNOSYNC 11 /* sync (RECNO) */
/*
* Recursive sequential scan.
*
* This avoids using sibling pointers, permitting (possibly partial)
* recovery from some kinds of btree corruption. Start a sequential
* scan as usual, but use R_RNEXT or R_RPREV to move forward or
* backward.
*
* This probably doesn't work with btrees that allow duplicate keys.
* Database modifications during the scan can also modify the parent
* page stack needed for correct functioning. Intermixing
* non-recursive traversal by using R_NEXT or R_PREV can also make the
* page stack inconsistent with the cursor and cause problems.
*/
#define R_RNEXT 128 /* seq (BTREE, RECNO) */
#define R_RPREV 129 /* seq (BTREE, RECNO) */
typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE;
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: mpool.h,v 1.14 2013/11/22 16:25:01 christos Exp $ */
/* $NetBSD: mpool.h,v 1.15 2016/09/24 20:11:43 christos Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -56,6 +56,7 @@ typedef struct _bkt {
#define MPOOL_DIRTY 0x01 /* page needs to be written */
#define MPOOL_PINNED 0x02 /* page is pinned into memory */
#define MPOOL_INUSE 0x04 /* page address is valid */
uint8_t flags; /* flags */
} BKT;
@ -86,12 +87,23 @@ typedef struct MPOOL {
#endif
} MPOOL;
/* flags for get/put */
#define MPOOL_IGNOREPIN 0x01 /* Ignore if the page is pinned. */
/* flags for newf */
#define MPOOL_PAGE_REQUEST 0x01 /* Allocate a new page with a
specific page number. */
#define MPOOL_PAGE_NEXT 0x02 /* Allocate a new page with the next
page number. */
__BEGIN_DECLS
MPOOL *mpool_open(void *, int, pgno_t, pgno_t);
void mpool_filter(MPOOL *, void (*)(void *, pgno_t, void *),
void (*)(void *, pgno_t, void *), void *);
void *mpool_new(MPOOL *, pgno_t *);
void *mpool_get(MPOOL *, pgno_t, unsigned int);
void *mpool_newf(MPOOL *, pgno_t *, unsigned int);
int mpool_delete(MPOOL *, void *);
void *mpool_get(MPOOL *, pgno_t);
void *mpool_getf(MPOOL *, pgno_t, unsigned int);
int mpool_put(MPOOL *, void *, unsigned int);
int mpool_sync(MPOOL *);
int mpool_close(MPOOL *);