Changeset 5e801dc in mainline for uspace/srv
- Timestamp:
- 2019-02-25T14:42:38Z (7 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)
- Location:
- uspace/srv
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
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 -
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; -
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; -
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; -
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 -
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 -
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; -
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 -
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 -
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 -
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 -
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.