Changeset 0db0df2 in mainline for uspace/lib
- Timestamp:
- 2025-04-07T17:53:53Z (3 months ago)
- Branches:
- master
- Children:
- 45226285, 93de384
- Parents:
- 8f8818ac
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-07 16:41:57)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-07 17:53:53)
- Location:
- uspace/lib
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/block/block.c
r8f8818ac r0db0df2 254 254 } 255 255 256 static bool cache_key_equal(const void *key, const ht_link_t *item)256 static bool cache_key_equal(const void *key, size_t hash, const ht_link_t *item) 257 257 { 258 258 const aoff64_t *lba = key; -
uspace/lib/c/generic/async/ports.c
r8f8818ac r0db0df2 50 50 #include <as.h> 51 51 #include <abi/mm/as.h> 52 #include "../private/libc.h"53 52 #include "../private/fibril.h" 54 53 … … 115 114 } 116 115 117 static bool interface_key_equal(const void *key, const ht_link_t *item)116 static bool interface_key_equal(const void *key, size_t hash, const ht_link_t *item) 118 117 { 119 118 const iface_t *iface = key; … … 143 142 } 144 143 145 static bool port_key_equal(const void *key, const ht_link_t *item)144 static bool port_key_equal(const void *key, size_t hash, const ht_link_t *item) 146 145 { 147 146 const port_id_t *port_id = key; -
uspace/lib/c/generic/async/server.c
r8f8818ac r0db0df2 242 242 } 243 243 244 static bool client_key_equal(const void *key, const ht_link_t *item)244 static bool client_key_equal(const void *key, size_t, const ht_link_t *item) 245 245 { 246 246 const task_id_t *in_task_id = key; … … 502 502 } 503 503 504 static bool notification_key_equal(const void *key, const ht_link_t *item)504 static bool notification_key_equal(const void *key, size_t hash, const ht_link_t *item) 505 505 { 506 506 const sysarg_t *id = key; -
uspace/lib/ext4/src/ops.c
r8f8818ac r0db0df2 113 113 } 114 114 115 static bool open_nodes_key_equal(const void *key_arg, const ht_link_t *item)115 static bool open_nodes_key_equal(const void *key_arg, size_t hash, const ht_link_t *item) 116 116 { 117 117 const node_key_t *key = key_arg; -
uspace/lib/nic/src/nic_addr_db.c
r8f8818ac r0db0df2 52 52 typedef struct nic_addr_entry { 53 53 ht_link_t link; 54 size_t hash; 54 55 uint8_t len; 55 uint8_t addr[ 1];56 uint8_t addr[]; 56 57 } nic_addr_entry_t; 57 58 … … 60 61 */ 61 62 typedef struct { 63 size_t hash; 62 64 size_t len; 63 65 const uint8_t *addr; 64 66 } addr_key_t; 65 67 66 static bool nic_addr_key_equal(const void *key_arg, const ht_link_t *item)68 static bool nic_addr_key_equal(const void *key_arg, size_t hash, const ht_link_t *item) 67 69 { 68 70 const addr_key_t *key = key_arg; 69 71 nic_addr_entry_t *entry = member_to_inst(item, nic_addr_entry_t, link); 70 71 return memcmp(entry->addr, key->addr, entry->len) == 0; 72 return entry->hash == hash && memcmp(entry->addr, key->addr, entry->len) == 0; 72 73 } 73 74 … … 86 87 { 87 88 const addr_key_t *key = k; 88 return addr_hash(key->len, key->addr);89 return key->hash ? key->hash : addr_hash(key->len, key->addr); 89 90 } 90 91 … … 92 93 { 93 94 nic_addr_entry_t *entry = member_to_inst(item, nic_addr_entry_t, link); 94 return addr_hash(entry->len, entry->addr);95 return entry->hash; 95 96 } 96 97 … … 98 99 { 99 100 nic_addr_entry_t *entry = member_to_inst(item, nic_addr_entry_t, link); 100 101 101 free(entry); 102 102 } … … 173 173 addr_key_t key = { 174 174 .len = db->addr_len, 175 .addr = addr 175 .addr = addr, 176 .hash = addr_hash(db->addr_len, addr), 176 177 }; 177 178 … … 179 180 return EEXIST; 180 181 181 nic_addr_entry_t *entry = malloc( sizeof(nic_addr_entry_t) + db->addr_len - 1);182 nic_addr_entry_t *entry = malloc(offsetof(nic_addr_entry_t, addr) + db->addr_len); 182 183 if (entry == NULL) 183 184 return ENOMEM; … … 185 186 entry->len = (uint8_t) db->addr_len; 186 187 memcpy(entry->addr, addr, db->addr_len); 188 entry->hash = key.hash; 187 189 188 190 hash_table_insert(&db->set, &entry->link); -
uspace/lib/nic/src/nic_wol_virtues.c
r8f8818ac r0db0df2 57 57 } 58 58 59 static bool nic_wv_key_equal(const void *key, const ht_link_t *item)59 static bool nic_wv_key_equal(const void *key, size_t hash, const ht_link_t *item) 60 60 { 61 61 const nic_wv_id_t *k = key;
Note:
See TracChangeset
for help on using the changeset viewer.