2 * Copyright (c) 1990, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
5 * This code is derived from software contributed to Berkeley by
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the University nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 #include <sys/param.h>
34 #if defined(LIBC_SCCS) && !defined(lint)
35 static char sccsid
[] = "@(#)hash_page.c 8.7 (Berkeley) 8/16/94";
36 #endif /* LIBC_SCCS and not lint */
37 #include <sys/cdefs.h>
43 * Page manipulation for hashing package.
55 #include <sys/types.h>
73 static __uint32_t
*fetch_bitmap(HTAB
*, int);
74 static __uint32_t
first_free(__uint32_t
);
75 static int open_temp(HTAB
*);
76 static __uint16_t
overflow_page(HTAB
*);
77 static void putpair(char *, const DBT
*, const DBT
*);
78 static void squeeze_key(__uint16_t
*, const DBT
*, const DBT
*);
80 (HTAB
*, __uint32_t
, BUFHEAD
*, BUFHEAD
*, int, int);
82 #define PAGE_INIT(P) { \
83 ((__uint16_t *)(P))[0] = 0; \
84 ((__uint16_t *)(P))[1] = hashp->BSIZE - 3 * sizeof(__uint16_t); \
85 ((__uint16_t *)(P))[2] = hashp->BSIZE; \
89 * This is called AFTER we have verified that there is room on the page for
90 * the pair (PAIRFITS has returned true) so we go right ahead and start moving
100 __uint16_t
*bp
, n
, off
;
102 bp
= (__uint16_t
*)p
;
104 /* Enter the key first. */
107 off
= OFFSET(bp
) - key
->size
;
108 memmove(p
+ off
, key
->data
, key
->size
);
113 memmove(p
+ off
, val
->data
, val
->size
);
116 /* Adjust page info. */
118 bp
[n
+ 1] = off
- ((n
+ 3) * sizeof(__uint16_t
));
134 __uint16_t
*bp
, newoff
;
138 bp
= (__uint16_t
*)bufp
->page
;
141 if (bp
[ndx
+ 1] < REAL_KEY
)
142 return (__big_delete(hashp
, bufp
));
144 newoff
= bp
[ndx
- 1];
146 newoff
= hashp
->BSIZE
;
147 pairlen
= newoff
- bp
[ndx
+ 1];
149 if (ndx
!= (n
- 1)) {
150 /* Hard Case -- need to shuffle keys */
152 char *src
= bufp
->page
+ (int)OFFSET(bp
);
153 char *dst
= src
+ (int)pairlen
;
154 memmove(dst
, src
, bp
[ndx
+ 1] - OFFSET(bp
));
156 /* Now adjust the pointers */
157 for (i
= ndx
+ 2; i
<= n
; i
+= 2) {
158 if (bp
[i
+ 1] == OVFLPAGE
) {
160 bp
[i
- 1] = bp
[i
+ 1];
162 bp
[i
- 2] = bp
[i
] + pairlen
;
163 bp
[i
- 1] = bp
[i
+ 1] + pairlen
;
167 /* Finally adjust the page data */
168 bp
[n
] = OFFSET(bp
) + pairlen
;
169 bp
[n
- 1] = bp
[n
+ 1] + pairlen
+ 2 * sizeof(__uint16_t
);
173 bufp
->flags
|= BUF_MOD
;
188 BUFHEAD
*new_bufp
, *old_bufp
;
193 __uint16_t copyto
, diff
, off
, moved
;
196 copyto
= (__uint16_t
)hashp
->BSIZE
;
197 off
= (__uint16_t
)hashp
->BSIZE
;
198 old_bufp
= __get_buf(hashp
, obucket
, NULL
, 0);
199 if (old_bufp
== NULL
)
201 new_bufp
= __get_buf(hashp
, nbucket
, NULL
, 0);
202 if (new_bufp
== NULL
)
205 old_bufp
->flags
|= (BUF_MOD
| BUF_PIN
);
206 new_bufp
->flags
|= (BUF_MOD
| BUF_PIN
);
208 ino
= (__uint16_t
*)(op
= old_bufp
->page
);
213 for (n
= 1, ndx
= 1; n
< ino
[0]; n
+= 2) {
214 if (ino
[n
+ 1] < REAL_KEY
) {
215 retval
= ugly_split(hashp
, obucket
, old_bufp
, new_bufp
,
216 (int)copyto
, (int)moved
);
217 old_bufp
->flags
&= ~BUF_PIN
;
218 new_bufp
->flags
&= ~BUF_PIN
;
222 key
.data
= (u_char
*)op
+ ino
[n
];
223 key
.size
= off
- ino
[n
];
225 if (__call_hash(hashp
, key
.data
, key
.size
) == obucket
) {
226 /* Don't switch page */
229 copyto
= ino
[n
+ 1] + diff
;
230 memmove(op
+ copyto
, op
+ ino
[n
+ 1],
232 ino
[ndx
] = copyto
+ ino
[n
] - ino
[n
+ 1];
233 ino
[ndx
+ 1] = copyto
;
239 val
.data
= (u_char
*)op
+ ino
[n
+ 1];
240 val
.size
= ino
[n
] - ino
[n
+ 1];
241 putpair(np
, &key
, &val
);
248 /* Now clean up the page */
250 FREESPACE(ino
) = copyto
- sizeof(__uint16_t
) * (ino
[0] + 3);
251 OFFSET(ino
) = copyto
;
254 (void)fprintf(stderr
, "split %d/%d\n",
255 ((__uint16_t
*)np
)[0] / 2,
256 ((__uint16_t
*)op
)[0] / 2);
258 /* unpin both pages */
259 old_bufp
->flags
&= ~BUF_PIN
;
260 new_bufp
->flags
&= ~BUF_PIN
;
265 * Called when we encounter an overflow or big key/data page during split
266 * handling. This is special cased since we have to begin checking whether
267 * the key/data pairs fit on their respective pages and because we may need
268 * overflow pages for both the old and new pages.
270 * The first page might be a page with regular key/data pairs in which case
271 * we have a regular overflow condition and just need to go on to the next
272 * page or it might be a big key/data pair in which case we need to fix the
282 __uint32_t obucket
, /* Same as __split_page. */
285 int copyto
, /* First byte on page which contains key/data values. */
286 int moved
/* Number of pairs moved to new page. */
289 BUFHEAD
*bufp
; /* Buffer header for ino */
290 __uint16_t
*ino
; /* Page keys come off of */
291 __uint16_t
*np
; /* New page */
292 __uint16_t
*op
; /* Page keys go on to if they aren't moving */
294 BUFHEAD
*last_bfp
; /* Last buf header OVFL needing to be freed */
297 __uint16_t n
, off
, ov_addr
, scopyto
;
298 char *cino
; /* Character value of ino */
301 ino
= (__uint16_t
*)old_bufp
->page
;
302 np
= (__uint16_t
*)new_bufp
->page
;
303 op
= (__uint16_t
*)old_bufp
->page
;
305 scopyto
= (__uint16_t
)copyto
; /* ANSI */
309 if (ino
[2] < REAL_KEY
&& ino
[2] != OVFLPAGE
) {
310 if (__big_split(hashp
, old_bufp
,
311 new_bufp
, bufp
, bufp
->addr
, obucket
, &ret
))
316 op
= (__uint16_t
*)old_bufp
->page
;
320 np
= (__uint16_t
*)new_bufp
->page
;
324 cino
= (char *)bufp
->page
;
325 ino
= (__uint16_t
*)cino
;
326 last_bfp
= ret
.nextp
;
327 } else if (ino
[n
+ 1] == OVFLPAGE
) {
330 * Fix up the old page -- the extra 2 are the fields
331 * which contained the overflow information.
333 ino
[0] -= (moved
+ 2);
335 scopyto
- sizeof(__uint16_t
) * (ino
[0] + 3);
336 OFFSET(ino
) = scopyto
;
338 bufp
= __get_buf(hashp
, ov_addr
, bufp
, 0);
342 ino
= (__uint16_t
*)bufp
->page
;
344 scopyto
= hashp
->BSIZE
;
348 __free_ovflpage(hashp
, last_bfp
);
351 /* Move regular sized pairs of there are any */
353 for (n
= 1; (n
< ino
[0]) && (ino
[n
+ 1] >= REAL_KEY
); n
+= 2) {
355 key
.data
= (u_char
*)cino
+ ino
[n
];
356 key
.size
= off
- ino
[n
];
357 val
.data
= (u_char
*)cino
+ ino
[n
+ 1];
358 val
.size
= ino
[n
] - ino
[n
+ 1];
361 if (__call_hash(hashp
, key
.data
, key
.size
) == obucket
) {
362 /* Keep on old page */
363 if (PAIRFITS(op
, (&key
), (&val
)))
364 putpair((char *)op
, &key
, &val
);
367 __add_ovflpage(hashp
, old_bufp
);
370 op
= (__uint16_t
*)old_bufp
->page
;
371 putpair((char *)op
, &key
, &val
);
373 old_bufp
->flags
|= BUF_MOD
;
375 /* Move to new page */
376 if (PAIRFITS(np
, (&key
), (&val
)))
377 putpair((char *)np
, &key
, &val
);
380 __add_ovflpage(hashp
, new_bufp
);
383 np
= (__uint16_t
*)new_bufp
->page
;
384 putpair((char *)np
, &key
, &val
);
386 new_bufp
->flags
|= BUF_MOD
;
391 __free_ovflpage(hashp
, last_bfp
);
396 * Add the given pair to the page
410 __uint16_t
*bp
, *sop
;
413 bp
= (__uint16_t
*)bufp
->page
;
415 while (bp
[0] && (bp
[2] < REAL_KEY
|| bp
[bp
[0]] < REAL_KEY
))
417 if (bp
[2] == FULL_KEY_DATA
&& bp
[0] == 2)
418 /* This is the last page of a big key/data pair
419 and we need to add another page */
421 else if (bp
[2] < REAL_KEY
&& bp
[bp
[0]] != OVFLPAGE
) {
422 bufp
= __get_buf(hashp
, bp
[bp
[0] - 1], bufp
, 0);
425 bp
= (__uint16_t
*)bufp
->page
;
427 /* Try to squeeze key on this page */
428 if (FREESPACE(bp
) > PAIRSIZE(key
, val
)) {
429 squeeze_key(bp
, key
, val
);
432 bufp
= __get_buf(hashp
, bp
[bp
[0] - 1], bufp
, 0);
435 bp
= (__uint16_t
*)bufp
->page
;
438 if (PAIRFITS(bp
, key
, val
))
439 putpair(bufp
->page
, key
, val
);
442 bufp
= __add_ovflpage(hashp
, bufp
);
445 sop
= (__uint16_t
*)bufp
->page
;
447 if (PAIRFITS(sop
, key
, val
))
448 putpair((char *)sop
, key
, val
);
450 if (__big_insert(hashp
, bufp
, key
, val
))
453 bufp
->flags
|= BUF_MOD
;
455 * If the average number of keys per bucket exceeds the fill factor,
460 (hashp
->NKEYS
/ (hashp
->MAX_BUCKET
+ 1) > hashp
->FFACTOR
))
461 return (__expand_table(hashp
));
478 __uint16_t ndx
, ovfl_num
;
482 sp
= (__uint16_t
*)bufp
->page
;
484 /* Check if we are dynamically determining the fill factor */
485 if (hashp
->FFACTOR
== DEF_FFACTOR
) {
486 hashp
->FFACTOR
= sp
[0] >> 1;
487 if (hashp
->FFACTOR
< MIN_FFACTOR
)
488 hashp
->FFACTOR
= MIN_FFACTOR
;
490 bufp
->flags
|= BUF_MOD
;
491 ovfl_num
= overflow_page(hashp
);
494 tmp2
= bufp
->ovfl
? bufp
->ovfl
->addr
: 0;
496 if (!ovfl_num
|| !(bufp
->ovfl
= __get_buf(hashp
, ovfl_num
, bufp
, 1)))
498 bufp
->ovfl
->flags
|= BUF_MOD
;
500 (void)fprintf(stderr
, "ADDOVFLPAGE: %d->ovfl was %d is now %d\n",
501 tmp1
, tmp2
, bufp
->ovfl
->addr
);
505 * Since a pair is allocated on a page only if there's room to add
506 * an overflow page, we know that the OVFL information will fit on
509 sp
[ndx
+ 4] = OFFSET(sp
);
510 sp
[ndx
+ 3] = FREESPACE(sp
) - OVFLSIZE
;
511 sp
[ndx
+ 1] = ovfl_num
;
512 sp
[ndx
+ 2] = OVFLPAGE
;
514 #ifdef HASH_STATISTICS
522 * 0 indicates SUCCESS
523 * -1 indicates FAILURE
542 if ((fd
== -1) || !is_disk
) {
547 page
= BUCKET_TO_PAGE(bucket
);
549 page
= OADDR_TO_PAGE(bucket
);
550 if ((lseek(fd
, (off_t
)page
<< hashp
->BSHIFT
, SEEK_SET
) == -1) ||
551 ((rsize
= read(fd
, p
, size
)) == -1))
553 bp
= (__uint16_t
*)p
;
555 bp
[0] = 0; /* We hit the EOF, so initialize a new page */
561 if (!is_bitmap
&& !bp
[0]) {
564 if (hashp
->LORDER
!= DB_BYTE_ORDER
) {
568 max
= hashp
->BSIZE
>> 2; /* divide by 4 */
569 for (i
= 0; i
< max
; i
++)
570 M_32_SWAP(((int *)p
)[i
]);
574 for (i
= 1; i
<= max
; i
++)
582 * Write page p to disk
601 if ((hashp
->fp
== -1) && open_temp(hashp
))
605 if (hashp
->LORDER
!= DB_BYTE_ORDER
) {
610 max
= hashp
->BSIZE
>> 2; /* divide by 4 */
611 for (i
= 0; i
< max
; i
++)
612 M_32_SWAP(((int *)p
)[i
]);
614 max
= ((__uint16_t
*)p
)[0] + 2;
615 for (i
= 0; i
<= max
; i
++)
616 M_16_SWAP(((__uint16_t
*)p
)[i
]);
620 page
= BUCKET_TO_PAGE(bucket
);
622 page
= OADDR_TO_PAGE(bucket
);
623 if ((lseek(fd
, (off_t
)page
<< hashp
->BSHIFT
, SEEK_SET
) == -1) ||
624 ((wsize
= write(fd
, p
, size
)) == -1))
634 #define BYTE_MASK ((1 << INT_BYTE_SHIFT) -1)
636 * Initialize a new bitmap page. Bitmap pages are left in memory
637 * once they are read in.
648 int clearbytes
, clearints
;
650 if ((ip
= (__uint32_t
*)malloc(hashp
->BSIZE
)) == NULL
)
653 clearints
= ((nbits
- 1) >> INT_BYTE_SHIFT
) + 1;
654 clearbytes
= clearints
<< INT_TO_BYTE
;
655 (void)memset((char *)ip
, 0, clearbytes
);
656 (void)memset(((char *)ip
) + clearbytes
, 0xFF,
657 hashp
->BSIZE
- clearbytes
);
658 ip
[clearints
- 1] = ALL_SET
<< (nbits
& BYTE_MASK
);
660 hashp
->BITMAPS
[ndx
] = (__uint16_t
)pnum
;
661 hashp
->mapp
[ndx
] = ip
;
673 for (i
= 0; i
< BITS_PER_MAP
; i
++) {
686 __uint32_t
*freep
= NULL
;
687 int max_free
, offset
, splitnum
;
689 int bit
, first_page
, free_bit
, free_page
, i
, in_use_bits
, j
;
693 splitnum
= hashp
->OVFL_POINT
;
694 max_free
= hashp
->SPARES
[splitnum
];
696 free_page
= (max_free
- 1) >> (hashp
->BSHIFT
+ BYTE_SHIFT
);
697 free_bit
= (max_free
- 1) & ((hashp
->BSIZE
<< BYTE_SHIFT
) - 1);
699 /* Look through all the free maps to find the first free block */
700 first_page
= hashp
->LAST_FREED
>>(hashp
->BSHIFT
+ BYTE_SHIFT
);
701 for ( i
= first_page
; i
<= free_page
; i
++ ) {
702 if (!(freep
= (__uint32_t
*)hashp
->mapp
[i
]) &&
703 !(freep
= fetch_bitmap(hashp
, i
)))
706 in_use_bits
= free_bit
;
708 in_use_bits
= (hashp
->BSIZE
<< BYTE_SHIFT
) - 1;
710 if (i
== first_page
) {
711 bit
= hashp
->LAST_FREED
&
712 ((hashp
->BSIZE
<< BYTE_SHIFT
) - 1);
713 j
= bit
/ BITS_PER_MAP
;
714 bit
= bit
& ~(BITS_PER_MAP
- 1);
719 for (; bit
<= in_use_bits
; j
++, bit
+= BITS_PER_MAP
)
720 if (freep
[j
] != ALL_SET
)
724 /* No Free Page Found */
725 hashp
->LAST_FREED
= hashp
->SPARES
[splitnum
];
726 hashp
->SPARES
[splitnum
]++;
727 offset
= hashp
->SPARES
[splitnum
] -
728 (splitnum
? hashp
->SPARES
[splitnum
- 1] : 0);
730 #define OVMSG "HASH: Out of overflow pages. Increase page size\n"
731 if (offset
> SPLITMASK
) {
732 if (++splitnum
>= NCACHED
) {
733 (void)write(STDERR_FILENO
, OVMSG
, sizeof(OVMSG
) - 1);
736 hashp
->OVFL_POINT
= splitnum
;
737 hashp
->SPARES
[splitnum
] = hashp
->SPARES
[splitnum
-1];
738 hashp
->SPARES
[splitnum
-1]--;
742 /* Check if we need to allocate a new bitmap page */
743 if (free_bit
== (hashp
->BSIZE
<< BYTE_SHIFT
) - 1) {
745 if (free_page
>= NCACHED
) {
746 (void)write(STDERR_FILENO
, OVMSG
, sizeof(OVMSG
) - 1);
750 * This is tricky. The 1 indicates that you want the new page
751 * allocated with 1 clear bit. Actually, you are going to
752 * allocate 2 pages from this map. The first is going to be
753 * the map page, the second is the overflow page we were
754 * looking for. The init_bitmap routine automatically, sets
755 * the first bit of itself to indicate that the bitmap itself
756 * is in use. We would explicitly set the second bit, but
757 * don't have to if we tell init_bitmap not to leave it clear
758 * in the first place.
761 (int)OADDR_OF(splitnum
, offset
), 1, free_page
))
763 hashp
->SPARES
[splitnum
]++;
768 if (offset
> SPLITMASK
) {
769 if (++splitnum
>= NCACHED
) {
770 (void)write(STDERR_FILENO
, OVMSG
,
774 hashp
->OVFL_POINT
= splitnum
;
775 hashp
->SPARES
[splitnum
] = hashp
->SPARES
[splitnum
-1];
776 hashp
->SPARES
[splitnum
-1]--;
781 * Free_bit addresses the last used bit. Bump it to address
782 * the first available bit.
785 SETBIT(freep
, free_bit
);
788 /* Calculate address of the new overflow page */
789 addr
= OADDR_OF(splitnum
, offset
);
791 (void)fprintf(stderr
, "OVERFLOW_PAGE: ADDR: %d BIT: %d PAGE %d\n",
792 addr
, free_bit
, free_page
);
797 bit
= bit
+ first_free(freep
[j
]);
804 * Bits are addressed starting with 0, but overflow pages are addressed
805 * beginning at 1. Bit is a bit addressnumber, so we need to increment
806 * it to convert it to a page number.
808 bit
= 1 + bit
+ (i
* (hashp
->BSIZE
<< BYTE_SHIFT
));
809 if (bit
>= hashp
->LAST_FREED
)
810 hashp
->LAST_FREED
= bit
- 1;
812 /* Calculate the split number for this page */
813 for (i
= 0; (i
< splitnum
) && (bit
> hashp
->SPARES
[i
]); i
++);
814 offset
= (i
? bit
- hashp
->SPARES
[i
- 1] : bit
);
815 if (offset
>= SPLITMASK
)
816 return (0); /* Out of overflow pages */
817 addr
= OADDR_OF(i
, offset
);
819 (void)fprintf(stderr
, "OVERFLOW_PAGE: ADDR: %d BIT: %d PAGE %d\n",
823 /* Allocate and return the overflow page */
828 * Mark this overflow page as free.
838 int bit_address
, free_page
, free_bit
;
843 (void)fprintf(stderr
, "Freeing %d\n", addr
);
845 ndx
= (((__uint16_t
)addr
) >> SPLITSHIFT
);
847 (ndx
? hashp
->SPARES
[ndx
- 1] : 0) + (addr
& SPLITMASK
) - 1;
848 if (bit_address
< hashp
->LAST_FREED
)
849 hashp
->LAST_FREED
= bit_address
;
850 free_page
= (bit_address
>> (hashp
->BSHIFT
+ BYTE_SHIFT
));
851 free_bit
= bit_address
& ((hashp
->BSIZE
<< BYTE_SHIFT
) - 1);
853 if (!(freep
= hashp
->mapp
[free_page
]))
854 freep
= fetch_bitmap(hashp
, free_page
);
857 * This had better never happen. It means we tried to read a bitmap
858 * that has already had overflow pages allocated off it, and we
859 * failed to read it from the file.
864 CLRBIT(freep
, free_bit
);
866 (void)fprintf(stderr
, "FREE_OVFLPAGE: ADDR: %d BIT: %d PAGE %d\n",
867 obufp
->addr
, free_bit
, free_page
);
869 __reclaim_buf(hashp
, obufp
);
883 static char namestr
[] = "_hashXXXXXX";
885 /* Block signals; make sure file goes away at process exit. */
886 (void)sigfillset(&set
);
887 (void)sigprocmask(SIG_BLOCK
, &set
, &oset
);
888 if ((hashp
->fp
= mkstemp(namestr
)) != -1) {
889 (void)unlink(namestr
);
891 (void)fcntl(hashp
->fp
, F_SETFD
, 1);
894 (void)sigprocmask(SIG_SETMASK
, &oset
, (sigset_t
*)NULL
);
895 return (hashp
->fp
!= -1 ? 0 : -1);
899 * We have to know that the key will fit, but the last entry on the page is
900 * an overflow pair, so we need to shift things.
910 __uint16_t free_space
, n
, off
, pageno
;
914 free_space
= FREESPACE(sp
);
920 memmove(p
+ off
, key
->data
, key
->size
);
923 memmove(p
+ off
, val
->data
, val
->size
);
926 sp
[n
+ 2] = OVFLPAGE
;
927 FREESPACE(sp
) = free_space
- PAIRSIZE(key
, val
);
937 if (ndx
>= hashp
->nmaps
)
939 if ((hashp
->mapp
[ndx
] = (__uint32_t
*)malloc(hashp
->BSIZE
)) == NULL
)
941 if (__get_page(hashp
,
942 (char *)hashp
->mapp
[ndx
], hashp
->BITMAPS
[ndx
], 0, 1, 1)) {
943 free(hashp
->mapp
[ndx
]);
946 return (hashp
->mapp
[ndx
]);
957 (void)fprintf(stderr
, "%d ", addr
);
958 bufp
= __get_buf(hashp
, addr
, NULL
, 0);
959 bp
= (short *)bufp
->page
;
960 while (bp
[0] && ((bp
[bp
[0]] == OVFLPAGE
) ||
961 ((bp
[0] > 2) && bp
[2] < REAL_KEY
))) {
962 oaddr
= bp
[bp
[0] - 1];
963 (void)fprintf(stderr
, "%d ", (int)oaddr
);
964 bufp
= __get_buf(hashp
, (int)oaddr
, bufp
, 0);
965 bp
= (short *)bufp
->page
;
967 (void)fprintf(stderr
, "\n");