FreeBSD kernel kern code
subr_hash.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
Include dependency graph for subr_hash.c:

Go to the source code of this file.

Macros

#define NPRIMES   (sizeof(primes) / sizeof(primes[0]))
 

Functions

 __FBSDID ("$BSDSUniX$")
 
void * hashinit_flags (int elements, struct malloc_type *type, u_long *hashmask, int flags)
 
void * hashinit (int elements, struct malloc_type *type, u_long *hashmask)
 
void hashdestroy (void *vhashtbl, struct malloc_type *type, u_long hashmask)
 
void * phashinit (int elements, struct malloc_type *type, u_long *nentries)
 

Variables

static const int primes []
 

Macro Definition Documentation

#define NPRIMES   (sizeof(primes) / sizeof(primes[0]))

Definition at line 103 of file subr_hash.c.

Referenced by phashinit().

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
void hashdestroy ( void *  vhashtbl,
struct malloc_type *  type,
u_long  hashmask 
)

Definition at line 90 of file subr_hash.c.

References free(), and LIST_HEAD().

Referenced by ksem_module_destroy().

Here is the call graph for this function:

Here is the caller graph for this function:

void* hashinit ( int  elements,
struct malloc_type *  type,
u_long *  hashmask 
)

Definition at line 83 of file subr_hash.c.

References hashinit_flags().

Referenced by kqueue_expand(), ksem_module_init(), LIST_HEAD(), nchinit(), procinit(), shm_init(), threadinit(), uihashinit(), and vntblinit().

Here is the call graph for this function:

Here is the caller graph for this function:

void* hashinit_flags ( int  elements,
struct malloc_type *  type,
u_long *  hashmask,
int  flags 
)

Definition at line 48 of file subr_hash.c.

References LIST_HEAD(), and malloc().

Referenced by hashinit().

Here is the call graph for this function:

Here is the caller graph for this function:

void* phashinit ( int  elements,
struct malloc_type *  type,
u_long *  nentries 
)

Definition at line 109 of file subr_hash.c.

References LIST_HEAD(), malloc(), NPRIMES, and primes.

Here is the call graph for this function:

Variable Documentation

const int primes[]
static
Initial value:
= { 1, 13, 31, 61, 127, 251, 509, 761, 1021, 1531,
2039, 2557, 3067, 3583, 4093, 4603, 5119, 5623, 6143,
6653, 7159, 7673, 8191, 12281, 16381, 24571, 32749 }

Definition at line 100 of file subr_hash.c.

Referenced by phashinit().