Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 12cb03d in mainline


Ignore:
Timestamp:
2011-12-06T23:32:20Z (10 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
3342f33
Parents:
b4e59b3
Message:

WIP: implement the used segment hash table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/lib/ra.c

    rb4e59b3 r12cb03d  
    5454#include <macros.h>
    5555
     56#define USED_BUCKETS    1024
     57
     58static size_t used_hash(sysarg_t *key)
     59{
     60        return ((*key >> 2) & (USED_BUCKETS - 1));
     61}
     62
     63static bool used_compare(sysarg_t *key, size_t keys, link_t *item)
     64{
     65        ra_segment_t *seg;
     66
     67        seg = hash_table_get_instance(item, ra_segment_t, fu_link);
     68        return seg->base == *key;
     69}
     70
    5671static hash_table_operations_t used_ops = {
    57         .hash = NULL,
    58         .compare = NULL,
     72        .hash = used_hash,
     73        .compare = used_compare,
    5974        .remove_callback = NULL,
    6075};
     
    142157        list_initialize(&span->segments);
    143158
    144         hash_table_create(&span->used, span->max_order + 1, 1, &used_ops);
     159        hash_table_create(&span->used, USED_BUCKETS, 1, &used_ops);
    145160
    146161        for (i = 0; i < span->max_order; i++)
Note: See TracChangeset for help on using the changeset viewer.