1 .\" Copyright (c) 2003, 2004 Hiten Pandya <hmp@backplane.com>
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in
14 .\" the documentation and/or other materials provided with the
17 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 .\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21 .\" COPYRIGHT HOLDERS, CONTRIBUTORS OR VOICES IN HITEN PANDYA'S HEAD
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY
23 .\" OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
24 .\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
25 .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 .\" $DragonFly: src/share/man/man9/hash.9,v 1.2 2004/06/28 02:57:11 drhodus Exp $
39 .Nd generic hash table functions for the kernel
45 .Fn hashinit "int elements" "struct malloc_type *type" "u_long *hashmask"
47 .Fn phashinit "int elements" "struct malloc_type *type" "u_long *nentries"
49 The kernel hash functions are used for creating a generic hash table.
53 function returns a pointer to a hash table which is sized a
55 greater or equal to the number of
58 The masking value is stored in
63 function returns a pointer to a prime number sized hash table.
66 requested is used to dictate an upper-bound for the size of the
68 The final size of the hash table is stored by the function in
73 argument to both of the above functions is used for keeping track
74 of memory allocated for the hash table.
77 manual page for more information on memory statistics.
79 The VFS namecache code is one of many examples for using the
81 function; it is located within the file
82 .Pa sys/kern/vfs_cache.c .
84 The hostcache code uses the
86 function for creating a prime number sized hash table; it is located
88 .Pa sys/net/hostcache.c .
90 All pathnames in this section are relative to the
99 This manual page was written by
100 .An Hiten Pandya Aq hmp@backplane.com .