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   nitems(primes)
 

Functions

 __FBSDID ("$FreeBSD$")
 
static __inline int hash_mflags (int flags)
 
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_flags (int elements, struct malloc_type *type, u_long *nentries, int flags)
 
void * phashinit (int elements, struct malloc_type *type, u_long *nentries)
 

Variables

static const int primes []
 

Macro Definition Documentation

◆ NPRIMES

#define NPRIMES   nitems(primes)

Definition at line 107 of file subr_hash.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ hash_mflags()

static __inline int hash_mflags ( int  flags)
static

Definition at line 47 of file subr_hash.c.

References flags.

Referenced by hashinit_flags(), and phashinit_flags().

Here is the caller graph for this function:

◆ hashdestroy()

void hashdestroy ( void *  vhashtbl,
struct malloc_type *  type,
u_long  hashmask 
)

Definition at line 93 of file subr_hash.c.

References free(), LIST_HEAD(), and type.

Referenced by ksem_module_destroy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hashinit()

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

Definition at line 86 of file subr_hash.c.

References hashinit_flags(), and type.

Referenced by ksem_module_init(), procinit(), shm_init(), threadinit(), uihashinit(), vfs_hash_changesize(), and vntblinit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hashinit_flags()

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

Definition at line 57 of file subr_hash.c.

References flags, hash_mflags(), LIST_HEAD(), malloc(), and type.

Referenced by hashinit(), and kqueue_expand().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ phashinit()

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

Definition at line 148 of file subr_hash.c.

References phashinit_flags(), and type.

Here is the call graph for this function:

◆ phashinit_flags()

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

Definition at line 114 of file subr_hash.c.

References flags, hash_mflags(), LIST_HEAD(), malloc(), NPRIMES, primes, and type.

Referenced by phashinit().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ primes

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 104 of file subr_hash.c.

Referenced by phashinit_flags().