Changeset 9f4067b6 in mainline for uspace/app/trace/ipcp.c
- Timestamp:
- 2012-10-09T21:16:13Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6659037, 7d248e3
- Parents:
- d1ef4a1 (diff), 97b199b1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/trace/ipcp.c
rd1ef4a1 r9f4067b6 38 38 #include <sys/typefmt.h> 39 39 #include <abi/ipc/methods.h> 40 #include <macros.h> 40 41 #include "ipc_desc.h" 41 42 #include "proto.h" … … 52 53 ipc_callid_t call_hash; 53 54 54 link_t link;55 ht_link_t link; 55 56 } pending_call_t; 56 57 … … 64 65 int have_conn[MAX_PHONE]; 65 66 66 #define PCALL_TABLE_CHAINS 32 67 hash_table_t pending_calls; 67 static hash_table_t pending_calls; 68 68 69 69 /* … … 73 73 proto_t *proto_unknown; /**< Protocol with no known methods. */ 74 74 75 static hash_index_t pending_call_hash(unsigned long key[]); 76 static int pending_call_compare(unsigned long key[], hash_count_t keys, 77 link_t *item); 78 static void pending_call_remove_callback(link_t *item); 79 80 hash_table_operations_t pending_call_ops = { 75 76 static size_t pending_call_key_hash(void *key) 77 { 78 ipc_callid_t *call_id = (ipc_callid_t *)key; 79 return *call_id; 80 } 81 82 static size_t pending_call_hash(const ht_link_t *item) 83 { 84 pending_call_t *hs = hash_table_get_inst(item, pending_call_t, link); 85 return hs->call_hash; 86 } 87 88 static bool pending_call_key_equal(void *key, const ht_link_t *item) 89 { 90 ipc_callid_t *call_id = (ipc_callid_t *)key; 91 pending_call_t *hs = hash_table_get_inst(item, pending_call_t, link); 92 93 return *call_id == hs->call_hash; 94 } 95 96 static hash_table_ops_t pending_call_ops = { 81 97 .hash = pending_call_hash, 82 .compare = pending_call_compare, 83 .remove_callback = pending_call_remove_callback 98 .key_hash = pending_call_key_hash, 99 .key_equal = pending_call_key_equal, 100 .equal = NULL, 101 .remove_callback = NULL 84 102 }; 85 86 87 static hash_index_t pending_call_hash(unsigned long key[])88 {89 // printf("pending_call_hash\n");90 return key[0] % PCALL_TABLE_CHAINS;91 }92 93 static int pending_call_compare(unsigned long key[], hash_count_t keys,94 link_t *item)95 {96 pending_call_t *hs;97 98 // printf("pending_call_compare\n");99 hs = hash_table_get_instance(item, pending_call_t, link);100 101 // FIXME: this will fail if sizeof(long) < sizeof(void *).102 return key[0] == hs->call_hash;103 }104 105 static void pending_call_remove_callback(link_t *item)106 {107 // printf("pending_call_remove_callback\n");108 }109 103 110 104 … … 177 171 } 178 172 179 hash_table_create(&pending_calls, PCALL_TABLE_CHAINS, 1, &pending_call_ops); 173 bool ok = hash_table_create(&pending_calls, 0, 0, &pending_call_ops); 174 assert(ok); 180 175 } 181 176 … … 190 185 pending_call_t *pcall; 191 186 proto_t *proto; 192 unsigned long key[1];193 187 oper_t *oper; 194 188 sysarg_t *args; … … 254 248 pcall->oper = oper; 255 249 256 key[0] = hash; 257 258 hash_table_insert(&pending_calls, key, &pcall->link); 250 hash_table_insert(&pending_calls, &pcall->link); 259 251 } 260 252 … … 334 326 void ipcp_call_in(ipc_call_t *call, ipc_callid_t hash) 335 327 { 336 link_t *item;328 ht_link_t *item; 337 329 pending_call_t *pcall; 338 unsigned long key[1];339 330 340 331 if ((hash & IPC_CALLID_ANSWERED) == 0 && hash != IPCP_CALLID_SYNC) { … … 347 338 348 339 hash = hash & ~IPC_CALLID_ANSWERED; 349 key[0] = hash; 350 351 item = hash_table_find(&pending_calls, key); 340 341 item = hash_table_find(&pending_calls, &hash); 352 342 if (item == NULL) 353 343 return; /* No matching question found */ … … 357 347 */ 358 348 359 pcall = hash_table_get_inst ance(item, pending_call_t, link);360 hash_table_remove(&pending_calls, key, 1);349 pcall = hash_table_get_inst(item, pending_call_t, link); 350 hash_table_remove(&pending_calls, &hash); 361 351 362 352 parse_answer(hash, pcall, call);
Note:
See TracChangeset
for help on using the changeset viewer.