Changeset a46e56b in mainline for uspace/lib/graph/graph.c
- Timestamp:
- 2018-03-22T06:49:35Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 77f0a1d
- Parents:
- 3e242d2
- git-author:
- Jakub Jermar <jakub@…> (2018-03-21 23:29:06)
- git-committer:
- Jakub Jermar <jakub@…> (2018-03-22 06:49:35)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/graph/graph.c
r3e242d2 ra46e56b 239 239 } 240 240 241 static void vs_claim(visualizer_t *vs, cap_call_handle_t i id, ipc_call_t *icall)241 static void vs_claim(visualizer_t *vs, cap_call_handle_t icall_handle, ipc_call_t *icall) 242 242 { 243 243 vs->client_side_handle = IPC_GET_ARG1(*icall); 244 244 errno_t rc = vs->ops.claim(vs); 245 async_answer_0(i id, rc);246 } 247 248 static void vs_yield(visualizer_t *vs, cap_call_handle_t i id, ipc_call_t *icall)245 async_answer_0(icall_handle, rc); 246 } 247 248 static void vs_yield(visualizer_t *vs, cap_call_handle_t icall_handle, ipc_call_t *icall) 249 249 { 250 250 /* Deallocate resources for the current mode. */ … … 264 264 vs->mode_set = false; 265 265 266 async_answer_0(i id, rc);267 } 268 269 static void vs_enumerate_modes(visualizer_t *vs, cap_call_handle_t i id, ipc_call_t *icall)270 { 271 cap_call_handle_t c allid;266 async_answer_0(icall_handle, rc); 267 } 268 269 static void vs_enumerate_modes(visualizer_t *vs, cap_call_handle_t icall_handle, ipc_call_t *icall) 270 { 271 cap_call_handle_t chandle; 272 272 size_t len; 273 273 274 if (!async_data_read_receive(&c allid, &len)) {275 async_answer_0(c allid, EREFUSED);276 async_answer_0(i id, EREFUSED);274 if (!async_data_read_receive(&chandle, &len)) { 275 async_answer_0(chandle, EREFUSED); 276 async_answer_0(icall_handle, EREFUSED); 277 277 return; 278 278 } … … 285 285 list_get_instance(link, vslmode_list_element_t, link); 286 286 287 errno_t rc = async_data_read_finalize(c allid, &mode_elem->mode, len);288 async_answer_0(i id, rc);287 errno_t rc = async_data_read_finalize(chandle, &mode_elem->mode, len); 288 async_answer_0(icall_handle, rc); 289 289 } else { 290 async_answer_0(c allid, ENOENT);291 async_answer_0(i id, ENOENT);290 async_answer_0(chandle, ENOENT); 291 async_answer_0(icall_handle, ENOENT); 292 292 } 293 293 … … 295 295 } 296 296 297 static void vs_get_default_mode(visualizer_t *vs, cap_call_handle_t i id, ipc_call_t *icall)298 { 299 cap_call_handle_t c allid;297 static void vs_get_default_mode(visualizer_t *vs, cap_call_handle_t icall_handle, ipc_call_t *icall) 298 { 299 cap_call_handle_t chandle; 300 300 size_t len; 301 301 302 if (!async_data_read_receive(&c allid, &len)) {303 async_answer_0(c allid, EREFUSED);304 async_answer_0(i id, EREFUSED);302 if (!async_data_read_receive(&chandle, &len)) { 303 async_answer_0(chandle, EREFUSED); 304 async_answer_0(icall_handle, EREFUSED); 305 305 return; 306 306 } … … 317 317 318 318 if (mode_elem != NULL) { 319 errno_t rc = async_data_read_finalize(c allid, &mode_elem->mode, len);320 async_answer_0(i id, rc);319 errno_t rc = async_data_read_finalize(chandle, &mode_elem->mode, len); 320 async_answer_0(icall_handle, rc); 321 321 } else { 322 322 fibril_mutex_unlock(&vs->mode_mtx); 323 async_answer_0(c allid, ENOENT);324 async_answer_0(i id, ENOENT);323 async_answer_0(chandle, ENOENT); 324 async_answer_0(icall_handle, ENOENT); 325 325 } 326 326 … … 328 328 } 329 329 330 static void vs_get_current_mode(visualizer_t *vs, cap_call_handle_t i id, ipc_call_t *icall)331 { 332 cap_call_handle_t c allid;330 static void vs_get_current_mode(visualizer_t *vs, cap_call_handle_t icall_handle, ipc_call_t *icall) 331 { 332 cap_call_handle_t chandle; 333 333 size_t len; 334 334 335 if (!async_data_read_receive(&c allid, &len)) {336 async_answer_0(c allid, EREFUSED);337 async_answer_0(i id, EREFUSED);335 if (!async_data_read_receive(&chandle, &len)) { 336 async_answer_0(chandle, EREFUSED); 337 async_answer_0(icall_handle, EREFUSED); 338 338 return; 339 339 } 340 340 341 341 if (vs->mode_set) { 342 errno_t rc = async_data_read_finalize(c allid, &vs->cur_mode, len);343 async_answer_0(i id, rc);342 errno_t rc = async_data_read_finalize(chandle, &vs->cur_mode, len); 343 async_answer_0(icall_handle, rc); 344 344 } else { 345 async_answer_0(c allid, ENOENT);346 async_answer_0(i id, ENOENT);347 } 348 } 349 350 static void vs_get_mode(visualizer_t *vs, cap_call_handle_t i id, ipc_call_t *icall)351 { 352 cap_call_handle_t c allid;345 async_answer_0(chandle, ENOENT); 346 async_answer_0(icall_handle, ENOENT); 347 } 348 } 349 350 static void vs_get_mode(visualizer_t *vs, cap_call_handle_t icall_handle, ipc_call_t *icall) 351 { 352 cap_call_handle_t chandle; 353 353 size_t len; 354 354 355 if (!async_data_read_receive(&c allid, &len)) {356 async_answer_0(c allid, EREFUSED);357 async_answer_0(i id, EREFUSED);355 if (!async_data_read_receive(&chandle, &len)) { 356 async_answer_0(chandle, EREFUSED); 357 async_answer_0(icall_handle, EREFUSED); 358 358 return; 359 359 } … … 372 372 373 373 if (mode_elem != NULL) { 374 errno_t rc = async_data_read_finalize(c allid, &mode_elem->mode, len);375 async_answer_0(i id, rc);374 errno_t rc = async_data_read_finalize(chandle, &mode_elem->mode, len); 375 async_answer_0(icall_handle, rc); 376 376 } else { 377 async_answer_0(c allid, ENOENT);378 async_answer_0(i id, ENOENT);377 async_answer_0(chandle, ENOENT); 378 async_answer_0(icall_handle, ENOENT); 379 379 } 380 380 … … 382 382 } 383 383 384 static void vs_set_mode(visualizer_t *vs, cap_call_handle_t i id, ipc_call_t *icall)385 { 386 cap_call_handle_t c allid;384 static void vs_set_mode(visualizer_t *vs, cap_call_handle_t icall_handle, ipc_call_t *icall) 385 { 386 cap_call_handle_t chandle; 387 387 size_t size; 388 388 unsigned int flags; 389 389 390 390 /* Retrieve the shared cell storage for the new mode. */ 391 if (!async_share_out_receive(&c allid, &size, &flags)) {392 async_answer_0(c allid, EREFUSED);393 async_answer_0(i id, EREFUSED);391 if (!async_share_out_receive(&chandle, &size, &flags)) { 392 async_answer_0(chandle, EREFUSED); 393 async_answer_0(icall_handle, EREFUSED); 394 394 return; 395 395 } … … 412 412 if (mode_elem == NULL) { 413 413 fibril_mutex_unlock(&vs->mode_mtx); 414 async_answer_0(c allid, ENOENT);415 async_answer_0(i id, ENOENT);414 async_answer_0(chandle, ENOENT); 415 async_answer_0(icall_handle, ENOENT); 416 416 return; 417 417 } … … 423 423 /* Check whether the mode is still up-to-date. */ 424 424 if (new_mode.version != mode_version) { 425 async_answer_0(c allid, EINVAL);426 async_answer_0(i id, EINVAL);425 async_answer_0(chandle, EINVAL); 426 async_answer_0(icall_handle, EINVAL); 427 427 return; 428 428 } 429 429 430 430 void *new_cell_storage; 431 errno_t rc = async_share_out_finalize(c allid, &new_cell_storage);431 errno_t rc = async_share_out_finalize(chandle, &new_cell_storage); 432 432 if ((rc != EOK) || (new_cell_storage == AS_MAP_FAILED)) { 433 async_answer_0(i id, ENOMEM);433 async_answer_0(icall_handle, ENOMEM); 434 434 return; 435 435 } … … 441 441 if (rc != EOK) { 442 442 as_area_destroy(new_cell_storage); 443 async_answer_0(i id, ENOMEM);443 async_answer_0(icall_handle, ENOMEM); 444 444 return; 445 445 } … … 464 464 vs->mode_set = true; 465 465 466 async_answer_0(i id, EOK);467 } 468 469 static void vs_update_damaged_region(visualizer_t *vs, cap_call_handle_t i id, ipc_call_t *icall)466 async_answer_0(icall_handle, EOK); 467 } 468 469 static void vs_update_damaged_region(visualizer_t *vs, cap_call_handle_t icall_handle, ipc_call_t *icall) 470 470 { 471 471 sysarg_t x_offset = (IPC_GET_ARG5(*icall) >> 16); … … 476 476 IPC_GET_ARG3(*icall), IPC_GET_ARG4(*icall), 477 477 x_offset, y_offset); 478 async_answer_0(i id, rc);479 } 480 481 static void vs_suspend(visualizer_t *vs, cap_call_handle_t i id, ipc_call_t *icall)478 async_answer_0(icall_handle, rc); 479 } 480 481 static void vs_suspend(visualizer_t *vs, cap_call_handle_t icall_handle, ipc_call_t *icall) 482 482 { 483 483 errno_t rc = vs->ops.suspend(vs); 484 async_answer_0(i id, rc);485 } 486 487 static void vs_wakeup(visualizer_t *vs, cap_call_handle_t i id, ipc_call_t *icall)484 async_answer_0(icall_handle, rc); 485 } 486 487 static void vs_wakeup(visualizer_t *vs, cap_call_handle_t icall_handle, ipc_call_t *icall) 488 488 { 489 489 errno_t rc = vs->ops.wakeup(vs); 490 async_answer_0(i id, rc);490 async_answer_0(icall_handle, rc); 491 491 } 492 492 493 493 void graph_visualizer_connection(visualizer_t *vs, 494 cap_call_handle_t i id, ipc_call_t *icall, void *arg)494 cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg) 495 495 { 496 496 ipc_call_t call; 497 cap_call_handle_t c allid;497 cap_call_handle_t chandle; 498 498 499 499 /* Claim the visualizer. */ 500 500 if (!cas(&vs->ref_cnt, 0, 1)) { 501 async_answer_0(i id, ELIMIT);501 async_answer_0(icall_handle, ELIMIT); 502 502 return; 503 503 } 504 504 505 505 /* Accept the connection. */ 506 async_answer_0(i id, EOK);506 async_answer_0(icall_handle, EOK); 507 507 508 508 /* Establish callback session. */ 509 c allid= async_get_call(&call);509 chandle = async_get_call(&call); 510 510 vs->notif_sess = async_callback_receive_start(EXCHANGE_SERIALIZE, &call); 511 511 if (vs->notif_sess != NULL) 512 async_answer_0(c allid, EOK);512 async_answer_0(chandle, EOK); 513 513 else 514 async_answer_0(c allid, ELIMIT);514 async_answer_0(chandle, ELIMIT); 515 515 516 516 /* Enter command loop. */ 517 517 while (true) { 518 c allid= async_get_call(&call);518 chandle = async_get_call(&call); 519 519 520 520 if (!IPC_GET_IMETHOD(call)) { 521 async_answer_0(c allid, EINVAL);521 async_answer_0(chandle, EINVAL); 522 522 break; 523 523 } … … 525 525 switch (IPC_GET_IMETHOD(call)) { 526 526 case VISUALIZER_CLAIM: 527 vs_claim(vs, c allid, &call);527 vs_claim(vs, chandle, &call); 528 528 break; 529 529 case VISUALIZER_YIELD: 530 vs_yield(vs, c allid, &call);530 vs_yield(vs, chandle, &call); 531 531 goto terminate; 532 532 case VISUALIZER_ENUMERATE_MODES: 533 vs_enumerate_modes(vs, c allid, &call);533 vs_enumerate_modes(vs, chandle, &call); 534 534 break; 535 535 case VISUALIZER_GET_DEFAULT_MODE: 536 vs_get_default_mode(vs, c allid, &call);536 vs_get_default_mode(vs, chandle, &call); 537 537 break; 538 538 case VISUALIZER_GET_CURRENT_MODE: 539 vs_get_current_mode(vs, c allid, &call);539 vs_get_current_mode(vs, chandle, &call); 540 540 break; 541 541 case VISUALIZER_GET_MODE: 542 vs_get_mode(vs, c allid, &call);542 vs_get_mode(vs, chandle, &call); 543 543 break; 544 544 case VISUALIZER_SET_MODE: 545 vs_set_mode(vs, c allid, &call);545 vs_set_mode(vs, chandle, &call); 546 546 break; 547 547 case VISUALIZER_UPDATE_DAMAGED_REGION: 548 vs_update_damaged_region(vs, c allid, &call);548 vs_update_damaged_region(vs, chandle, &call); 549 549 break; 550 550 case VISUALIZER_SUSPEND: 551 vs_suspend(vs, c allid, &call);551 vs_suspend(vs, chandle, &call); 552 552 break; 553 553 case VISUALIZER_WAKE_UP: 554 vs_wakeup(vs, c allid, &call);554 vs_wakeup(vs, chandle, &call); 555 555 break; 556 556 default: 557 async_answer_0(c allid, EINVAL);557 async_answer_0(chandle, EINVAL); 558 558 goto terminate; 559 559 } … … 567 567 568 568 void graph_renderer_connection(renderer_t *rnd, 569 cap_call_handle_t i id, ipc_call_t *icall, void *arg)569 cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg) 570 570 { 571 571 // TODO 572 572 573 573 ipc_call_t call; 574 cap_call_handle_t c allid;574 cap_call_handle_t chandle; 575 575 576 576 /* Accept the connection. */ 577 577 atomic_inc(&rnd->ref_cnt); 578 async_answer_0(i id, EOK);578 async_answer_0(icall_handle, EOK); 579 579 580 580 /* Enter command loop. */ 581 581 while (true) { 582 c allid= async_get_call(&call);582 chandle = async_get_call(&call); 583 583 584 584 if (!IPC_GET_IMETHOD(call)) { 585 async_answer_0(c allid, EINVAL);585 async_answer_0(chandle, EINVAL); 586 586 break; 587 587 } … … 589 589 switch (IPC_GET_IMETHOD(call)) { 590 590 default: 591 async_answer_0(c allid, EINVAL);591 async_answer_0(chandle, EINVAL); 592 592 goto terminate; 593 593 } … … 598 598 } 599 599 600 void graph_client_connection(cap_call_handle_t i id, ipc_call_t *icall, void *arg)600 void graph_client_connection(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg) 601 601 { 602 602 /* Find the visualizer or renderer with the given service ID. */ … … 605 605 606 606 if (vs != NULL) 607 graph_visualizer_connection(vs, i id, icall, arg);607 graph_visualizer_connection(vs, icall_handle, icall, arg); 608 608 else if (rnd != NULL) 609 graph_renderer_connection(rnd, i id, icall, arg);609 graph_renderer_connection(rnd, icall_handle, icall, arg); 610 610 else 611 async_answer_0(i id, ENOENT);611 async_answer_0(icall_handle, ENOENT); 612 612 } 613 613
Note:
See TracChangeset
for help on using the changeset viewer.