1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
|
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" 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
.\" 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.
.\"
.\" 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.
.\"
.\" @(#)hash.3 8.6 (Berkeley) 8/18/94
.\"
.\" Japanese Version Copyright (c) 1999 Shouichi Saito
.\" all rights reserved.
.\" Translated Mon Jul 26 14:22:49 JST 1999
.\" by Shouichi Saito <ss236rx@ymg.urban.ne.jp>
.\" Proofed Tue Aug 17 1999 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
.\" Updated 2008-02-10, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.77
.\"
.\"WORD: access method å
.\"WORD: bucket Хå
.\"
.TH HASH 3 1994-08-18 "" "Linux Programmer's Manual"
.UC 7
.SH ̾
hash \- hash ǡ١ؤΥå
.SH
.nf
.ft B
#include <sys/types.h>
#include <db.h>
.ft R
.fi
.SH
롼
.BR dbopen (3)
ϥǡ١եФ饤֥ꥤեǤ롣
ݡȤƤեեޥåȤΤҤȤĤ hash ե뤬롣
ǡ١ؤΥåɤ˴ؤŪʵҤ
.BR dbopen (3)
˽Ƥ롣
Υޥ˥奢ڡǤ hash ͭξˤĤƤΤߵҤ롣
.PP
hash ǡ¤ϡĥǽưŪϥå她Ǥ롣
.PP
.BR dbopen (3)
Ϥ hash åɤͭΥǡ¤Τϡ
.I <db.h>
롼ɥեǰʲΤ褦Ƥ롣
.in +4n
.nf
typedef struct {
unsigned int bsize;
unsigned int ffactor;
unsigned int nelem;
unsigned int cachesize;
uint32_t (*hash)(const void *, size_t);
int lorder;
} HASHINFO;
.fi
.in
.PP
ι¤ΤǤʲ˼
.TP 10
.I bsize
hash ơ֥Хå (table bucket) Υ롣
ǥեȤ 256 ХȤǤ롣
ǥ֤ơ֥ǡƥब礭ơ֥Ǥ
ڡ礭ۤɤ
.TP
.I ffactor
桼˾ hash ơ֥̩٤Ǥ롣
Ϥ줾ΥХåȤ˳ǼǤ륭γǤꡢ
hash ơ֥硦̾Ѥ롣
ǥեȤ 8 Ǥ롣
.TP
.I nelem
hash ơ֥κǽޤ˸ѤäͤǤ롣
ͤåȤƤʤäꡢޤ㤯åȤƤȡ
hash ơ֥ϥäƤ˱Ƴĥ롣
ѥեޥ (餯դ٤) 롣
ǥեͤ 1 Ǥ롣
.TP
.I cachesize
ꥭåκ (Хñ) λ͡
ͤ
.BR ޤǻͤǤ
åɤϤͤۤγƤ뤳Ȥ⤢롣
.TP
.I hash
ϥ桼 hash ؿǤ롣
ƤΥǡФƤޤѤ hash ؿȸΤϤʤ顢
ΥǡåȤФƤȤ߹ߤ hash ؿǤ
ѥեޥ㤤Ȥ⤢뤫⤷ʤ
桼 hash ؿĤΰȤʤƤϤʤʤ (Хʸ
ؤΥݥȡĹ)
hash ͤȤƻȤ 32ӥåȤ֤ͤʤƤϤʤʤ
.TP
.I lorder
ǡ١˳ǼƤǡͤΥХȥ
οϡɽΤǤ롣
㤨Хӥåǥʤ顢οͤ 4,321 Ȥʤ롣
.I lorder
0 (ꤵƤʤ)硢ߤΥۥ
ǻȤƤ¤ӽ礬Ȥ롣
ե뤬¸ߤ硢ꤷ̵ͤ뤵ĥ
˻ꤵƤͤȤ롣
.PP
.\"NAKANO the tree the hash, Ǥ礦.
ե뤬¸ߤƤ (ޤ
.B O_TRUNC
ե饰ꤵƤʤ) ȡ
.IR bsize ,
.IR ffactor ,
.IR lorder ,
.I nelem
˻ꤵ줿̵ͤ뤵졢
ϥå夬줿˻ȤäͤȤ롣
.PP
hash ؿꤵȡ
.I hash_open
ϥǡ١줿˻ꤵƤ
hash ؿȺꤵ줿 hash ؿƱɤĴ١
ƱǤʤˤϼԤ롣
.PP
.BR dbm (3),
.BR ndbm (3)
˵ҤƤ롼ؤβߴ뤿Υե
¸ߤ롣ΥեϰΥեե
ޥåȤȤϸߴʤ
.SH 顼
.I hash
åɥ롼ϡԤȥ饤֥롼
.BR dbopen (3)
ǻꤵƤ륨顼˱
.I errno
åȤ롣
.SH Х
ХȥȤƤϥӥåǥȥȥ륨ǥΤߤ
ݡȤƤ롣
.SH Ϣ
.BR btree (3),
.BR dbopen (3),
.BR mpool (3),
.BR recno (3)
.sp
.IR "Dynamic Hash Tables" ,
Per-Ake Larson, Communications of the ACM, April 1988.
.sp
.IR "A New Hash Package for UNIX" ,
Margo Seltzer, USENIX Proceedings, Winter 1991.
|