Read USB mass storage sector count and sector size!
This commit is contained in:
@@ -30,6 +30,31 @@ static inline uint32_t hash_fnv32 (const void* data, size_t len) {
|
||||
(table)->buckets_name[__idx] = (new_link); \
|
||||
} while (0)
|
||||
|
||||
#define hash_delete(table, key_ptr, key_size, hash_val, table_size, buckets_name, type, member, \
|
||||
key_field, out_link) \
|
||||
do { \
|
||||
uint32_t __idx = (hash_val) % (table_size); \
|
||||
struct hash_node_link* __curr = (table)->buckets_name[__idx]; \
|
||||
struct hash_node_link* __prev = NULL; \
|
||||
(out_link) = NULL; \
|
||||
while (__curr) { \
|
||||
if (__curr->hash == (hash_val)) { \
|
||||
type* __entry = hash_entry (__curr, type, member); \
|
||||
if (memcmp (__entry->key_field, (key_ptr), (key_size)) == 0) { \
|
||||
if (__prev != NULL) { \
|
||||
__prev->next = __curr->next; \
|
||||
} else { \
|
||||
(table)->buckets_name[__idx] = __curr->next; \
|
||||
} \
|
||||
(out_link) = __curr; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
__prev = __curr; \
|
||||
__curr = __curr->next; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define hash_find(table, key_ptr, key_size, hash_val, table_size, buckets_name, type, member, \
|
||||
key_field, out_link) \
|
||||
do { \
|
||||
|
||||
Reference in New Issue
Block a user