Module Name:    src
Committed By:   christos
Date:           Sat Sep 24 20:11:43 UTC 2016

Modified Files:
        src/include: db.h mpool.h

Log Message:
sync with mit/kerberos db


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/include/db.h
cvs rdiff -u -r1.14 -r1.15 src/include/mpool.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/include/db.h
diff -u src/include/db.h:1.26 src/include/db.h:1.27
--- src/include/db.h:1.26	Sat Nov 30 19:23:11 2013
+++ src/include/db.h	Sat Sep 24 16:11:43 2016
@@ -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;
 
 /*

Index: src/include/mpool.h
diff -u src/include/mpool.h:1.14 src/include/mpool.h:1.15
--- src/include/mpool.h:1.14	Fri Nov 22 11:25:01 2013
+++ src/include/mpool.h	Sat Sep 24 16:11:43 2016
@@ -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 *);

Reply via email to