Penguin
Annotated edit history of hash(3) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 HASH
2 !!!HASH
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 ERRORS
7 SEE ALSO
8 BUGS
9 ----
10 !!NAME
11
12
13 hash - hash database access method
14 !!SYNOPSIS
15
16
17 __#include
18 __
19 !!DESCRIPTION
20
21
22 The routine ''dbopen'' is the library interface to
23 database files. One of the supported file formats is hash
24 files. The general description of the database access
25 methods is in dbopen(3), this manual page describes
26 only the hash specific information.
27
28
29 The hash data structure is an extensible, dynamic hashing
30 scheme.
31
32
33 The access method specific data structure provided to
34 ''dbopen'' is defined in the
35 ''
36
37
38 typedef struct {
39
40
41 u_int bsize;
42 u_int ffactor;
43 u_int nelem;
44 u_int cachesize;
45 u_int32_t (*hash)(const void *, size_t);
46 int lorder;
47
48
49 } HASHINFO;
50
51
52 The elements of this structure are as follows:
53
54
55 bsize
56
57
58 ''Bsize'' defines the hash table bucket size, and is, by
59 default, 256 bytes. It may be preferable to increase the
60 page size for disk-resident tables and tables with large
61 data items.
62
63
64 ffactor
65
66
67 ''Ffactor'' indicates a desired density within the hash
68 table. It is an approximation of the number of keys allowed
69 to accumulate in any one bucket, determining when the hash
70 table grows or shrinks. The default value is 8.
71
72
73 nelem
74
75
76 ''Nelem'' is an estimate of the final size of the hash
77 table. If not set or set too low, hash tables will expand
78 gracefully as keys are entered, although a slight
79 performance degradation may be noticed. The default value is
80 1.
81
82
83 cachesize
84
85
86 A suggested maximum size, in bytes, of the memory cache.
87 This value is __only__ advisory, and the access method
88 will allocate more memory rather than fail.
89
90
91 hash
92
93
94 ''Hash'' is a user defined hash function. Since no hash
95 function performs equally well on all possible data, the
96 user may find that the built-in hash function does poorly on
97 a particular data set. User specified hash functions must
98 take two arguments (a pointer to a byte string and a length)
99 and return a 32-bit quantity to be used as the hash
100 value.
101
102
103 lorder
104
105
106 The byte order for integers in the stored database metadata.
107 The number should represent the order as an integer; for
108 example, big endian order would be the number 4,321. If
109 ''lorder'' is 0 (no order is specified) the current host
110 order is used. If the file already exists, the specified
111 value is ignored and the value specified when the tree was
112 created is used.
113
114
115 If the file already exists (and the O_TRUNC flag is not
116 specified), the values specified for the parameters bsize,
117 ffactor, lorder and nelem are ignored and the values
118 specified when the tree was created are used.
119
120
121 If a hash function is specified, ''hash_open'' will
122 attempt to determine if the hash function specified is the
123 same as the one with which the database was created, and
124 will fail if it is not.
125
126
127 Backward compatible interfaces to the routines described in
128 dbm(3), and ndbm(3) are provided, however
129 these interfaces are not compatible with previous file
130 formats.
131 !!ERRORS
132
133
134 The ''hash'' access method routines may fail and set
135 ''errno'' for any of the errors specified for the library
136 routine dbopen(3).
137 !!SEE ALSO
138
139
140 btree(3), dbopen(3), mpool(3),
141 recno(3)
142
143
144 ''Dynamic Hash Tables'', Per-Ake Larson, Communications
145 of the ACM, April 1988.
146
147
148 ''A New Hash Package for UNIX'', Margo Seltzer, USENIX
149 Proceedings, Winter 1991.
150 !!BUGS
151
152
153 Only big and little endian byte order is
154 supported.
155 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.