/*-
* Copyright (c) 1990, 1993, 1994, 1995
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Mike Olson.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
*/
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "db-int.h"
#include "btree.h"
#if defined(DEBUG) || defined(STATISTICS)
/*
* __bt_dinit --
* initialize debugging.
*/
static void
{
if (!first)
return;
first = 0;
#ifndef TRACE_TO_STDERR
/* Solaris Kerberos */
return;
#endif
}
#endif
#ifdef DEBUG
/*
* __bt_dump --
* dump the tree
*
* Parameters:
* dbp: pointer to the DB
*/
int
{
BTREE *t;
PAGE *h;
db_pgno_t i;
char *sep;
__bt_dinit();
#undef X
sep = ", "; \
}
if (t->flags != 0) {
sep = " flags (";
X(R_FIXLEN, "FIXLEN");
X(B_INMEM, "INMEM");
X(B_NODUPS, "NODUPS");
X(B_RDONLY, "RDONLY");
X(R_RECNO, "RECNO");
X(B_METADIRTY,"METADIRTY");
}
#undef X
__bt_dpage(dbp, h);
return (0);
}
/*
* BT_DMPAGE -- Dump the meta page
*
* Parameters:
* h: pointer to the PAGE
*/
int
__bt_dmpage(h)
PAGE *h;
{
BTMETA *m;
char *sep;
__bt_dinit();
m = (BTMETA *)h;
#undef X
sep = ", "; \
}
if (m->flags) {
sep = " (";
X(B_NODUPS, "NODUPS");
X(R_RECNO, "RECNO");
}
return (0);
}
/*
* BT_DNPAGE -- Dump the page
*
* Parameters:
* n: page number to dump.
*/
int
{
BTREE *t;
PAGE *h;
__bt_dinit();
__bt_dpage(dbp, h);
return (0);
}
/*
* BT_DPAGE -- Dump the page
*
* Parameters:
* h: pointer to the PAGE
*/
int
PAGE *h;
{
char *sep;
__bt_dinit();
#undef X
sep = ", "; \
}
sep = "";
X(P_BLEAF, "BLEAF")
X(P_RLEAF, "RLEAF")
X(P_OVERFLOW, "OVERFLOW")
X(P_PRESERVE, "PRESERVE");
#undef X
if (h->flags & P_OVERFLOW)
return;
case P_BINTERNAL:
break;
case P_RINTERNAL:
break;
case P_BLEAF:
"big key page %lu size %u/",
"big data page %lu size %u",
sizeof(db_pgno_t)));
break;
case P_RLEAF:
"big data page %lu size %u",
break;
}
}
return (0);
}
#endif
#ifdef STATISTICS
/*
* bt_stat --
*
* Parameters:
* dbp: pointer to the DB
*/
int
{
BTREE *t;
PAGE *h;
int levels;
__bt_dinit();
case P_BINTERNAL:
case P_RINTERNAL:
++pinternal;
break;
case P_BLEAF:
case P_RLEAF:
++pleaf;
break;
case P_OVERFLOW:
++pcont;
break;
}
/* Count the levels of the tree. */
if (levels == 0)
levels = 1;
break;
}
GETRINTERNAL(h, 0)->pgno :
GETBINTERNAL(h, 0)->pgno;
}
"\n%lu pages (leaf %ld, internal %ld, overflow %ld)\n",
"%ld splits (%ld root splits, %ld sort splits)\n",
if (pleaf)
"%.0f%% leaf fill (%ld bytes used, %ld bytes free)\n",
if (pinternal)
"%.0f%% internal fill (%ld bytes used, %ld bytes free\n",
if (bt_pfxsaved)
return (0);
}
#endif