Deleted Added
sdiff udiff text old ( 190487 ) new ( 190489 )
full compact
1/*-
2 * Copyright (c) 1990, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Margo Seltzer.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 20 unchanged lines hidden (view full) ---

29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#if defined(LIBC_SCCS) && !defined(lint)
34static char sccsid[] = "@(#)hash_page.c 8.7 (Berkeley) 8/16/94";
35#endif /* LIBC_SCCS and not lint */
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/lib/libc/db/hash/hash_page.c 190489 2009-03-28 06:23:10Z delphij $");
38
39/*
40 * PACKAGE: hashing
41 *
42 * DESCRIPTION:
43 * Page manipulation for hashing package.
44 *
45 * ROUTINES:

--- 73 unchanged lines hidden (view full) ---

119/*
120 * Returns:
121 * 0 OK
122 * -1 error
123 */
124int
125__delpair(HTAB *hashp, BUFHEAD *bufp, int ndx)
126{
127 u_int16_t *bp, newoff, pairlen;
128 int n;
129
130 bp = (u_int16_t *)bufp->page;
131 n = bp[0];
132
133 if (bp[ndx + 1] < REAL_KEY)
134 return (__big_delete(hashp, bufp));
135 if (ndx != 1)
136 newoff = bp[ndx - 1];

--- 310 unchanged lines hidden (view full) ---

447 *
448 * Returns:
449 * pointer on success
450 * NULL on error
451 */
452BUFHEAD *
453__add_ovflpage(HTAB *hashp, BUFHEAD *bufp)
454{
455 u_int16_t *sp, ndx, ovfl_num;
456#ifdef DEBUG1
457 int tmp1, tmp2;
458#endif
459 sp = (u_int16_t *)bufp->page;
460
461 /* Check if we are dynamically determining the fill factor */
462 if (hashp->FFACTOR == DEF_FFACTOR) {
463 hashp->FFACTOR = sp[0] >> 1;

--- 34 unchanged lines hidden (view full) ---

498 * Returns:
499 * 0 indicates SUCCESS
500 * -1 indicates FAILURE
501 */
502int
503__get_page(HTAB *hashp, char *p, u_int32_t bucket, int is_bucket, int is_disk,
504 int is_bitmap)
505{
506 int fd, page, size, rsize;
507 u_int16_t *bp;
508
509 fd = hashp->fp;
510 size = hashp->BSIZE;
511
512 if ((fd == -1) || !is_disk) {
513 PAGE_INIT(p);
514 return (0);

--- 37 unchanged lines hidden (view full) ---

552 *
553 * Returns:
554 * 0 ==> OK
555 * -1 ==>failure
556 */
557int
558__put_page(HTAB *hashp, char *p, u_int32_t bucket, int is_bucket, int is_bitmap)
559{
560 int fd, page, size, wsize;
561
562 size = hashp->BSIZE;
563 if ((hashp->fp == -1) && open_temp(hashp))
564 return (-1);
565 fd = hashp->fp;
566
567 if (hashp->LORDER != BYTE_ORDER) {
568 int i, max;
569
570 if (is_bitmap) {
571 max = hashp->BSIZE >> 2; /* divide by 4 */
572 for (i = 0; i < max; i++)
573 M_32_SWAP(((int *)p)[i]);
574 } else {
575 max = ((u_int16_t *)p)[0] + 2;
576 for (i = 0; i <= max; i++)

--- 346 unchanged lines hidden ---