pintos/src/lib/kernel/hash.h File Reference

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "list.h"

Go to the source code of this file.

Data Structures

struct  hash_elem
struct  hash
struct  hash_iterator

Defines

#define hash_entry(HASH_ELEM, STRUCT, MEMBER)

Typedefs

typedef unsigned hash_hash_func (const struct hash_elem *e, void *aux)
typedef bool hash_less_func (const struct hash_elem *a, const struct hash_elem *b, void *aux)
typedef void hash_action_func (struct hash_elem *e, void *aux)

Functions

bool hash_init (struct hash *, hash_hash_func *, hash_less_func *, void *aux)
void hash_clear (struct hash *, hash_action_func *)
void hash_destroy (struct hash *, hash_action_func *)
struct hash_elemhash_insert (struct hash *, struct hash_elem *)
struct hash_elemhash_replace (struct hash *, struct hash_elem *)
struct hash_elemhash_find (struct hash *, struct hash_elem *)
struct hash_elemhash_delete (struct hash *, struct hash_elem *)
void hash_apply (struct hash *, hash_action_func *)
void hash_first (struct hash_iterator *, struct hash *)
struct hash_elemhash_next (struct hash_iterator *)
struct hash_elemhash_cur (struct hash_iterator *)
size_t hash_size (struct hash *)
bool hash_empty (struct hash *)
unsigned hash_bytes (const void *, size_t)
unsigned hash_string (const char *)
unsigned hash_int (int)


Define Documentation

#define hash_entry ( HASH_ELEM,
STRUCT,
MEMBER   ) 

Value:

((STRUCT *) ((uint8_t *) &(HASH_ELEM)->list_elem        \
                     - offsetof (STRUCT, MEMBER.list_elem)))

Definition at line 39 of file hash.h.


Typedef Documentation

typedef void hash_action_func(struct hash_elem *e, void *aux)

Definition at line 56 of file hash.h.

typedef unsigned hash_hash_func(const struct hash_elem *e, void *aux)

Definition at line 45 of file hash.h.

typedef bool hash_less_func(const struct hash_elem *a, const struct hash_elem *b, void *aux)

Definition at line 50 of file hash.h.


Function Documentation

void hash_apply ( struct hash ,
hash_action_func  
)

unsigned hash_bytes ( const void *  ,
size_t   
)

Definition at line 266 of file hash.c.

References ASSERT, buf, FNV_32_BASIS, FNV_32_PRIME, and NULL.

Referenced by hash_int().

void hash_clear ( struct hash ,
hash_action_func  
)

struct hash_elem* hash_cur ( struct hash_iterator  )  [read]

Definition at line 241 of file hash.c.

References hash_iterator::elem.

struct hash_elem* hash_delete ( struct hash ,
struct hash_elem  
) [read]

Definition at line 145 of file hash.c.

References find_bucket(), find_elem(), NULL, rehash(), and remove_elem().

void hash_destroy ( struct hash ,
hash_action_func  
)

Definition at line 87 of file hash.c.

References hash::buckets, free(), hash_clear(), and NULL.

bool hash_empty ( struct hash  ) 

Definition at line 255 of file hash.c.

References hash::elem_cnt.

struct hash_elem* hash_find ( struct hash ,
struct hash_elem  
) [read]

Definition at line 132 of file hash.c.

References find_bucket(), and find_elem().

void hash_first ( struct hash_iterator ,
struct hash  
)

bool hash_init ( struct hash ,
hash_hash_func ,
hash_less_func ,
void *  aux 
)

struct hash_elem* hash_insert ( struct hash ,
struct hash_elem  
) [read]

Definition at line 99 of file hash.c.

References find_bucket(), find_elem(), insert_elem(), NULL, and rehash().

unsigned hash_int ( int   ) 

Definition at line 299 of file hash.c.

References hash_bytes().

struct hash_elem* hash_next ( struct hash_iterator  )  [read]

struct hash_elem* hash_replace ( struct hash ,
struct hash_elem  
) [read]

Definition at line 115 of file hash.c.

References find_bucket(), find_elem(), insert_elem(), NULL, rehash(), and remove_elem().

size_t hash_size ( struct hash  ) 

Definition at line 248 of file hash.c.

References hash::elem_cnt.

unsigned hash_string ( const char *   ) 

Definition at line 283 of file hash.c.

References ASSERT, FNV_32_BASIS, FNV_32_PRIME, NULL, and s.


Generated on Mon Jan 10 16:43:58 2011 for Pintos by  doxygen 1.5.6