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