Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/include sync with mit/kerberos db



details:   https://anonhg.NetBSD.org/src/rev/235dd8298795
branches:  trunk
changeset: 347940:235dd8298795
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Sep 24 20:11:43 2016 +0000

description:
sync with mit/kerberos db

diffstat:

 include/db.h    |  19 ++++++++++++++++++-
 include/mpool.h |  16 ++++++++++++++--
 2 files changed, 32 insertions(+), 3 deletions(-)

diffs (75 lines):

diff -r d19220e3bc41 -r 235dd8298795 include/db.h
--- a/include/db.h      Sat Sep 24 20:11:12 2016 +0000
+++ b/include/db.h      Sat Sep 24 20:11:43 2016 +0000
@@ -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 @@
 #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;
 
 /*
diff -r d19220e3bc41 -r 235dd8298795 include/mpool.h
--- a/include/mpool.h   Sat Sep 24 20:11:12 2016 +0000
+++ b/include/mpool.h   Sat Sep 24 20:11:43 2016 +0000
@@ -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 @@
 
 #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 @@
 #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 *);



Home | Main Index | Thread Index | Old Index