Changes in uspace/app/trace/ipcp.c [eed4139:a35b458] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/trace/ipcp.c
reed4139 ra35b458 46 46 47 47 typedef struct { 48 cap_phone_handle_t phone_handle;48 sysarg_t phone_hash; 49 49 ipc_call_t question; 50 50 oper_t *oper; 51 51 52 cap_call_handle_t call_handle;52 ipc_callid_t call_hash; 53 53 54 54 ht_link_t link; … … 75 75 static size_t pending_call_key_hash(void *key) 76 76 { 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; 79 79 } 80 80 … … 82 82 { 83 83 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; 85 85 } 86 86 87 87 static bool pending_call_key_equal(void *key, const ht_link_t *item) 88 88 { 89 cap_call_handle_t *chandle = (cap_call_handle_t *)key;89 ipc_callid_t *call_id = (ipc_callid_t *)key; 90 90 pending_call_t *hs = hash_table_get_inst(item, pending_call_t, link); 91 91 92 return *c handle == hs->call_handle;92 return *call_id == hs->call_hash; 93 93 } 94 94 … … 102 102 103 103 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; 104 void 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 112 void ipcp_connection_clear(int phone) 113 { 114 have_conn[phone] = 0; 115 connections[phone].server = 0; 116 connections[phone].proto = NULL; 120 117 } 121 118 … … 177 174 } 178 175 179 void ipcp_call_out(cap_phone_handle_t phandle, ipc_call_t *call, 180 cap_call_handle_t chandle) 176 void ipcp_call_out(int phone, ipc_call_t *call, ipc_callid_t hash) 181 177 { 182 178 pending_call_t *pcall; … … 186 182 int i; 187 183 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; 192 186 193 187 args = call->args; 194 188 195 189 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")); 198 193 ipc_m_print(proto, IPC_GET_IMETHOD(*call)); 199 194 printf(" args: (%" PRIun ", %" PRIun ", %" PRIun ", " … … 213 208 if (oper != NULL) { 214 209 215 printf("%s(% p).%s", (proto ? proto->name : "n/a"),216 ph andle, (oper ? oper->name : "unknown"));210 printf("%s(%d).%s", (proto ? proto->name : "n/a"), 211 phone, (oper ? oper->name : "unknown")); 217 212 218 213 putchar('('); … … 241 236 242 237 pcall = malloc(sizeof(pending_call_t)); 243 pcall->phone_ha ndle = phandle;238 pcall->phone_hash = phone; 244 239 pcall->question = *call; 245 pcall->call_ha ndle = chandle;240 pcall->call_hash = hash; 246 241 pcall->oper = oper; 247 242 … … 249 244 } 250 245 251 static void parse_answer( cap_call_handle_t call_handle, pending_call_t *pcall,246 static void parse_answer(ipc_callid_t hash, pending_call_t *pcall, 252 247 ipc_call_t *answer) 253 248 { 254 cap_phone_handle_t phone;249 sysarg_t phone; 255 250 sysarg_t method; 256 251 sysarg_t service; 257 252 errno_t retval; 258 253 proto_t *proto; 259 cap_phone_handle_t cphone;254 int cphone; 260 255 261 256 sysarg_t *resp; … … 263 258 int i; 264 259 265 phone = pcall->phone_ha ndle;260 phone = pcall->phone_hash; 266 261 method = IPC_GET_IMETHOD(pcall->question); 267 262 retval = IPC_GET_RETVAL(*answer); … … 270 265 271 266 if ((display_mask & DM_IPC) != 0) { 272 printf("Response to % p: retval=%s, args = (%" PRIun ", "267 printf("Response to %d: retval=%s, args = (%" PRIun ", " 273 268 "%" 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), 275 270 IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer), 276 271 IPC_GET_ARG4(*answer), IPC_GET_ARG5(*answer)); … … 312 307 proto = proto_unknown; 313 308 314 cphone = (cap_phone_handle_t)IPC_GET_ARG5(*answer);309 cphone = IPC_GET_ARG5(*answer); 315 310 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, 317 312 proto->name); 318 313 } … … 322 317 } 323 318 324 void ipcp_call_in(ipc_call_t *call, cap_call_handle_t chandle)319 void ipcp_call_in(ipc_call_t *call, ipc_callid_t hash) 325 320 { 326 321 ht_link_t *item; … … 330 325 /* Not a response */ 331 326 if ((display_mask & DM_IPC) != 0) { 332 printf("Not a response (ha ndle %p)\n", chandle);327 printf("Not a response (hash %d)\n", hash); 333 328 } 334 329 return; 335 330 } 336 331 337 item = hash_table_find(&pending_calls, & chandle);332 item = hash_table_find(&pending_calls, &hash); 338 333 if (item == NULL) 339 334 return; /* No matching question found */ … … 344 339 345 340 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); 349 344 free(pcall); 350 345 } 351 346 352 void ipcp_hangup( cap_phone_handle_t phone, errno_t rc)347 void ipcp_hangup(int phone, errno_t rc) 353 348 { 354 349 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)); 356 351 ipcp_connection_clear(phone); 357 352 }
Note:
See TracChangeset
for help on using the changeset viewer.