Read USB mass storage sector count and sector size!
This commit is contained in:
@@ -3,4 +3,20 @@
|
||||
|
||||
#define BE2LE16(x) (((x) << 8) | (((x) >> 8)))
|
||||
|
||||
#define BE2LE32(x) \
|
||||
((((x) & 0x000000FF) << 24) | \
|
||||
(((x) & 0x0000FF00) << 8) | \
|
||||
(((x) & 0x00FF0000) >> 8) | \
|
||||
(((x) & 0xFF000000) >> 24))
|
||||
|
||||
#define BE2LE64(x) \
|
||||
((((x) & 0x00000000000000FFULL) << 56) | \
|
||||
(((x) & 0x000000000000FF00ULL) << 40) | \
|
||||
(((x) & 0x0000000000FF0000ULL) << 24) | \
|
||||
(((x) & 0x00000000FF000000ULL) << 8) | \
|
||||
(((x) & 0x000000FF00000000ULL) >> 8) | \
|
||||
(((x) & 0x0000FF0000000000ULL) >> 24) | \
|
||||
(((x) & 0x00FF000000000000ULL) >> 40) | \
|
||||
(((x) & 0xFF00000000000000ULL) >> 56))
|
||||
|
||||
#endif // _KERNEL_LIBK_ENDIANESS_H
|
||||
|
||||
@@ -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