Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/async.c

    r503ffce r4d6629f  
    106106#include <fibril.h>
    107107#include <adt/hash_table.h>
    108 #include <adt/hash.h>
    109108#include <adt/list.h>
    110109#include <assert.h>
     
    588587};
    589588
    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.
    603592 *
    604593 * @return Index into the connection hash table.
     
    607596static size_t conn_key_hash(void *key)
    608597{
    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;
    616600}
    617601
     
    619603{
    620604        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);
    625606}
    626607
    627608static bool conn_key_equal(void *key, const ht_link_t *item)
    628609{
    629         conn_key_t *ck = (conn_key_t *) key;
     610        sysarg_t in_phone_hash = *(sysarg_t *) key;
    630611        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);
    633613}
    634614
     
    736716         */
    737717        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);
    742719        futex_up(&async_futex);
    743720       
     
    974951        futex_down(&async_futex);
    975952       
    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);
    980954        if (!link) {
    981955                futex_up(&async_futex);
     
    13411315       
    13421316        /* Kernel notification */
    1343         if (call->flags & IPC_CALLID_NOTIFICATION) {
     1317        if ((callid & IPC_CALLID_NOTIFICATION)) {
    13441318                fibril_t *fibril = (fibril_t *) __tcb_get()->fibril_data;
    13451319                unsigned oldsw = fibril->switches;
     
    14951469                }
    14961470               
    1497                 if (call.flags & IPC_CALLID_ANSWERED)
     1471                if (callid & IPC_CALLID_ANSWERED)
    14981472                        continue;
    14991473               
Note: See TracChangeset for help on using the changeset viewer.