X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flib%2Fkernel%2Fhash.h;h=7f25c1025769327a88eeee4e202dffa20f28cedd;hb=718aee509380b413a12fcc9340e5a1084075632b;hp=b6423386c0929c122b76b24965890c70df6fdf15;hpb=4a566bcf1079a66800a17ca448625da4c9c06b43;p=pintos-anon diff --git a/src/lib/kernel/hash.h b/src/lib/kernel/hash.h index b642338..7f25c10 100644 --- a/src/lib/kernel/hash.h +++ b/src/lib/kernel/hash.h @@ -50,6 +50,10 @@ typedef bool hash_less_func (const struct hash_elem *a, const struct hash_elem *b, void *aux); +/* Performs some operation on hash element E, given auxiliary + data AUX. */ +typedef void hash_action_func (struct hash_elem *e, void *aux); + /* Hash table. */ struct hash { @@ -71,8 +75,8 @@ struct hash_iterator /* Basic life cycle. */ bool hash_init (struct hash *, hash_hash_func *, hash_less_func *, void *aux); -void hash_clear (struct hash *); -void hash_destroy (struct hash *); +void hash_clear (struct hash *, hash_action_func *); +void hash_destroy (struct hash *, hash_action_func *); /* Search, insertion, deletion. */ struct hash_elem *hash_insert (struct hash *, struct hash_elem *); @@ -81,6 +85,7 @@ struct hash_elem *hash_find (struct hash *, struct hash_elem *); struct hash_elem *hash_delete (struct hash *, struct hash_elem *); /* Iteration. */ +void hash_apply (struct hash *, hash_action_func *); void hash_first (struct hash_iterator *, struct hash *); struct hash_elem *hash_next (struct hash_iterator *); struct hash_elem *hash_cur (struct hash_iterator *);