X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/59e0d9fe772464b93d835d2a2964457702469a43..974e388456677d82eb6d10d4fd72390641a5bdfe:/db/btree/FreeBSD/bt_debug.c diff --git a/db/btree/FreeBSD/bt_debug.c b/db/btree/FreeBSD/bt_debug.c index 606ecff..fa0481b 100644 --- a/db/btree/FreeBSD/bt_debug.c +++ b/db/btree/FreeBSD/bt_debug.c @@ -13,10 +13,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 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. @@ -38,7 +34,7 @@ static char sccsid[] = "@(#)bt_debug.c 8.5 (Berkeley) 8/17/94"; #endif /* LIBC_SCCS and not lint */ #include -__FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_debug.c,v 1.2 2002/03/22 21:52:01 obrien Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_debug.c,v 1.6 2009/03/23 23:22:09 delphij Exp $"); #include @@ -57,8 +53,7 @@ __FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_debug.c,v 1.2 2002/03/22 21:52:01 o * dbp: pointer to the DB */ void -__bt_dump(dbp) - DB *dbp; +__bt_dump(DB *dbp) { BTREE *t; PAGE *h; @@ -66,10 +61,10 @@ __bt_dump(dbp) char *sep; t = dbp->internal; - (void)fprintf(stderr, "%s: pgsz %d", + (void)fprintf(stderr, "%s: pgsz %u", F_ISSET(t, B_INMEM) ? "memory" : "disk", t->bt_psize); if (F_ISSET(t, R_RECNO)) - (void)fprintf(stderr, " keys %lu", t->bt_nrecs); + (void)fprintf(stderr, " keys %u", t->bt_nrecs); #undef X #define X(flag, name) \ if (F_ISSET(t, flag)) { \ @@ -101,19 +96,18 @@ __bt_dump(dbp) * h: pointer to the PAGE */ void -__bt_dmpage(h) - PAGE *h; +__bt_dmpage(PAGE *h) { BTMETA *m; char *sep; m = (BTMETA *)h; - (void)fprintf(stderr, "magic %lx\n", m->magic); - (void)fprintf(stderr, "version %lu\n", m->version); - (void)fprintf(stderr, "psize %lu\n", m->psize); - (void)fprintf(stderr, "free %lu\n", m->free); - (void)fprintf(stderr, "nrecs %lu\n", m->nrecs); - (void)fprintf(stderr, "flags %lu", m->flags); + (void)fprintf(stderr, "magic %x\n", m->magic); + (void)fprintf(stderr, "version %u\n", m->version); + (void)fprintf(stderr, "psize %u\n", m->psize); + (void)fprintf(stderr, "free %u\n", m->free); + (void)fprintf(stderr, "nrecs %u\n", m->nrecs); + (void)fprintf(stderr, "flags %u", m->flags); #undef X #define X(flag, name) \ if (m->flags & flag) { \ @@ -135,9 +129,7 @@ __bt_dmpage(h) * n: page number to dump. */ void -__bt_dnpage(dbp, pgno) - DB *dbp; - pgno_t pgno; +__bt_dnpage(DB *dbp, pgno_t pgno) { BTREE *t; PAGE *h; @@ -156,8 +148,7 @@ __bt_dnpage(dbp, pgno) * h: pointer to the PAGE */ void -__bt_dpage(h) - PAGE *h; +__bt_dpage(PAGE *h) { BINTERNAL *bi; BLEAF *bl; @@ -166,7 +157,7 @@ __bt_dpage(h) indx_t cur, top; char *sep; - (void)fprintf(stderr, " page %d: (", h->pgno); + (void)fprintf(stderr, " page %u: (", h->pgno); #undef X #define X(flag, name) \ if (h->flags & flag) { \ @@ -183,7 +174,7 @@ __bt_dpage(h) (void)fprintf(stderr, ")\n"); #undef X - (void)fprintf(stderr, "\tprev %2d next %2d", h->prevpg, h->nextpg); + (void)fprintf(stderr, "\tprev %2u next %2u", h->prevpg, h->nextpg); if (h->flags & P_OVERFLOW) return; @@ -212,14 +203,15 @@ __bt_dpage(h) bl = GETBLEAF(h, cur); if (bl->flags & P_BIGKEY) (void)fprintf(stderr, - "big key page %lu size %u/", + "big key page %u size %u/", *(pgno_t *)bl->bytes, *(u_int32_t *)(bl->bytes + sizeof(pgno_t))); else if (bl->ksize) - (void)fprintf(stderr, "%s/", bl->bytes); + (void)fprintf(stderr, "%.*s/", + bl->ksize, bl->bytes); if (bl->flags & P_BIGDATA) (void)fprintf(stderr, - "big data page %lu size %u", + "big data page %u size %u", *(pgno_t *)(bl->bytes + bl->ksize), *(u_int32_t *)(bl->bytes + bl->ksize + sizeof(pgno_t))); @@ -231,7 +223,7 @@ __bt_dpage(h) rl = GETRLEAF(h, cur); if (rl->flags & P_BIGDATA) (void)fprintf(stderr, - "big data page %lu size %u", + "big data page %u size %u", *(pgno_t *)rl->bytes, *(u_int32_t *)(rl->bytes + sizeof(pgno_t))); else if (rl->dsize) @@ -252,8 +244,7 @@ __bt_dpage(h) * dbp: pointer to the DB */ void -__bt_stat(dbp) - DB *dbp; +__bt_stat(DB *dbp) { extern u_long bt_cache_hit, bt_cache_miss, bt_pfxsaved, bt_rootsplit; extern u_long bt_sortsplit, bt_split; @@ -301,27 +292,27 @@ __bt_stat(dbp) (void)mpool_put(t->bt_mp, h, 0); } - (void)fprintf(stderr, "%d level%s with %ld keys", + (void)fprintf(stderr, "%d level%s with %lu keys", levels, levels == 1 ? "" : "s", nkeys); if (F_ISSET(t, R_RECNO)) - (void)fprintf(stderr, " (%ld header count)", t->bt_nrecs); + (void)fprintf(stderr, " (%u header count)", t->bt_nrecs); (void)fprintf(stderr, - "\n%lu pages (leaf %ld, internal %ld, overflow %ld)\n", + "\n%u pages (leaf %u, internal %u, overflow %u)\n", pinternal + pleaf + pcont, pleaf, pinternal, pcont); - (void)fprintf(stderr, "%ld cache hits, %ld cache misses\n", + (void)fprintf(stderr, "%lu cache hits, %lu cache misses\n", bt_cache_hit, bt_cache_miss); - (void)fprintf(stderr, "%ld splits (%ld root splits, %ld sort splits)\n", + (void)fprintf(stderr, "%lu splits (%lu root splits, %lu sort splits)\n", bt_split, bt_rootsplit, bt_sortsplit); pleaf *= t->bt_psize - BTDATAOFF; if (pleaf) (void)fprintf(stderr, - "%.0f%% leaf fill (%ld bytes used, %ld bytes free)\n", + "%.0f%% leaf fill (%lu bytes used, %lu bytes free)\n", ((double)(pleaf - lfree) / pleaf) * 100, pleaf - lfree, lfree); pinternal *= t->bt_psize - BTDATAOFF; if (pinternal) (void)fprintf(stderr, - "%.0f%% internal fill (%ld bytes used, %ld bytes free\n", + "%.0f%% internal fill (%lu bytes used, %lu bytes free\n", ((double)(pinternal - ifree) / pinternal) * 100, pinternal - ifree, ifree); if (bt_pfxsaved)