Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/trace/ipcp.c

    reed4139 ra35b458  
    4646
    4747typedef struct {
    48         cap_phone_handle_t phone_handle;
     48        sysarg_t phone_hash;
    4949        ipc_call_t question;
    5050        oper_t *oper;
    5151
    52         cap_call_handle_t call_handle;
     52        ipc_callid_t call_hash;
    5353
    5454        ht_link_t link;
     
    7575static size_t pending_call_key_hash(void *key)
    7676{
    77         cap_call_handle_t *chandle = (cap_call_handle_t *) key;
    78         return CAP_HANDLE_RAW(*chandle);
     77        ipc_callid_t *call_id = (ipc_callid_t *)key;
     78        return *call_id;
    7979}
    8080
     
    8282{
    8383        pending_call_t *hs = hash_table_get_inst(item, pending_call_t, link);
    84         return CAP_HANDLE_RAW(hs->call_handle);
     84        return hs->call_hash;
    8585}
    8686
    8787static bool pending_call_key_equal(void *key, const ht_link_t *item)
    8888{
    89         cap_call_handle_t *chandle = (cap_call_handle_t *) key;
     89        ipc_callid_t *call_id = (ipc_callid_t *)key;
    9090        pending_call_t *hs = hash_table_get_inst(item, pending_call_t, link);
    9191
    92         return *chandle == hs->call_handle;
     92        return *call_id == hs->call_hash;
    9393}
    9494
     
    102102
    103103
    104 void ipcp_connection_set(cap_phone_handle_t phone, int server, proto_t *proto)
    105 {
    106         // XXX: there is no longer a limit on the number of phones as phones are
    107         // now handled using capabilities
    108         if (CAP_HANDLE_RAW(phone) < 0 || CAP_HANDLE_RAW(phone) >= MAX_PHONE)
    109             return;
    110         connections[CAP_HANDLE_RAW(phone)].server = server;
    111         connections[CAP_HANDLE_RAW(phone)].proto = proto;
    112         have_conn[CAP_HANDLE_RAW(phone)] = 1;
    113 }
    114 
    115 void ipcp_connection_clear(cap_phone_handle_t phone)
    116 {
    117         have_conn[CAP_HANDLE_RAW(phone)] = 0;
    118         connections[CAP_HANDLE_RAW(phone)].server = 0;
    119         connections[CAP_HANDLE_RAW(phone)].proto = NULL;
     104void ipcp_connection_set(int phone, int server, proto_t *proto)
     105{
     106        if (phone <0 || phone >= MAX_PHONE) return;
     107        connections[phone].server = server;
     108        connections[phone].proto = proto;
     109        have_conn[phone] = 1;
     110}
     111
     112void ipcp_connection_clear(int phone)
     113{
     114        have_conn[phone] = 0;
     115        connections[phone].server = 0;
     116        connections[phone].proto = NULL;
    120117}
    121118
     
    177174}
    178175
    179 void ipcp_call_out(cap_phone_handle_t phandle, ipc_call_t *call,
    180     cap_call_handle_t chandle)
     176void ipcp_call_out(int phone, ipc_call_t *call, ipc_callid_t hash)
    181177{
    182178        pending_call_t *pcall;
     
    186182        int i;
    187183
    188         if (have_conn[CAP_HANDLE_RAW(phandle)])
    189                 proto = connections[CAP_HANDLE_RAW(phandle)].proto;
    190         else
    191                 proto = NULL;
     184        if (have_conn[phone]) proto = connections[phone].proto;
     185        else proto = NULL;
    192186
    193187        args = call->args;
    194188
    195189        if ((display_mask & DM_IPC) != 0) {
    196                 printf("Call handle: %p, phone: %p, proto: %s, method: ",
    197                     chandle, phandle, (proto ? proto->name : "n/a"));
     190                printf("Call ID: %d, phone: %d, proto: %s, method: ",
     191                    hash, phone,
     192                    (proto ? proto->name : "n/a"));
    198193                ipc_m_print(proto, IPC_GET_IMETHOD(*call));
    199194                printf(" args: (%" PRIun ", %" PRIun ", %" PRIun ", "
     
    213208                if (oper != NULL) {
    214209
    215                         printf("%s(%p).%s", (proto ? proto->name : "n/a"),
    216                             phandle, (oper ? oper->name : "unknown"));
     210                        printf("%s(%d).%s", (proto ? proto->name : "n/a"),
     211                            phone, (oper ? oper->name : "unknown"));
    217212
    218213                        putchar('(');
     
    241236
    242237        pcall = malloc(sizeof(pending_call_t));
    243         pcall->phone_handle = phandle;
     238        pcall->phone_hash = phone;
    244239        pcall->question = *call;
    245         pcall->call_handle = chandle;
     240        pcall->call_hash = hash;
    246241        pcall->oper = oper;
    247242
     
    249244}
    250245
    251 static void parse_answer(cap_call_handle_t call_handle, pending_call_t *pcall,
     246static void parse_answer(ipc_callid_t hash, pending_call_t *pcall,
    252247    ipc_call_t *answer)
    253248{
    254         cap_phone_handle_t phone;
     249        sysarg_t phone;
    255250        sysarg_t method;
    256251        sysarg_t service;
    257252        errno_t retval;
    258253        proto_t *proto;
    259         cap_phone_handle_t cphone;
     254        int cphone;
    260255
    261256        sysarg_t *resp;
     
    263258        int i;
    264259
    265         phone = pcall->phone_handle;
     260        phone = pcall->phone_hash;
    266261        method = IPC_GET_IMETHOD(pcall->question);
    267262        retval = IPC_GET_RETVAL(*answer);
     
    270265
    271266        if ((display_mask & DM_IPC) != 0) {
    272                 printf("Response to %p: retval=%s, args = (%" PRIun ", "
     267                printf("Response to %d: retval=%s, args = (%" PRIun ", "
    273268                    "%" PRIun ", %" PRIun ", %" PRIun ", %" PRIun ")\n",
    274                     call_handle, str_error_name(retval), IPC_GET_ARG1(*answer),
     269                    hash, str_error_name(retval), IPC_GET_ARG1(*answer),
    275270                    IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer),
    276271                    IPC_GET_ARG4(*answer), IPC_GET_ARG5(*answer));
     
    312307                        proto = proto_unknown;
    313308
    314                 cphone = (cap_phone_handle_t) IPC_GET_ARG5(*answer);
     309                cphone = IPC_GET_ARG5(*answer);
    315310                if ((display_mask & DM_SYSTEM) != 0) {
    316                         printf("Registering connection (phone %p, protocol: %s)\n", cphone,
     311                        printf("Registering connection (phone %d, protocol: %s)\n", cphone,
    317312                    proto->name);
    318313                }
     
    322317}
    323318
    324 void ipcp_call_in(ipc_call_t *call, cap_call_handle_t chandle)
     319void ipcp_call_in(ipc_call_t *call, ipc_callid_t hash)
    325320{
    326321        ht_link_t *item;
     
    330325                /* Not a response */
    331326                if ((display_mask & DM_IPC) != 0) {
    332                         printf("Not a response (handle %p)\n", chandle);
     327                        printf("Not a response (hash %d)\n", hash);
    333328                }
    334329                return;
    335330        }
    336331
    337         item = hash_table_find(&pending_calls, &chandle);
     332        item = hash_table_find(&pending_calls, &hash);
    338333        if (item == NULL)
    339334                return; /* No matching question found */
     
    344339
    345340        pcall = hash_table_get_inst(item, pending_call_t, link);
    346         hash_table_remove(&pending_calls, &chandle);
    347 
    348         parse_answer(chandle, pcall, call);
     341        hash_table_remove(&pending_calls, &hash);
     342
     343        parse_answer(hash, pcall, call);
    349344        free(pcall);
    350345}
    351346
    352 void ipcp_hangup(cap_phone_handle_t phone, errno_t rc)
     347void ipcp_hangup(int phone, errno_t rc)
    353348{
    354349        if ((display_mask & DM_SYSTEM) != 0) {
    355                 printf("Hang up phone %p -> %s\n", phone, str_error_name(rc));
     350                printf("Hang phone %d up -> %s\n", phone, str_error_name(rc));
    356351                ipcp_connection_clear(phone);
    357352        }
Note: See TracChangeset for help on using the changeset viewer.