2001-09-28 17:08:44 +04:00
/*
2004-03-30 23:35:44 +04:00
* Copyright ( C ) 2001 - 2004 Sistina Software , Inc . All rights reserved .
* Copyright ( C ) 2004 Red Hat , Inc . All rights reserved .
2001-09-28 17:08:44 +04:00
*
2004-03-30 23:35:44 +04:00
* This file is part of LVM2 .
*
* This copyrighted material is made available to anyone wishing to use ,
* modify , copy , or redistribute it subject to the terms and conditions
* of the GNU General Public License v .2 .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software Foundation ,
* Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307 USA
2001-09-28 17:08:44 +04:00
*/
2001-10-01 19:14:39 +04:00
# ifndef _LVM_HASH_H
# define _LVM_HASH_H
2001-09-28 17:08:44 +04:00
struct hash_table ;
2001-10-03 15:06:31 +04:00
struct hash_node ;
2002-12-20 02:25:55 +03:00
typedef void ( * iterate_fn ) ( void * data ) ;
2001-09-28 17:08:44 +04:00
2001-10-03 15:06:31 +04:00
struct hash_table * hash_create ( unsigned size_hint ) ;
void hash_destroy ( struct hash_table * t ) ;
2001-10-24 21:53:50 +04:00
void hash_wipe ( struct hash_table * t ) ;
2001-09-28 17:08:44 +04:00
2001-10-22 18:14:00 +04:00
void * hash_lookup ( struct hash_table * t , const char * key ) ;
2001-10-04 14:13:07 +04:00
int hash_insert ( struct hash_table * t , const char * key , void * data ) ;
2001-09-28 17:08:44 +04:00
void hash_remove ( struct hash_table * t , const char * key ) ;
2004-06-18 19:08:22 +04:00
void * hash_lookup_binary ( struct hash_table * t , const char * key , uint32_t len ) ;
int hash_insert_binary ( struct hash_table * t , const char * key , uint32_t len ,
void * data ) ;
void hash_remove_binary ( struct hash_table * t , const char * key , uint32_t len ) ;
2001-09-28 17:08:44 +04:00
unsigned hash_get_num_entries ( struct hash_table * t ) ;
2002-02-25 14:52:58 +03:00
void hash_iter ( struct hash_table * t , iterate_fn f ) ;
2001-09-28 17:08:44 +04:00
2001-10-22 18:14:00 +04:00
char * hash_get_key ( struct hash_table * t , struct hash_node * n ) ;
2001-10-03 15:06:31 +04:00
void * hash_get_data ( struct hash_table * t , struct hash_node * n ) ;
struct hash_node * hash_get_first ( struct hash_table * t ) ;
struct hash_node * hash_get_next ( struct hash_table * t , struct hash_node * n ) ;
2002-02-25 14:52:58 +03:00
# define hash_iterate(v, h) \
for ( v = hash_get_first ( h ) ; v ; \
v = hash_get_next ( h , v ) )
2001-09-28 17:08:44 +04:00
# endif