Changes in uspace/lib/c/generic/async.c [503ffce:4d6629f] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/async.c
r503ffce r4d6629f 106 106 #include <fibril.h> 107 107 #include <adt/hash_table.h> 108 #include <adt/hash.h>109 108 #include <adt/list.h> 110 109 #include <assert.h> … … 588 587 }; 589 588 590 typedef struct { 591 task_id_t task_id; 592 sysarg_t phone_hash; 593 } conn_key_t; 594 595 /** Compute hash into the connection hash table 596 * 597 * The hash is based on the source task ID and the source phone hash. The task 598 * ID is included in the hash because a phone hash alone might not be unique 599 * while we still track connections for killed tasks due to kernel's recycling 600 * of phone structures. 601 * 602 * @param key Pointer to the connection key structure. 589 /** Compute hash into the connection hash table based on the source phone hash. 590 * 591 * @param key Pointer to source phone hash. 603 592 * 604 593 * @return Index into the connection hash table. … … 607 596 static size_t conn_key_hash(void *key) 608 597 { 609 conn_key_t *ck = (conn_key_t *) key; 610 611 size_t hash = 0; 612 hash = hash_combine(hash, LOWER32(ck->task_id)); 613 hash = hash_combine(hash, UPPER32(ck->task_id)); 614 hash = hash_combine(hash, ck->phone_hash); 615 return hash; 598 sysarg_t in_phone_hash = *(sysarg_t *) key; 599 return in_phone_hash; 616 600 } 617 601 … … 619 603 { 620 604 connection_t *conn = hash_table_get_inst(item, connection_t, link); 621 return conn_key_hash(&(conn_key_t){ 622 .task_id = conn->in_task_id, 623 .phone_hash = conn->in_phone_hash 624 }); 605 return conn_key_hash(&conn->in_phone_hash); 625 606 } 626 607 627 608 static bool conn_key_equal(void *key, const ht_link_t *item) 628 609 { 629 conn_key_t *ck = (conn_key_t *) key;610 sysarg_t in_phone_hash = *(sysarg_t *) key; 630 611 connection_t *conn = hash_table_get_inst(item, connection_t, link); 631 return ((ck->task_id == conn->in_task_id) && 632 (ck->phone_hash == conn->in_phone_hash)); 612 return (in_phone_hash == conn->in_phone_hash); 633 613 } 634 614 … … 736 716 */ 737 717 futex_down(&async_futex); 738 hash_table_remove(&conn_hash_table, &(conn_key_t){ 739 .task_id = fibril_connection->in_task_id, 740 .phone_hash = fibril_connection->in_phone_hash 741 }); 718 hash_table_remove(&conn_hash_table, &fibril_connection->in_phone_hash); 742 719 futex_up(&async_futex); 743 720 … … 974 951 futex_down(&async_futex); 975 952 976 ht_link_t *link = hash_table_find(&conn_hash_table, &(conn_key_t){ 977 .task_id = call->in_task_id, 978 .phone_hash = call->in_phone_hash 979 }); 953 ht_link_t *link = hash_table_find(&conn_hash_table, &call->in_phone_hash); 980 954 if (!link) { 981 955 futex_up(&async_futex); … … 1341 1315 1342 1316 /* Kernel notification */ 1343 if ( call->flags & IPC_CALLID_NOTIFICATION) {1317 if ((callid & IPC_CALLID_NOTIFICATION)) { 1344 1318 fibril_t *fibril = (fibril_t *) __tcb_get()->fibril_data; 1345 1319 unsigned oldsw = fibril->switches; … … 1495 1469 } 1496 1470 1497 if (call .flags& IPC_CALLID_ANSWERED)1471 if (callid & IPC_CALLID_ANSWERED) 1498 1472 continue; 1499 1473
Note:
See TracChangeset
for help on using the changeset viewer.