Changeset 5e801dc in mainline
- Timestamp:
- 2019-02-25T14:42:38Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a4e78743
- Parents:
- ee8d4d6
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-25 14:42:38)
- git-committer:
- GitHub <noreply@…> (2019-02-25 14:42:38)
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified kernel/genarch/src/mm/page_ht.c ¶
ree8d4d6 r5e801dc 54 54 55 55 static size_t ht_hash(const ht_link_t *); 56 static size_t ht_key_hash( void *);57 static bool ht_key_equal( void *, const ht_link_t *);56 static size_t ht_key_hash(const void *); 57 static bool ht_key_equal(const void *, const ht_link_t *); 58 58 static void ht_remove_callback(ht_link_t *); 59 59 … … 109 109 110 110 /** Return the hash of the key. */ 111 size_t ht_key_hash( void *arg)112 { 113 uintptr_t *key = (uintptr_t *)arg;111 size_t ht_key_hash(const void *arg) 112 { 113 const uintptr_t *key = arg; 114 114 size_t hash = 0; 115 115 hash = hash_combine(hash, key[KEY_AS]); … … 119 119 120 120 /** Return true if the key is equal to the item's lookup key. */ 121 bool ht_key_equal( void *arg, const ht_link_t *item)122 { 123 uintptr_t *key = (uintptr_t *)arg;121 bool ht_key_equal(const void *arg, const ht_link_t *item) 122 { 123 const uintptr_t *key = arg; 124 124 pte_t *pte = hash_table_get_inst(item, pte_t, link); 125 125 return (key[KEY_AS] == (uintptr_t) pte->as) && -
TabularUnified kernel/generic/include/adt/hash_table.h ¶
ree8d4d6 r5e801dc 53 53 54 54 /** Returns the hash of the key. */ 55 size_t (*key_hash)( void *key);55 size_t (*key_hash)(const void *key); 56 56 57 57 /** True if the items are equal (have the same lookup keys). */ … … 59 59 60 60 /** Returns true if the key is equal to the item's lookup key. */ 61 bool (*key_equal)( void *key, const ht_link_t *item);61 bool (*key_equal)(const void *key, const ht_link_t *item); 62 62 63 63 /** Hash table item removal callback. … … 94 94 extern void hash_table_insert(hash_table_t *, ht_link_t *); 95 95 extern bool hash_table_insert_unique(hash_table_t *, ht_link_t *); 96 extern ht_link_t *hash_table_find(const hash_table_t *, void *);96 extern ht_link_t *hash_table_find(const hash_table_t *, const void *); 97 97 extern ht_link_t *hash_table_find_next(const hash_table_t *, ht_link_t *, 98 98 ht_link_t *); 99 extern size_t hash_table_remove(hash_table_t *, void *);99 extern size_t hash_table_remove(hash_table_t *, const void *); 100 100 extern void hash_table_remove_item(hash_table_t *, ht_link_t *); 101 101 extern void hash_table_apply(hash_table_t *, bool (*)(ht_link_t *, void *), -
TabularUnified kernel/generic/src/adt/hash_table.c ¶
ree8d4d6 r5e801dc 51 51 #include <adt/hash_table.h> 52 52 #include <adt/list.h> 53 #include <assert.h> 53 54 #include <stdlib.h> 54 #include <assert.h>55 55 #include <str.h> 56 56 … … 245 245 * 246 246 */ 247 ht_link_t *hash_table_find(const hash_table_t *h, void *key)247 ht_link_t *hash_table_find(const hash_table_t *h, const void *key) 248 248 { 249 249 assert(h && h->bucket); … … 306 306 * @return Returns the number of removed items. 307 307 */ 308 size_t hash_table_remove(hash_table_t *h, void *key)308 size_t hash_table_remove(hash_table_t *h, const void *key) 309 309 { 310 310 assert(h && h->bucket); -
TabularUnified kernel/generic/src/cap/cap.c ¶
ree8d4d6 r5e801dc 101 101 } 102 102 103 static size_t caps_key_hash( void *key)104 { 105 c ap_handle_t *handle = (cap_handle_t *)key;103 static size_t caps_key_hash(const void *key) 104 { 105 const cap_handle_t *handle = key; 106 106 return hash_mix(cap_handle_raw(*handle)); 107 107 } 108 108 109 static bool caps_key_equal( void *key, const ht_link_t *item)110 { 111 c ap_handle_t *handle = (cap_handle_t *)key;109 static bool caps_key_equal(const void *key, const ht_link_t *item) 110 { 111 const cap_handle_t *handle = key; 112 112 cap_t *cap = hash_table_get_inst(item, cap_t, caps_link); 113 113 return *handle == cap->handle; -
TabularUnified kernel/generic/src/ddi/irq.c ¶
ree8d4d6 r5e801dc 73 73 74 74 static size_t irq_ht_hash(const ht_link_t *); 75 static size_t irq_ht_key_hash( void *);75 static size_t irq_ht_key_hash(const void *); 76 76 static bool irq_ht_equal(const ht_link_t *, const ht_link_t *); 77 static bool irq_ht_key_equal( void *, const ht_link_t *);77 static bool irq_ht_key_equal(const void *, const ht_link_t *); 78 78 79 79 static hash_table_ops_t irq_ht_ops = { … … 208 208 209 209 /** Return the hash of the key. */ 210 size_t irq_ht_key_hash( void *key)211 { 212 inr_t *inr = (inr_t *)key;210 size_t irq_ht_key_hash(const void *key) 211 { 212 const inr_t *inr = key; 213 213 return hash_mix(*inr); 214 214 } … … 223 223 224 224 /** Return true if the key is equal to the item's lookup key. */ 225 bool irq_ht_key_equal( void *key, const ht_link_t *item)226 { 227 inr_t *inr = (inr_t *)key;225 bool irq_ht_key_equal(const void *key, const ht_link_t *item) 226 { 227 const inr_t *inr = key; 228 228 irq_t *irq = hash_table_get_inst(item, irq_t, link); 229 229 return irq->inr == *inr; -
TabularUnified kernel/generic/src/lib/ra.c ¶
ree8d4d6 r5e801dc 67 67 68 68 /** Return the hash of the key */ 69 static size_t used_key_hash( void *key)70 { 71 uintptr_t *base = (uintptr_t *)key;69 static size_t used_key_hash(const void *key) 70 { 71 const uintptr_t *base = key; 72 72 return hash_mix(*base); 73 73 } 74 74 75 75 /** Return true if the key is equal to the item's lookup key */ 76 static bool used_key_equal( void *key, const ht_link_t *item)77 { 78 uintptr_t *base = (uintptr_t *)key;76 static bool used_key_equal(const void *key, const ht_link_t *item) 77 { 78 const uintptr_t *base = key; 79 79 ra_segment_t *seg = hash_table_get_inst(item, ra_segment_t, uh_link); 80 80 return seg->base == *base; -
TabularUnified uspace/app/hbench/env.c ¶
ree8d4d6 r5e801dc 52 52 } 53 53 54 static size_t param_key_hash( void *key)54 static size_t param_key_hash(const void *key) 55 55 { 56 c har *key_str = key;56 const char *key_str = key; 57 57 return str_size(key_str); 58 58 } 59 59 60 static bool param_key_equal( void *key, const ht_link_t *item)60 static bool param_key_equal(const void *key, const ht_link_t *item) 61 61 { 62 62 param_t *param = hash_table_get_inst(item, param_t, link); 63 c har *key_str = key;63 const char *key_str = key; 64 64 65 65 return str_cmp(param->key, key_str) == 0; -
TabularUnified uspace/app/trace/ipcp.c ¶
ree8d4d6 r5e801dc 72 72 proto_t *proto_unknown; /**< Protocol with no known methods. */ 73 73 74 static size_t pending_call_key_hash( void *key)75 { 76 c ap_call_handle_t *chandle = (cap_call_handle_t *)key;74 static size_t pending_call_key_hash(const void *key) 75 { 76 const cap_call_handle_t *chandle = key; 77 77 return cap_handle_raw(*chandle); 78 78 } … … 84 84 } 85 85 86 static bool pending_call_key_equal( void *key, const ht_link_t *item)87 { 88 c ap_call_handle_t *chandle = (cap_call_handle_t *)key;86 static bool pending_call_key_equal(const void *key, const ht_link_t *item) 87 { 88 const cap_call_handle_t *chandle = key; 89 89 pending_call_t *hs = hash_table_get_inst(item, pending_call_t, link); 90 90 -
TabularUnified uspace/app/trace/proto.c ¶
ree8d4d6 r5e801dc 57 57 /* Hash table operations. */ 58 58 59 static size_t srv_proto_key_hash(void *key) 60 { 61 return *(int *)key; 59 static size_t srv_proto_key_hash(const void *key) 60 { 61 const int *n = key; 62 return *n; 62 63 } 63 64 … … 68 69 } 69 70 70 static bool srv_proto_key_equal(void *key, const ht_link_t *item) 71 { 71 static bool srv_proto_key_equal(const void *key, const ht_link_t *item) 72 { 73 const int *n = key; 72 74 srv_proto_t *sp = hash_table_get_inst(item, srv_proto_t, link); 73 return sp->srv == * (int *)key;75 return sp->srv == *n; 74 76 } 75 77 … … 82 84 }; 83 85 84 static size_t method_oper_key_hash(void *key) 85 { 86 return *(int *)key; 86 static size_t method_oper_key_hash(const void *key) 87 { 88 const int *n = key; 89 return *n; 87 90 } 88 91 … … 93 96 } 94 97 95 static bool method_oper_key_equal(void *key, const ht_link_t *item) 96 { 98 static bool method_oper_key_equal(const void *key, const ht_link_t *item) 99 { 100 const int *n = key; 97 101 method_oper_t *mo = hash_table_get_inst(item, method_oper_t, link); 98 return mo->method == * (int *)key;102 return mo->method == *n; 99 103 } 100 104 -
TabularUnified uspace/lib/block/block.c ¶
ree8d4d6 r5e801dc 241 241 } 242 242 243 static size_t cache_key_hash( void *key)244 { 245 aoff64_t *lba = (aoff64_t *)key;243 static size_t cache_key_hash(const void *key) 244 { 245 const aoff64_t *lba = key; 246 246 return *lba; 247 247 } … … 253 253 } 254 254 255 static bool cache_key_equal( void *key, const ht_link_t *item)256 { 257 aoff64_t *lba = (aoff64_t *)key;255 static bool cache_key_equal(const void *key, const ht_link_t *item) 256 { 257 const aoff64_t *lba = key; 258 258 block_t *b = hash_table_get_inst(item, block_t, hash_link); 259 259 return b->lba == *lba; -
TabularUnified uspace/lib/c/generic/adt/hash_table.c ¶
ree8d4d6 r5e801dc 245 245 * 246 246 */ 247 ht_link_t *hash_table_find(const hash_table_t *h, void *key)247 ht_link_t *hash_table_find(const hash_table_t *h, const void *key) 248 248 { 249 249 assert(h && h->bucket); … … 303 303 * @param key Array of keys that will be compared against items of 304 304 * the hash table. 305 * @param keys Number of keys in the 'key' array.306 305 * 307 306 * @return Returns the number of removed items. 308 307 */ 309 size_t hash_table_remove(hash_table_t *h, void *key)308 size_t hash_table_remove(hash_table_t *h, const void *key) 310 309 { 311 310 assert(h && h->bucket); -
TabularUnified uspace/lib/c/generic/async/ports.c ¶
ree8d4d6 r5e801dc 103 103 static hash_table_t interface_hash_table; 104 104 105 static size_t interface_key_hash( void *key)106 { 107 iface_t iface = *(iface_t *)key;108 return iface;105 static size_t interface_key_hash(const void *key) 106 { 107 const iface_t *iface = key; 108 return *iface; 109 109 } 110 110 … … 115 115 } 116 116 117 static bool interface_key_equal( void *key, const ht_link_t *item)118 { 119 iface_t iface = *(iface_t *)key;117 static bool interface_key_equal(const void *key, const ht_link_t *item) 118 { 119 const iface_t *iface = key; 120 120 interface_t *interface = hash_table_get_inst(item, interface_t, link); 121 return iface == interface->iface;121 return *iface == interface->iface; 122 122 } 123 123 … … 131 131 }; 132 132 133 static size_t port_key_hash( void *key)134 { 135 port_id_t port_id = *(port_id_t *)key;136 return port_id;133 static size_t port_key_hash(const void *key) 134 { 135 const port_id_t *port_id = key; 136 return *port_id; 137 137 } 138 138 … … 143 143 } 144 144 145 static bool port_key_equal( void *key, const ht_link_t *item)146 { 147 port_id_t port_id = *(port_id_t *)key;145 static bool port_key_equal(const void *key, const ht_link_t *item) 146 { 147 const port_id_t *port_id = key; 148 148 port_t *port = hash_table_get_inst(item, port_t, link); 149 return port_id == port->id;149 return *port_id == port->id; 150 150 } 151 151 -
TabularUnified uspace/lib/c/generic/async/server.c ¶
ree8d4d6 r5e801dc 231 231 static sysarg_t notification_avail = 0; 232 232 233 static size_t client_key_hash( void *key)234 { 235 task_id_t in_task_id = *(task_id_t *)key;236 return in_task_id;233 static size_t client_key_hash(const void *key) 234 { 235 const task_id_t *in_task_id = key; 236 return *in_task_id; 237 237 } 238 238 … … 243 243 } 244 244 245 static bool client_key_equal( void *key, const ht_link_t *item)246 { 247 task_id_t in_task_id = *(task_id_t *)key;245 static bool client_key_equal(const void *key, const ht_link_t *item) 246 { 247 const task_id_t *in_task_id = key; 248 248 client_t *client = hash_table_get_inst(item, client_t, link); 249 return in_task_id == client->in_task_id;249 return *in_task_id == client->in_task_id; 250 250 } 251 251 … … 490 490 } 491 491 492 static size_t notification_key_hash( void *key)493 { 494 sysarg_t id = *(sysarg_t *)key;495 return id;492 static size_t notification_key_hash(const void *key) 493 { 494 const sysarg_t *id = key; 495 return *id; 496 496 } 497 497 … … 503 503 } 504 504 505 static bool notification_key_equal( void *key, const ht_link_t *item)506 { 507 sysarg_t id = *(sysarg_t *)key;505 static bool notification_key_equal(const void *key, const ht_link_t *item) 506 { 507 const sysarg_t *id = key; 508 508 notification_t *notification = 509 509 hash_table_get_inst(item, notification_t, htlink); 510 return id == notification->imethod;510 return *id == notification->imethod; 511 511 } 512 512 -
TabularUnified uspace/lib/c/include/adt/hash_table.h ¶
ree8d4d6 r5e801dc 53 53 54 54 /** Returns the hash of the key. */ 55 size_t (*key_hash)( void *key);55 size_t (*key_hash)(const void *key); 56 56 57 57 /** True if the items are equal (have the same lookup keys). */ … … 59 59 60 60 /** Returns true if the key is equal to the item's lookup key. */ 61 bool (*key_equal)( void *key, const ht_link_t *item);61 bool (*key_equal)(const void *key, const ht_link_t *item); 62 62 63 63 /** Hash table item removal callback. … … 94 94 extern void hash_table_insert(hash_table_t *, ht_link_t *); 95 95 extern bool hash_table_insert_unique(hash_table_t *, ht_link_t *); 96 extern ht_link_t *hash_table_find(const hash_table_t *, void *);96 extern ht_link_t *hash_table_find(const hash_table_t *, const void *); 97 97 extern ht_link_t *hash_table_find_next(const hash_table_t *, ht_link_t *, 98 98 ht_link_t *); 99 extern size_t hash_table_remove(hash_table_t *, void *);99 extern size_t hash_table_remove(hash_table_t *, const void *); 100 100 extern void hash_table_remove_item(hash_table_t *, ht_link_t *); 101 101 extern void hash_table_apply(hash_table_t *, bool (*)(ht_link_t *, void *), -
TabularUnified uspace/lib/ext4/src/ops.c ¶
ree8d4d6 r5e801dc 101 101 } node_key_t; 102 102 103 static size_t open_nodes_key_hash( void *key_arg)104 { 105 node_key_t *key = (node_key_t *)key_arg;103 static size_t open_nodes_key_hash(const void *key_arg) 104 { 105 const node_key_t *key = key_arg; 106 106 return hash_combine(key->service_id, key->index); 107 107 } … … 113 113 } 114 114 115 static bool open_nodes_key_equal( void *key_arg, const ht_link_t *item)116 { 117 node_key_t *key = (node_key_t *)key_arg;115 static bool open_nodes_key_equal(const void *key_arg, const ht_link_t *item) 116 { 117 const node_key_t *key = key_arg; 118 118 ext4_node_t *enode = hash_table_get_inst(item, ext4_node_t, link); 119 119 -
TabularUnified uspace/lib/nic/src/nic_addr_db.c ¶
ree8d4d6 r5e801dc 62 62 } addr_key_t; 63 63 64 static bool nic_addr_key_equal( void *key_arg, const ht_link_t *item)65 { 66 addr_key_t *key = (addr_key_t *)key_arg;64 static bool nic_addr_key_equal(const void *key_arg, const ht_link_t *item) 65 { 66 const addr_key_t *key = key_arg; 67 67 nic_addr_entry_t *entry = member_to_inst(item, nic_addr_entry_t, link); 68 68 … … 81 81 } 82 82 83 static size_t nic_addr_key_hash( void *k)84 { 85 addr_key_t *key = (addr_key_t *)k;83 static size_t nic_addr_key_hash(const void *k) 84 { 85 const addr_key_t *key = k; 86 86 return addr_hash(key->len, key->addr); 87 87 } -
TabularUnified uspace/lib/nic/src/nic_wol_virtues.c ¶
ree8d4d6 r5e801dc 45 45 */ 46 46 47 static size_t nic_wv_key_hash(void *key) 48 { 49 return *(nic_wv_id_t *) key; 47 static size_t nic_wv_key_hash(const void *key) 48 { 49 const nic_wv_id_t *k = key; 50 return *k; 50 51 } 51 52 … … 56 57 } 57 58 58 static bool nic_wv_key_equal(void *key, const ht_link_t *item) 59 { 60 nic_wol_virtue_t *virtue = (nic_wol_virtue_t *) item; 61 return (virtue->id == *(nic_wv_id_t *) key); 59 static bool nic_wv_key_equal(const void *key, const ht_link_t *item) 60 { 61 const nic_wv_id_t *k = key; 62 const nic_wol_virtue_t *virtue = (const nic_wol_virtue_t *) item; 63 return (virtue->id == *k); 62 64 } 63 65 -
TabularUnified uspace/srv/devman/devtree.c ¶
ree8d4d6 r5e801dc 42 42 /* hash table operations */ 43 43 44 static inline size_t handle_key_hash( void *key)45 { 46 devman_handle_t handle = *(devman_handle_t *)key;47 return handle;44 static inline size_t handle_key_hash(const void *key) 45 { 46 const devman_handle_t *handle = key; 47 return *handle; 48 48 } 49 49 … … 60 60 } 61 61 62 static bool devman_devices_key_equal( void *key, const ht_link_t *item)63 { 64 devman_handle_t handle = *(devman_handle_t *)key;62 static bool devman_devices_key_equal(const void *key, const ht_link_t *item) 63 { 64 const devman_handle_t *handle = key; 65 65 dev_node_t *dev = hash_table_get_inst(item, dev_node_t, devman_dev); 66 return dev->handle == handle;67 } 68 69 static bool devman_functions_key_equal( void *key, const ht_link_t *item)70 { 71 devman_handle_t handle = *(devman_handle_t *)key;66 return dev->handle == *handle; 67 } 68 69 static bool devman_functions_key_equal(const void *key, const ht_link_t *item) 70 { 71 const devman_handle_t *handle = key; 72 72 fun_node_t *fun = hash_table_get_inst(item, fun_node_t, devman_fun); 73 return fun->handle == handle;74 } 75 76 static inline size_t service_id_key_hash( void *key)77 { 78 service_id_t service_id = *(service_id_t *)key;79 return service_id;73 return fun->handle == *handle; 74 } 75 76 static inline size_t service_id_key_hash(const void *key) 77 { 78 const service_id_t *service_id = key; 79 return *service_id; 80 80 } 81 81 … … 86 86 } 87 87 88 static bool loc_functions_key_equal( void *key, const ht_link_t *item)89 { 90 service_id_t service_id = *(service_id_t *)key;88 static bool loc_functions_key_equal(const void *key, const ht_link_t *item) 89 { 90 const service_id_t *service_id = key; 91 91 fun_node_t *fun = hash_table_get_inst(item, fun_node_t, loc_fun); 92 return fun->service_id == service_id;92 return fun->service_id == *service_id; 93 93 } 94 94 -
TabularUnified uspace/srv/fs/cdfs/cdfs_ops.c ¶
ree8d4d6 r5e801dc 285 285 } ht_key_t; 286 286 287 static size_t nodes_key_hash( void *k)288 { 289 ht_key_t *key = (ht_key_t *)k;287 static size_t nodes_key_hash(const void *k) 288 { 289 const ht_key_t *key = k; 290 290 return hash_combine(key->service_id, key->index); 291 291 } … … 297 297 } 298 298 299 static bool nodes_key_equal( void *k, const ht_link_t *item)299 static bool nodes_key_equal(const void *k, const ht_link_t *item) 300 300 { 301 301 cdfs_node_t *node = hash_table_get_inst(item, cdfs_node_t, nh_link); 302 ht_key_t *key = (ht_key_t *)k;302 const ht_key_t *key = k; 303 303 304 304 return key->service_id == node->fs->service_id && key->index == node->index; -
TabularUnified uspace/srv/fs/exfat/exfat_idx.c ¶
ree8d4d6 r5e801dc 117 117 } pos_key_t; 118 118 119 static inline size_t pos_key_hash( void *key)120 { 121 pos_key_t *pos = (pos_key_t *)key;119 static inline size_t pos_key_hash(const void *key) 120 { 121 const pos_key_t *pos = key; 122 122 123 123 size_t hash = 0; … … 139 139 } 140 140 141 static bool pos_key_equal( void *key, const ht_link_t *item)142 { 143 pos_key_t *pos = (pos_key_t *)key;141 static bool pos_key_equal(const void *key, const ht_link_t *item) 142 { 143 const pos_key_t *pos = key; 144 144 exfat_idx_t *fidx = hash_table_get_inst(item, exfat_idx_t, uph_link); 145 145 … … 168 168 } idx_key_t; 169 169 170 static size_t idx_key_hash( void *key_arg)171 { 172 idx_key_t *key = (idx_key_t *)key_arg;170 static size_t idx_key_hash(const void *key_arg) 171 { 172 const idx_key_t *key = key_arg; 173 173 return hash_combine(key->service_id, key->index); 174 174 } … … 180 180 } 181 181 182 static bool idx_key_equal( void *key_arg, const ht_link_t *item)182 static bool idx_key_equal(const void *key_arg, const ht_link_t *item) 183 183 { 184 184 exfat_idx_t *fidx = hash_table_get_inst(item, exfat_idx_t, uih_link); 185 idx_key_t *key = (idx_key_t *)key_arg;185 const idx_key_t *key = key_arg; 186 186 187 187 return key->index == fidx->index && key->service_id == fidx->service_id; -
TabularUnified uspace/srv/fs/fat/fat_idx.c ¶
ree8d4d6 r5e801dc 117 117 } pos_key_t; 118 118 119 static inline size_t pos_key_hash( void *key)120 { 121 pos_key_t *pos = (pos_key_t *)key;119 static inline size_t pos_key_hash(const void *key) 120 { 121 const pos_key_t *pos = key; 122 122 123 123 size_t hash = 0; … … 139 139 } 140 140 141 static bool pos_key_equal( void *key, const ht_link_t *item)142 { 143 pos_key_t *pos = (pos_key_t *)key;141 static bool pos_key_equal(const void *key, const ht_link_t *item) 142 { 143 const pos_key_t *pos = key; 144 144 fat_idx_t *fidx = hash_table_get_inst(item, fat_idx_t, uph_link); 145 145 … … 168 168 } idx_key_t; 169 169 170 static size_t idx_key_hash( void *key_arg)171 { 172 idx_key_t *key = (idx_key_t *)key_arg;170 static size_t idx_key_hash(const void *key_arg) 171 { 172 const idx_key_t *key = key_arg; 173 173 return hash_combine(key->service_id, key->index); 174 174 } … … 180 180 } 181 181 182 static bool idx_key_equal( void *key_arg, const ht_link_t *item)182 static bool idx_key_equal(const void *key_arg, const ht_link_t *item) 183 183 { 184 184 fat_idx_t *fidx = hash_table_get_inst(item, fat_idx_t, uih_link); 185 idx_key_t *key = (idx_key_t *)key_arg;185 const idx_key_t *key = key_arg; 186 186 187 187 return key->index == fidx->index && key->service_id == fidx->service_id; -
TabularUnified uspace/srv/fs/locfs/locfs_ops.c ¶
ree8d4d6 r5e801dc 71 71 /* Implementation of hash table interface for the nodes hash table. */ 72 72 73 static size_t services_key_hash(void *key) 74 { 75 return *(service_id_t *)key; 73 static size_t services_key_hash(const void *key) 74 { 75 const service_id_t *k = key; 76 return *k; 76 77 } 77 78 … … 82 83 } 83 84 84 static bool services_key_equal(void *key, const ht_link_t *item) 85 { 85 static bool services_key_equal(const void *key, const ht_link_t *item) 86 { 87 const service_id_t *k = key; 86 88 service_t *dev = hash_table_get_inst(item, service_t, link); 87 return (dev->service_id == * (service_id_t *)key);89 return (dev->service_id == *k); 88 90 } 89 91 -
TabularUnified uspace/srv/fs/mfs/mfs_ops.c ¶
ree8d4d6 r5e801dc 100 100 101 101 static size_t 102 open_nodes_key_hash( void *key)103 { 104 node_key_t *node_key = (node_key_t *)key;102 open_nodes_key_hash(const void *key) 103 { 104 const node_key_t *node_key = key; 105 105 return hash_combine(node_key->service_id, node_key->index); 106 106 } … … 114 114 115 115 static bool 116 open_nodes_key_equal( void *key, const ht_link_t *item)117 { 118 node_key_t *node_key = (node_key_t *)key;116 open_nodes_key_equal(const void *key, const ht_link_t *item) 117 { 118 const node_key_t *node_key = key; 119 119 struct mfs_node *mnode = hash_table_get_inst(item, struct mfs_node, link); 120 120 -
TabularUnified uspace/srv/fs/tmpfs/tmpfs_ops.c ¶
ree8d4d6 r5e801dc 147 147 } node_key_t; 148 148 149 static size_t nodes_key_hash( void *k)150 { 151 node_key_t *key = (node_key_t *)k;149 static size_t nodes_key_hash(const void *k) 150 { 151 const node_key_t *key = k; 152 152 return hash_combine(key->service_id, key->index); 153 153 } … … 159 159 } 160 160 161 static bool nodes_key_equal( void *key_arg, const ht_link_t *item)161 static bool nodes_key_equal(const void *key_arg, const ht_link_t *item) 162 162 { 163 163 tmpfs_node_t *node = hash_table_get_inst(item, tmpfs_node_t, nh_link); 164 node_key_t *key = (node_key_t *)key_arg;164 const node_key_t *key = key_arg; 165 165 166 166 return key->service_id == node->service_id && key->index == node->index; -
TabularUnified uspace/srv/fs/udf/udf_idx.c ¶
ree8d4d6 r5e801dc 63 63 } 64 64 65 static size_t udf_idx_key_hash( void *k)66 { 67 udf_ht_key_t *key = (udf_ht_key_t *)k;65 static size_t udf_idx_key_hash(const void *k) 66 { 67 const udf_ht_key_t *key = k; 68 68 return hash_combine(key->service_id, key->index); 69 69 } 70 70 71 static bool udf_idx_key_equal( void *k, const ht_link_t *item)72 { 73 udf_ht_key_t *key = (udf_ht_key_t *)k;71 static bool udf_idx_key_equal(const void *k, const ht_link_t *item) 72 { 73 const udf_ht_key_t *key = k; 74 74 udf_node_t *node = hash_table_get_inst(item, udf_node_t, link); 75 75 -
TabularUnified uspace/srv/hid/input/gsp.c ¶
ree8d4d6 r5e801dc 64 64 } trans_key_t; 65 65 66 static size_t trans_key_hash( void *key)67 { 68 trans_key_t *trans_key = (trans_key_t *)key;66 static size_t trans_key_hash(const void *key) 67 { 68 const trans_key_t *trans_key = key; 69 69 return hash_combine(trans_key->input, trans_key->old_state); 70 70 } … … 76 76 } 77 77 78 static bool trans_key_equal( void *key, const ht_link_t *item)79 { 80 trans_key_t *trans_key = (trans_key_t *)key;78 static bool trans_key_equal(const void *key, const ht_link_t *item) 79 { 80 const trans_key_t *trans_key = key; 81 81 gsp_trans_t *t = hash_table_get_inst(item, gsp_trans_t, link); 82 82 -
TabularUnified uspace/srv/ns/service.c ¶
ree8d4d6 r5e801dc 65 65 } hashed_iface_t; 66 66 67 static size_t service_key_hash(void *key) 68 { 69 return *(service_t *) key; 67 static size_t service_key_hash(const void *key) 68 { 69 const service_t *srv = key; 70 return *srv; 70 71 } 71 72 … … 78 79 } 79 80 80 static bool service_key_equal(void *key, const ht_link_t *item) 81 { 81 static bool service_key_equal(const void *key, const ht_link_t *item) 82 { 83 const service_t *srv = key; 82 84 hashed_service_t *service = 83 85 hash_table_get_inst(item, hashed_service_t, link); 84 86 85 return service->service == *(service_t *) key; 86 } 87 88 static size_t iface_key_hash(void *key) 89 { 90 return *(iface_t *) key; 87 return service->service == *srv; 88 } 89 90 static size_t iface_key_hash(const void *key) 91 { 92 const iface_t *iface = key; 93 return *iface; 91 94 } 92 95 … … 99 102 } 100 103 101 static bool iface_key_equal(void *key, const ht_link_t *item) 102 { 104 static bool iface_key_equal(const void *key, const ht_link_t *item) 105 { 106 const iface_t *kiface = key; 103 107 hashed_iface_t *iface = 104 108 hash_table_get_inst(item, hashed_iface_t, link); 105 109 106 return iface->iface == * (iface_t *) key;110 return iface->iface == *kiface; 107 111 } 108 112 -
TabularUnified uspace/srv/ns/task.c ¶
ree8d4d6 r5e801dc 54 54 } hashed_task_t; 55 55 56 static size_t task_key_hash(void *key) 57 { 58 return *(task_id_t *)key; 59 } 60 61 static size_t task_hash(const ht_link_t *item) 56 static size_t task_key_hash(const void *key) 57 { 58 const task_id_t *tid = key; 59 return *tid; 60 } 61 62 static size_t task_hash(const ht_link_t *item) 62 63 { 63 64 hashed_task_t *ht = hash_table_get_inst(item, hashed_task_t, link); … … 65 66 } 66 67 67 static bool task_key_equal(void *key, const ht_link_t *item) 68 { 68 static bool task_key_equal(const void *key, const ht_link_t *item) 69 { 70 const task_id_t *tid = key; 69 71 hashed_task_t *ht = hash_table_get_inst(item, hashed_task_t, link); 70 return ht->id == * (task_id_t *)key;72 return ht->id == *tid; 71 73 } 72 74 … … 97 99 /* label-to-id hash table operations */ 98 100 99 static size_t p2i_key_hash( void *key)100 { 101 sysarg_t label = *(sysarg_t *)key;102 return label;101 static size_t p2i_key_hash(const void *key) 102 { 103 const sysarg_t *label = key; 104 return *label; 103 105 } 104 106 … … 109 111 } 110 112 111 static bool p2i_key_equal( void *key, const ht_link_t *item)112 { 113 sysarg_t label = *(sysarg_t *)key;113 static bool p2i_key_equal(const void *key, const ht_link_t *item) 114 { 115 const sysarg_t *label = key; 114 116 p2i_entry_t *entry = hash_table_get_inst(item, p2i_entry_t, link); 115 117 116 return ( label == entry->label);118 return (*label == entry->label); 117 119 } 118 120 -
TabularUnified uspace/srv/vfs/vfs_node.c ¶
ree8d4d6 r5e801dc 60 60 #define KEY_INDEX 2 61 61 62 static size_t nodes_key_hash( void *);62 static size_t nodes_key_hash(const void *); 63 63 static size_t nodes_hash(const ht_link_t *); 64 static bool nodes_key_equal( void *, const ht_link_t *);64 static bool nodes_key_equal(const void *, const ht_link_t *); 65 65 static vfs_triplet_t node_triplet(vfs_node_t *node); 66 66 … … 280 280 } 281 281 282 static size_t nodes_key_hash( void *key)283 { 284 vfs_triplet_t *tri = key;282 static size_t nodes_key_hash(const void *key) 283 { 284 const vfs_triplet_t *tri = key; 285 285 size_t hash = hash_combine(tri->fs_handle, tri->index); 286 286 return hash_combine(hash, tri->service_id); … … 294 294 } 295 295 296 static bool nodes_key_equal( void *key, const ht_link_t *item)297 { 298 vfs_triplet_t *tri = key;296 static bool nodes_key_equal(const void *key, const ht_link_t *item) 297 { 298 const vfs_triplet_t *tri = key; 299 299 vfs_node_t *node = hash_table_get_inst(item, vfs_node_t, nh_link); 300 300 return node->fs_handle == tri->fs_handle &&
Note:
See TracChangeset
for help on using the changeset viewer.