20 #define SHASH_ERR_FOUND -4
21 #define SHASH_ERR_NOTFOUND -3
22 #define SHASH_ERR_BUFSZ -2
46 static inline uint64_t
47 cf_hash_fnv(
void *buf,
size_t bufsz)
49 uint64_t hash = 0xcbf29ce484222325ULL;
50 uint8_t *bufp = (uint8_t *)buf;
51 uint8_t *bufe = bufp + bufsz;
55 hash ^= (uint64_t)*bufp++;
58 hash *= 0x100000001b3ULL;
85 #define SHASH_ELEM_KEY_PTR(_h, _e) ( (void *) _e->data )
87 #define SHASH_ELEM_VALUE_PTR(_h, _e) ( (void *) (_e->data + _h->key_len) )
102 #define SHASH_ELEM_SZ(_h) ( sizeof(shash_elem) + (_h->key_len) + (_h->value_len) )
104 #define SHASH_CR_RESIZE 0x01 // support resizes (will sometimes hang for long periods)
105 #define SHASH_CR_GRAB 0x02 // support 'grab' call (requires more memory)
106 #define SHASH_CR_MT_BIGLOCK 0x04 // support multithreaded access with a single big lock
107 #define SHASH_CR_MT_MANYLOCK 0x08 // support multithreaded access with a pool of object loccks
109 #define SHASH_REDUCE_DELETE (1) // indicate that a delete should be done during the reduction