A typical example is shown below:
static LIST_HEAD(foo, foo) *footable;
static u_long foomask;
footable = hashinit(32, M_FOO, &foomask);
Here we allocate a hash table with 32 entries from the malloc arena pointed to by M_FOO. The mask for the allocated hash table is returned in foomask. A subsequent call to hashdestroy uses the value in foomask:
hashdestroy(footable, M_FOO, foomask);
The hashinit and phashinit functions will panic if argument nelements is less than or equal to zero.
The hashdestroy function will panic if the hash table pointed to by hashtbl is not empty.