diff options
Diffstat (limited to 'static/freebsd/man9/hashinit.9 3.html')
| -rw-r--r-- | static/freebsd/man9/hashinit.9 3.html | 174 |
1 files changed, 0 insertions, 174 deletions
diff --git a/static/freebsd/man9/hashinit.9 3.html b/static/freebsd/man9/hashinit.9 3.html deleted file mode 100644 index 3b29700f..00000000 --- a/static/freebsd/man9/hashinit.9 3.html +++ /dev/null @@ -1,174 +0,0 @@ -<table class="head"> - <tr> - <td class="head-ltitle">HASHINIT(9)</td> - <td class="head-vol">Kernel Developer's Manual</td> - <td class="head-rtitle">HASHINIT(9)</td> - </tr> -</table> -<div class="manual-text"> -<section class="Sh"> -<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> -<p class="Pp"><code class="Nm">hashinit</code>, - <code class="Nm">hashinit_flags</code>, <code class="Nm">hashdestroy</code>, - <code class="Nm">phashinit</code>, <code class="Nm">phashinit_flags</code> - — <span class="Nd">manage kernel hash tables</span></p> -</section> -<section class="Sh"> -<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> -<p class="Pp"><code class="In">#include - <<a class="In">sys/malloc.h</a>></code> - <br/> - <code class="In">#include <<a class="In">sys/systm.h</a>></code> - <br/> - <code class="In">#include <<a class="In">sys/queue.h</a>></code></p> -<p class="Pp"><var class="Ft">void *</var> - <br/> - <code class="Fn">hashinit</code>(<var class="Fa" style="white-space: nowrap;">int - nelements</var>, <var class="Fa" style="white-space: nowrap;">struct - malloc_type *type</var>, <var class="Fa" style="white-space: nowrap;">u_long - *hashmask</var>);</p> -<p class="Pp"><var class="Ft">void</var> - <br/> - <code class="Fn">hashinit_flags</code>(<var class="Fa">int nelements</var>, - <var class="Fa">struct malloc_type *type</var>, <var class="Fa">u_long - *hashmask</var>, <var class="Fa">int flags</var>);</p> -<p class="Pp"><var class="Ft">void</var> - <br/> - <code class="Fn">hashdestroy</code>(<var class="Fa" style="white-space: nowrap;">void - *hashtbl</var>, <var class="Fa" style="white-space: nowrap;">struct - malloc_type *type</var>, <var class="Fa" style="white-space: nowrap;">u_long - hashmask</var>);</p> -<p class="Pp"><var class="Ft">void *</var> - <br/> - <code class="Fn">phashinit</code>(<var class="Fa" style="white-space: nowrap;">int - nelements</var>, <var class="Fa" style="white-space: nowrap;">struct - malloc_type *type</var>, <var class="Fa" style="white-space: nowrap;">u_long - *nentries</var>);</p> -<p class="Pp"><code class="Fn">phashinit_flags</code>(<var class="Fa" style="white-space: nowrap;">int - nelements</var>, <var class="Fa" style="white-space: nowrap;">struct - malloc_type *type</var>, <var class="Fa" style="white-space: nowrap;">u_long - *nentries</var>, <var class="Fa" style="white-space: nowrap;">int - flags</var>);</p> -</section> -<section class="Sh"> -<h1 class="Sh" id="WARNING"><a class="permalink" href="#WARNING">WARNING</a></h1> -<p class="Pp">This KPI is obsolete and scheduled for removal in - <span class="Ux">FreeBSD 17</span>. Use <a class="Xr">hashalloc(9)</a> - instead.</p> -</section> -<section class="Sh"> -<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> -<p class="Pp">The - <a class="permalink" href="#hashinit"><code class="Fn" id="hashinit">hashinit</code></a>(), - <code class="Fn">hashinit_flags</code>(), - <code class="Fn">phashinit</code>() and - <code class="Fn">phashinit_flags</code>() functions allocate space for hash - tables of size given by the argument <var class="Fa">nelements</var>.</p> -<p class="Pp" id="hashinit~2">The - <a class="permalink" href="#hashinit~2"><code class="Fn">hashinit</code></a>() - function allocates hash tables that are sized to largest power of two less - than or equal to argument <var class="Fa">nelements</var>. The - <a class="permalink" href="#phashinit"><code class="Fn" id="phashinit">phashinit</code></a>() - function allocates hash tables that are sized to the largest prime number - less than or equal to argument <var class="Fa">nelements</var>. The - <code class="Fn">hashinit_flags</code>() function operates like - <code class="Fn">hashinit</code>() but also accepts an additional argument - <var class="Fa">flags</var> which control various options during allocation. - <code class="Fn">phashinit_flags</code>() function operates like - <code class="Fn">phashinit</code>() but also accepts an additional argument - <var class="Fa">flags</var> which control various options during allocation. - Allocated hash tables are contiguous arrays of - <a class="Xr">LIST_HEAD(3)</a> entries, allocated using - <a class="Xr">malloc(9)</a>, and initialized using - <a class="Xr">LIST_INIT(3)</a>. The malloc arena to be used for allocation - is pointed to by argument <var class="Fa">type</var>.</p> -<p class="Pp" id="hashdestroy">The - <a class="permalink" href="#hashdestroy"><code class="Fn">hashdestroy</code></a>() - function frees the space occupied by the hash table pointed to by argument - <var class="Fa">hashtbl</var>. Argument <var class="Fa">type</var> - determines the malloc arena to use when freeing space. The argument - <var class="Fa">hashmask</var> should be the bit mask returned by the call - to <code class="Fn">hashinit</code>() that allocated the hash table. The - argument <var class="Fa">flags</var> must be used with one of the following - values.</p> -<p class="Pp"></p> -<div class="Bd-indent"> -<dl class="Bl-tag Bl-compact"> - <dt id="HASH_NOWAIT"><a class="permalink" href="#HASH_NOWAIT"><code class="Dv">HASH_NOWAIT</code></a></dt> - <dd>Any malloc performed by the - <a class="permalink" href="#hashinit_flags"><code class="Fn" id="hashinit_flags">hashinit_flags</code></a>() - and - <a class="permalink" href="#phashinit_flags"><code class="Fn" id="phashinit_flags">phashinit_flags</code></a>() - function will not be allowed to wait, and therefore may fail.</dd> - <dt id="HASH_WAITOK"><a class="permalink" href="#HASH_WAITOK"><code class="Dv">HASH_WAITOK</code></a></dt> - <dd>Any malloc performed by <code class="Fn">hashinit_flags</code>() and - <code class="Fn">phashinit_flags</code>() function is allowed to wait for - memory. This is also the behavior of <code class="Fn">hashinit</code>() - and <code class="Fn">phashinit</code>().</dd> -</dl> -</div> -</section> -<section class="Sh"> -<h1 class="Sh" id="IMPLEMENTATION_NOTES"><a class="permalink" href="#IMPLEMENTATION_NOTES">IMPLEMENTATION - NOTES</a></h1> -<p class="Pp">The largest prime hash value chosen by - <code class="Fn">phashinit</code>() is 32749.</p> -</section> -<section class="Sh"> -<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN - VALUES</a></h1> -<p class="Pp">The <code class="Fn">hashinit</code>() function returns a pointer - to an allocated hash table and sets the location pointed to by - <var class="Fa">hashmask</var> to the bit mask to be used for computing the - correct slot in the hash table.</p> -<p class="Pp">The <code class="Fn">phashinit</code>() function returns a pointer - to an allocated hash table and sets the location pointed to by - <var class="Fa">nentries</var> to the number of rows in the hash table.</p> -</section> -<section class="Sh"> -<h1 class="Sh" id="EXAMPLES"><a class="permalink" href="#EXAMPLES">EXAMPLES</a></h1> -<p class="Pp">A typical example is shown below:</p> -<div class="Bd Pp Bd-indent Li"> -<pre>... -static LIST_HEAD(foo, foo) *footable; -static u_long foomask; -... -footable = hashinit(32, M_FOO, &foomask);</pre> -</div> -<p class="Pp">Here we allocate a hash table with 32 entries from the malloc - arena pointed to by <code class="Dv">M_FOO</code>. The mask for the - allocated hash table is returned in <var class="Va">foomask</var>. A - subsequent call to <code class="Fn">hashdestroy</code>() uses the value in - <var class="Va">foomask</var>:</p> -<div class="Bd Pp Bd-indent Li"> -<pre>... -hashdestroy(footable, M_FOO, foomask);</pre> -</div> -</section> -<section class="Sh"> -<h1 class="Sh" id="DIAGNOSTICS"><a class="permalink" href="#DIAGNOSTICS">DIAGNOSTICS</a></h1> -<p class="Pp">The <code class="Fn">hashinit</code>() and - <code class="Fn">phashinit</code>() functions will panic if argument - <var class="Fa">nelements</var> is less than or equal to zero.</p> -<p class="Pp">The <code class="Fn">hashdestroy</code>() function will panic if - the hash table pointed to by <var class="Fa">hashtbl</var> is not empty.</p> -</section> -<section class="Sh"> -<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE - ALSO</a></h1> -<p class="Pp"><a class="Xr">hashalloc(9)</a>, <a class="Xr">LIST_HEAD(3)</a>, - <a class="Xr">malloc(9)</a></p> -</section> -<section class="Sh"> -<h1 class="Sh" id="BUGS"><a class="permalink" href="#BUGS">BUGS</a></h1> -<p class="Pp">There is no <code class="Fn">phashdestroy</code>() function, and - using <code class="Fn">hashdestroy</code>() to free a hash table allocated - by <code class="Fn">phashinit</code>() usually has grave consequences.</p> -</section> -</div> -<table class="foot"> - <tr> - <td class="foot-date">March 17, 2026</td> - <td class="foot-os">FreeBSD 15.0</td> - </tr> -</table> |
