summaryrefslogtreecommitdiff
path: root/lib/libc/db/btree
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/db/btree')
-rw-r--r--lib/libc/db/btree/bt_close.c8
-rw-r--r--lib/libc/db/btree/bt_conv.c8
-rw-r--r--lib/libc/db/btree/bt_debug.c26
-rw-r--r--lib/libc/db/btree/bt_delete.c8
-rw-r--r--lib/libc/db/btree/bt_get.c8
-rw-r--r--lib/libc/db/btree/bt_open.c25
-rw-r--r--lib/libc/db/btree/bt_overflow.c8
-rw-r--r--lib/libc/db/btree/bt_page.c10
-rw-r--r--lib/libc/db/btree/bt_put.c8
-rw-r--r--lib/libc/db/btree/bt_search.c8
-rw-r--r--lib/libc/db/btree/bt_seq.c8
-rw-r--r--lib/libc/db/btree/bt_split.c8
-rw-r--r--lib/libc/db/btree/bt_utils.c8
-rw-r--r--lib/libc/db/btree/btree.h4
-rw-r--r--lib/libc/db/btree/extern.h4
15 files changed, 116 insertions, 33 deletions
diff --git a/lib/libc/db/btree/bt_close.c b/lib/libc/db/btree/bt_close.c
index 3153f308ac3..492155b0efc 100644
--- a/lib/libc/db/btree/bt_close.c
+++ b/lib/libc/db/btree/bt_close.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: bt_close.c,v 1.4 1999/02/15 05:11:22 millert Exp $ */
+
/*-
* Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -35,7 +37,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: bt_close.c,v 1.3 1996/08/19 08:20:01 tholo Exp $";
+#if 0
+static char sccsid[] = "@(#)bt_close.c 8.7 (Berkeley) 8/17/94";
+#else
+static char rcsid[] = "$OpenBSD: bt_close.c,v 1.4 1999/02/15 05:11:22 millert Exp $";
+#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
diff --git a/lib/libc/db/btree/bt_conv.c b/lib/libc/db/btree/bt_conv.c
index eaf1032efa2..7272a69278e 100644
--- a/lib/libc/db/btree/bt_conv.c
+++ b/lib/libc/db/btree/bt_conv.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: bt_conv.c,v 1.4 1999/02/15 05:11:22 millert Exp $ */
+
/*-
* Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -35,7 +37,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: bt_conv.c,v 1.3 1996/08/19 08:20:03 tholo Exp $";
+#if 0
+static char sccsid[] = "@(#)bt_conv.c 8.5 (Berkeley) 8/17/94";
+#else
+static char rcsid[] = "$OpenBSD: bt_conv.c,v 1.4 1999/02/15 05:11:22 millert Exp $";
+#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
diff --git a/lib/libc/db/btree/bt_debug.c b/lib/libc/db/btree/bt_debug.c
index 6d424e9fa5a..d09bb9e93c5 100644
--- a/lib/libc/db/btree/bt_debug.c
+++ b/lib/libc/db/btree/bt_debug.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: bt_debug.c,v 1.4 1999/02/15 05:11:22 millert Exp $ */
+
/*-
* Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -35,7 +37,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: bt_debug.c,v 1.3 1996/08/19 08:20:04 tholo Exp $";
+#if 0
+static char sccsid[] = "@(#)bt_debug.c 8.5 (Berkeley) 8/17/94";
+#else
+static char rcsid[] = "$OpenBSD: bt_debug.c,v 1.4 1999/02/15 05:11:22 millert Exp $";
+#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -86,10 +92,9 @@ __bt_dump(dbp)
}
#undef X
- for (i = P_ROOT; (h = mpool_get(t->bt_mp, i, 0)) != NULL; ++i) {
+ for (i = P_ROOT;
+ (h = mpool_get(t->bt_mp, i, MPOOL_IGNOREPIN)) != NULL; ++i)
__bt_dpage(h);
- (void)mpool_put(t->bt_mp, h, 0);
- }
}
/*
@@ -141,10 +146,8 @@ __bt_dnpage(dbp, pgno)
PAGE *h;
t = dbp->internal;
- if ((h = mpool_get(t->bt_mp, pgno, 0)) != NULL) {
+ if ((h = mpool_get(t->bt_mp, pgno, MPOOL_IGNOREPIN)) != NULL)
__bt_dpage(h);
- (void)mpool_put(t->bt_mp, h, 0);
- }
}
/*
@@ -264,7 +267,8 @@ __bt_stat(dbp)
t = dbp->internal;
pcont = pinternal = pleaf = 0;
nkeys = ifree = lfree = 0;
- for (i = P_ROOT; (h = mpool_get(t->bt_mp, i, 0)) != NULL; ++i) {
+ for (i = P_ROOT;
+ (h = mpool_get(t->bt_mp, i, MPOOL_IGNOREPIN)) != NULL; ++i)
switch (h->flags & P_TYPE) {
case P_BINTERNAL:
case P_RINTERNAL:
@@ -281,22 +285,18 @@ __bt_stat(dbp)
++pcont;
break;
}
- (void)mpool_put(t->bt_mp, h, 0);
- }
/* Count the levels of the tree. */
for (i = P_ROOT, levels = 0 ;; ++levels) {
- h = mpool_get(t->bt_mp, i, 0);
+ h = mpool_get(t->bt_mp, i, MPOOL_IGNOREPIN);
if (h->flags & (P_BLEAF|P_RLEAF)) {
if (levels == 0)
levels = 1;
- (void)mpool_put(t->bt_mp, h, 0);
break;
}
i = F_ISSET(t, R_RECNO) ?
GETRINTERNAL(h, 0)->pgno :
GETBINTERNAL(h, 0)->pgno;
- (void)mpool_put(t->bt_mp, h, 0);
}
(void)fprintf(stderr, "%d level%s with %ld keys",
diff --git a/lib/libc/db/btree/bt_delete.c b/lib/libc/db/btree/bt_delete.c
index cc8c175d5fe..a000bdba5e0 100644
--- a/lib/libc/db/btree/bt_delete.c
+++ b/lib/libc/db/btree/bt_delete.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: bt_delete.c,v 1.5 1999/02/15 05:11:22 millert Exp $ */
+
/*-
* Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -35,7 +37,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: bt_delete.c,v 1.4 1998/03/19 00:29:51 millert Exp $";
+#if 0
+static char sccsid[] = "@(#)bt_delete.c 8.13 (Berkeley) 7/28/94";
+#else
+static char rcsid[] = "$OpenBSD: bt_delete.c,v 1.5 1999/02/15 05:11:22 millert Exp $";
+#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
diff --git a/lib/libc/db/btree/bt_get.c b/lib/libc/db/btree/bt_get.c
index b6d4bf1e580..0f8e99680a4 100644
--- a/lib/libc/db/btree/bt_get.c
+++ b/lib/libc/db/btree/bt_get.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: bt_get.c,v 1.4 1999/02/15 05:11:22 millert Exp $ */
+
/*-
* Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -35,7 +37,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: bt_get.c,v 1.3 1996/08/19 08:20:06 tholo Exp $";
+#if 0
+static char sccsid[] = "@(#)bt_get.c 8.6 (Berkeley) 7/20/94";
+#else
+static char rcsid[] = "$OpenBSD: bt_get.c,v 1.4 1999/02/15 05:11:22 millert Exp $";
+#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
diff --git a/lib/libc/db/btree/bt_open.c b/lib/libc/db/btree/bt_open.c
index 7fb01943bb1..62a62803d30 100644
--- a/lib/libc/db/btree/bt_open.c
+++ b/lib/libc/db/btree/bt_open.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: bt_open.c,v 1.6 1999/02/15 05:11:22 millert Exp $ */
+
/*-
* Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -35,7 +37,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: bt_open.c,v 1.5 1997/07/23 21:00:25 kstailey Exp $";
+#if 0
+static char sccsid[] = "@(#)bt_open.c 8.11 (Berkeley) 11/2/95";
+#else
+static char rcsid[] = "$OpenBSD: bt_open.c,v 1.6 1999/02/15 05:11:22 millert Exp $";
+#endif
#endif /* LIBC_SCCS and not lint */
/*
@@ -356,18 +362,25 @@ nroot(t)
PAGE *meta, *root;
pgno_t npg;
- if ((meta = mpool_get(t->bt_mp, 0, 0)) != NULL) {
- mpool_put(t->bt_mp, meta, 0);
- return (RET_SUCCESS);
+ if ((root = mpool_get(t->bt_mp, 1, 0)) != NULL) {
+ if (root->lower == 0 &&
+ root->pgno == 0 &&
+ root->linp[0] == 0) {
+ mpool_delete(t->bt_mp, root);
+ errno = EINVAL;
+ } else {
+ mpool_put(t->bt_mp, root, 0);
+ return (RET_SUCCESS);
+ }
}
if (errno != EINVAL) /* It's OK to not exist. */
return (RET_ERROR);
errno = 0;
- if ((meta = mpool_new(t->bt_mp, &npg)) == NULL)
+ if ((meta = mpool_new(t->bt_mp, &npg, MPOOL_PAGE_NEXT)) == NULL)
return (RET_ERROR);
- if ((root = mpool_new(t->bt_mp, &npg)) == NULL)
+ if ((root = mpool_new(t->bt_mp, &npg, MPOOL_PAGE_NEXT)) == NULL)
return (RET_ERROR);
if (npg != P_ROOT)
diff --git a/lib/libc/db/btree/bt_overflow.c b/lib/libc/db/btree/bt_overflow.c
index 23876f1d6fe..1faaa79a503 100644
--- a/lib/libc/db/btree/bt_overflow.c
+++ b/lib/libc/db/btree/bt_overflow.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: bt_overflow.c,v 1.5 1999/02/15 05:11:23 millert Exp $ */
+
/*-
* Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -35,7 +37,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: bt_overflow.c,v 1.4 1998/08/14 21:39:18 deraadt Exp $";
+#if 0
+static char sccsid[] = "@(#)bt_overflow.c 8.5 (Berkeley) 7/16/94";
+#else
+static char rcsid[] = "$OpenBSD: bt_overflow.c,v 1.5 1999/02/15 05:11:23 millert Exp $";
+#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
diff --git a/lib/libc/db/btree/bt_page.c b/lib/libc/db/btree/bt_page.c
index 2552ef2d1fe..e9f7996126e 100644
--- a/lib/libc/db/btree/bt_page.c
+++ b/lib/libc/db/btree/bt_page.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: bt_page.c,v 1.5 1999/02/15 05:11:23 millert Exp $ */
+
/*-
* Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -32,7 +34,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: bt_page.c,v 1.4 1997/11/13 06:35:06 deraadt Exp $";
+#if 0
+static char sccsid[] = "@(#)bt_page.c 8.3 (Berkeley) 7/14/94";
+#else
+static char rcsid[] = "$OpenBSD: bt_page.c,v 1.5 1999/02/15 05:11:23 millert Exp $";
+#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -96,5 +102,5 @@ __bt_new(t, npg)
F_SET(t, B_METADIRTY);
return (h);
}
- return (mpool_new(t->bt_mp, npg));
+ return (mpool_new(t->bt_mp, npg, MPOOL_PAGE_NEXT));
}
diff --git a/lib/libc/db/btree/bt_put.c b/lib/libc/db/btree/bt_put.c
index 3304ccdb5c5..91535e1fa0d 100644
--- a/lib/libc/db/btree/bt_put.c
+++ b/lib/libc/db/btree/bt_put.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: bt_put.c,v 1.6 1999/02/15 05:11:23 millert Exp $ */
+
/*-
* Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -35,7 +37,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: bt_put.c,v 1.5 1998/03/19 00:29:53 millert Exp $";
+#if 0
+static char sccsid[] = "@(#)bt_put.c 8.8 (Berkeley) 7/26/94";
+#else
+static char rcsid[] = "$OpenBSD: bt_put.c,v 1.6 1999/02/15 05:11:23 millert Exp $";
+#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
diff --git a/lib/libc/db/btree/bt_search.c b/lib/libc/db/btree/bt_search.c
index 8bf43da0c93..b1d6ee75294 100644
--- a/lib/libc/db/btree/bt_search.c
+++ b/lib/libc/db/btree/bt_search.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: bt_search.c,v 1.4 1999/02/15 05:11:23 millert Exp $ */
+
/*-
* Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -35,7 +37,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: bt_search.c,v 1.3 1996/08/19 08:20:13 tholo Exp $";
+#if 0
+static char sccsid[] = "@(#)bt_search.c 8.8 (Berkeley) 7/31/94";
+#else
+static char rcsid[] = "$OpenBSD: bt_search.c,v 1.4 1999/02/15 05:11:23 millert Exp $";
+#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
diff --git a/lib/libc/db/btree/bt_seq.c b/lib/libc/db/btree/bt_seq.c
index c30e8eda889..17cfef69432 100644
--- a/lib/libc/db/btree/bt_seq.c
+++ b/lib/libc/db/btree/bt_seq.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: bt_seq.c,v 1.4 1999/02/15 05:11:23 millert Exp $ */
+
/*-
* Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -35,7 +37,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: bt_seq.c,v 1.3 1996/08/19 08:20:14 tholo Exp $";
+#if 0
+static char sccsid[] = "@(#)bt_seq.c 8.7 (Berkeley) 7/20/94";
+#else
+static char rcsid[] = "$OpenBSD: bt_seq.c,v 1.4 1999/02/15 05:11:23 millert Exp $";
+#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
diff --git a/lib/libc/db/btree/bt_split.c b/lib/libc/db/btree/bt_split.c
index 240af9349a1..43cd217af6a 100644
--- a/lib/libc/db/btree/bt_split.c
+++ b/lib/libc/db/btree/bt_split.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: bt_split.c,v 1.6 1999/02/15 05:11:23 millert Exp $ */
+
/*-
* Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -35,7 +37,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: bt_split.c,v 1.5 1998/08/28 20:49:07 deraadt Exp $";
+#if 0
+static char rcsid[] = "$OpenBSD: bt_split.c,v 1.6 1999/02/15 05:11:23 millert Exp $";
+#else
+static char sccsid[] = "@(#)bt_split.c 8.10 (Berkeley) 1/9/95";
+#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
diff --git a/lib/libc/db/btree/bt_utils.c b/lib/libc/db/btree/bt_utils.c
index 2ec3fcd8878..093901f5e5f 100644
--- a/lib/libc/db/btree/bt_utils.c
+++ b/lib/libc/db/btree/bt_utils.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: bt_utils.c,v 1.4 1999/02/15 05:11:23 millert Exp $ */
+
/*-
* Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -35,7 +37,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: bt_utils.c,v 1.3 1996/08/19 08:20:17 tholo Exp $";
+#if 0
+static char sccsid[] = "@(#)bt_utils.c 8.8 (Berkeley) 7/20/94";
+#else
+static char rcsid[] = "$OpenBSD: bt_utils.c,v 1.4 1999/02/15 05:11:23 millert Exp $";
+#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
diff --git a/lib/libc/db/btree/btree.h b/lib/libc/db/btree/btree.h
index 09021e6a564..5baeea5d9ea 100644
--- a/lib/libc/db/btree/btree.h
+++ b/lib/libc/db/btree/btree.h
@@ -1,3 +1,5 @@
+/* $OpenBSD: btree.h,v 1.4 1999/02/15 05:11:23 millert Exp $ */
+
/*-
* Copyright (c) 1991, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -33,7 +35,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: btree.h,v 1.3 1996/08/19 08:20:19 tholo Exp $
+ * @(#)btree.h 8.11 (Berkeley) 8/17/94
*/
/* Macros to set/clear/test flags. */
diff --git a/lib/libc/db/btree/extern.h b/lib/libc/db/btree/extern.h
index f83b1f39467..2abb91dabc7 100644
--- a/lib/libc/db/btree/extern.h
+++ b/lib/libc/db/btree/extern.h
@@ -1,3 +1,5 @@
+/* $OpenBSD: extern.h,v 1.4 1999/02/15 05:11:23 millert Exp $ */
+
/*-
* Copyright (c) 1991, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -30,7 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: extern.h,v 1.3 1996/08/19 08:20:21 tholo Exp $
+ * @(#)extern.h 8.10 (Berkeley) 7/20/94
*/
int __bt_close __P((DB *));