Changeset a46e56b in mainline for uspace/srv/devman/client_conn.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/srv/devman/client_conn.c
r3e242d2 ra46e56b 61 61 /** Find handle for the device instance identified by the device's path in the 62 62 * device tree. */ 63 static void devman_function_get_handle(cap_call_handle_t i id, ipc_call_t *icall)63 static void devman_function_get_handle(cap_call_handle_t icall_handle, ipc_call_t *icall) 64 64 { 65 65 char *pathname; … … 68 68 errno_t rc = async_data_write_accept((void **) &pathname, true, 0, 0, 0, 0); 69 69 if (rc != EOK) { 70 async_answer_0(i id, rc);70 async_answer_0(icall_handle, rc); 71 71 return; 72 72 } … … 77 77 78 78 if (fun == NULL) { 79 async_answer_0(i id, ENOENT);79 async_answer_0(icall_handle, ENOENT); 80 80 return; 81 81 } … … 86 86 if (fun->state == FUN_REMOVED) { 87 87 fibril_rwlock_read_unlock(&device_tree.rwlock); 88 async_answer_0(i id, ENOENT);88 async_answer_0(icall_handle, ENOENT); 89 89 return; 90 90 } … … 96 96 fun_del_ref(fun); 97 97 98 async_answer_1(i id, EOK, handle);98 async_answer_1(icall_handle, EOK, handle); 99 99 } 100 100 101 101 /** Get device match ID. */ 102 static void devman_fun_get_match_id(cap_call_handle_t i id, ipc_call_t *icall)102 static void devman_fun_get_match_id(cap_call_handle_t icall_handle, ipc_call_t *icall) 103 103 { 104 104 devman_handle_t handle = IPC_GET_ARG1(*icall); … … 108 108 fun_node_t *fun = find_fun_node(&device_tree, handle); 109 109 if (fun == NULL) { 110 async_answer_0(i id, ENOMEM);111 return; 112 } 113 114 cap_call_handle_t data_c allid;110 async_answer_0(icall_handle, ENOMEM); 111 return; 112 } 113 114 cap_call_handle_t data_chandle; 115 115 size_t data_len; 116 if (!async_data_read_receive(&data_c allid, &data_len)) {117 async_answer_0(i id, EINVAL);116 if (!async_data_read_receive(&data_chandle, &data_len)) { 117 async_answer_0(icall_handle, EINVAL); 118 118 fun_del_ref(fun); 119 119 return; … … 122 122 buffer = malloc(data_len); 123 123 if (buffer == NULL) { 124 async_answer_0(data_c allid, ENOMEM);125 async_answer_0(i id, ENOMEM);124 async_answer_0(data_chandle, ENOMEM); 125 async_answer_0(icall_handle, ENOMEM); 126 126 fun_del_ref(fun); 127 127 return; … … 145 145 } 146 146 147 async_data_read_finalize(data_c allid, mid->id, sent_length);148 async_answer_1(i id, EOK, mid->score);147 async_data_read_finalize(data_chandle, mid->id, sent_length); 148 async_answer_1(icall_handle, EOK, mid->score); 149 149 150 150 fibril_rwlock_read_unlock(&device_tree.rwlock); … … 157 157 free(buffer); 158 158 159 async_answer_0(data_c allid, ENOENT);160 async_answer_0(i id, ENOENT);159 async_answer_0(data_chandle, ENOENT); 160 async_answer_0(icall_handle, ENOENT); 161 161 fun_del_ref(fun); 162 162 } 163 163 164 164 /** Get device name. */ 165 static void devman_fun_get_name(cap_call_handle_t i id, ipc_call_t *icall)165 static void devman_fun_get_name(cap_call_handle_t icall_handle, ipc_call_t *icall) 166 166 { 167 167 devman_handle_t handle = IPC_GET_ARG1(*icall); … … 169 169 fun_node_t *fun = find_fun_node(&device_tree, handle); 170 170 if (fun == NULL) { 171 async_answer_0(i id, ENOMEM);172 return; 173 } 174 175 cap_call_handle_t data_c allid;171 async_answer_0(icall_handle, ENOMEM); 172 return; 173 } 174 175 cap_call_handle_t data_chandle; 176 176 size_t data_len; 177 if (!async_data_read_receive(&data_c allid, &data_len)) {178 async_answer_0(i id, EINVAL);177 if (!async_data_read_receive(&data_chandle, &data_len)) { 178 async_answer_0(icall_handle, EINVAL); 179 179 fun_del_ref(fun); 180 180 return; … … 183 183 void *buffer = malloc(data_len); 184 184 if (buffer == NULL) { 185 async_answer_0(data_c allid, ENOMEM);186 async_answer_0(i id, ENOMEM);185 async_answer_0(data_chandle, ENOMEM); 186 async_answer_0(icall_handle, ENOMEM); 187 187 fun_del_ref(fun); 188 188 return; … … 196 196 free(buffer); 197 197 198 async_answer_0(data_c allid, ENOENT);199 async_answer_0(i id, ENOENT);198 async_answer_0(data_chandle, ENOENT); 199 async_answer_0(icall_handle, ENOENT); 200 200 fun_del_ref(fun); 201 201 return; … … 207 207 } 208 208 209 async_data_read_finalize(data_c allid, fun->name, sent_length);210 async_answer_0(i id, EOK);209 async_data_read_finalize(data_chandle, fun->name, sent_length); 210 async_answer_0(icall_handle, EOK); 211 211 212 212 fibril_rwlock_read_unlock(&device_tree.rwlock); … … 216 216 217 217 /** Get function driver name. */ 218 static void devman_fun_get_driver_name(cap_call_handle_t i id, ipc_call_t *icall)218 static void devman_fun_get_driver_name(cap_call_handle_t icall_handle, ipc_call_t *icall) 219 219 { 220 220 devman_handle_t handle = IPC_GET_ARG1(*icall); … … 222 222 fun_node_t *fun = find_fun_node(&device_tree, handle); 223 223 if (fun == NULL) { 224 async_answer_0(i id, ENOMEM);225 return; 226 } 227 228 cap_call_handle_t data_c allid;224 async_answer_0(icall_handle, ENOMEM); 225 return; 226 } 227 228 cap_call_handle_t data_chandle; 229 229 size_t data_len; 230 if (!async_data_read_receive(&data_c allid, &data_len)) {231 async_answer_0(i id, EINVAL);230 if (!async_data_read_receive(&data_chandle, &data_len)) { 231 async_answer_0(icall_handle, EINVAL); 232 232 fun_del_ref(fun); 233 233 return; … … 236 236 void *buffer = malloc(data_len); 237 237 if (buffer == NULL) { 238 async_answer_0(data_c allid, ENOMEM);239 async_answer_0(i id, ENOMEM);238 async_answer_0(data_chandle, ENOMEM); 239 async_answer_0(icall_handle, ENOMEM); 240 240 fun_del_ref(fun); 241 241 return; … … 249 249 free(buffer); 250 250 251 async_answer_0(data_c allid, ENOENT);252 async_answer_0(i id, ENOENT);251 async_answer_0(data_chandle, ENOENT); 252 async_answer_0(icall_handle, ENOENT); 253 253 fun_del_ref(fun); 254 254 return; … … 260 260 free(buffer); 261 261 262 async_answer_0(data_c allid, EINVAL);263 async_answer_0(i id, EINVAL);262 async_answer_0(data_chandle, EINVAL); 263 async_answer_0(icall_handle, EINVAL); 264 264 fun_del_ref(fun); 265 265 return; … … 271 271 } 272 272 273 async_data_read_finalize(data_c allid, fun->child->drv->name,273 async_data_read_finalize(data_chandle, fun->child->drv->name, 274 274 sent_length); 275 async_answer_0(i id, EOK);275 async_answer_0(icall_handle, EOK); 276 276 277 277 fibril_rwlock_read_unlock(&device_tree.rwlock); … … 281 281 282 282 /** Get device path. */ 283 static void devman_fun_get_path(cap_call_handle_t i id, ipc_call_t *icall)283 static void devman_fun_get_path(cap_call_handle_t icall_handle, ipc_call_t *icall) 284 284 { 285 285 devman_handle_t handle = IPC_GET_ARG1(*icall); … … 287 287 fun_node_t *fun = find_fun_node(&device_tree, handle); 288 288 if (fun == NULL) { 289 async_answer_0(i id, ENOMEM);290 return; 291 } 292 293 cap_call_handle_t data_c allid;289 async_answer_0(icall_handle, ENOMEM); 290 return; 291 } 292 293 cap_call_handle_t data_chandle; 294 294 size_t data_len; 295 if (!async_data_read_receive(&data_c allid, &data_len)) {296 async_answer_0(i id, EINVAL);295 if (!async_data_read_receive(&data_chandle, &data_len)) { 296 async_answer_0(icall_handle, EINVAL); 297 297 fun_del_ref(fun); 298 298 return; … … 301 301 void *buffer = malloc(data_len); 302 302 if (buffer == NULL) { 303 async_answer_0(data_c allid, ENOMEM);304 async_answer_0(i id, ENOMEM);303 async_answer_0(data_chandle, ENOMEM); 304 async_answer_0(icall_handle, ENOMEM); 305 305 fun_del_ref(fun); 306 306 return; … … 314 314 free(buffer); 315 315 316 async_answer_0(data_c allid, ENOENT);317 async_answer_0(i id, ENOENT);316 async_answer_0(data_chandle, ENOENT); 317 async_answer_0(icall_handle, ENOENT); 318 318 fun_del_ref(fun); 319 319 return; … … 325 325 } 326 326 327 async_data_read_finalize(data_c allid, fun->pathname, sent_length);328 async_answer_0(i id, EOK);327 async_data_read_finalize(data_chandle, fun->pathname, sent_length); 328 async_answer_0(icall_handle, EOK); 329 329 330 330 fibril_rwlock_read_unlock(&device_tree.rwlock); … … 334 334 335 335 /** Get handle for parent function of a device. */ 336 static void devman_dev_get_parent(cap_call_handle_t i id, ipc_call_t *icall)336 static void devman_dev_get_parent(cap_call_handle_t icall_handle, ipc_call_t *icall) 337 337 { 338 338 dev_node_t *dev; … … 343 343 if (dev == NULL || dev->state == DEVICE_REMOVED) { 344 344 fibril_rwlock_read_unlock(&device_tree.rwlock); 345 async_answer_0(i id, ENOENT);345 async_answer_0(icall_handle, ENOENT); 346 346 return; 347 347 } … … 349 349 if (dev->pfun == NULL) { 350 350 fibril_rwlock_read_unlock(&device_tree.rwlock); 351 async_answer_0(i id, ENOENT);352 return; 353 } 354 355 async_answer_1(i id, EOK, dev->pfun->handle);356 357 fibril_rwlock_read_unlock(&device_tree.rwlock); 358 } 359 360 static void devman_dev_get_functions(cap_call_handle_t i id, ipc_call_t *icall)361 { 362 cap_call_handle_t c allid;351 async_answer_0(icall_handle, ENOENT); 352 return; 353 } 354 355 async_answer_1(icall_handle, EOK, dev->pfun->handle); 356 357 fibril_rwlock_read_unlock(&device_tree.rwlock); 358 } 359 360 static void devman_dev_get_functions(cap_call_handle_t icall_handle, ipc_call_t *icall) 361 { 362 cap_call_handle_t chandle; 363 363 size_t size; 364 364 size_t act_size; 365 365 errno_t rc; 366 366 367 if (!async_data_read_receive(&c allid, &size)) {368 async_answer_0(c allid, EREFUSED);369 async_answer_0(i id, EREFUSED);367 if (!async_data_read_receive(&chandle, &size)) { 368 async_answer_0(chandle, EREFUSED); 369 async_answer_0(icall_handle, EREFUSED); 370 370 return; 371 371 } … … 377 377 if (dev == NULL || dev->state == DEVICE_REMOVED) { 378 378 fibril_rwlock_read_unlock(&device_tree.rwlock); 379 async_answer_0(c allid, ENOENT);380 async_answer_0(i id, ENOENT);379 async_answer_0(chandle, ENOENT); 380 async_answer_0(icall_handle, ENOENT); 381 381 return; 382 382 } … … 385 385 if (hdl_buf == NULL) { 386 386 fibril_rwlock_read_unlock(&device_tree.rwlock); 387 async_answer_0(c allid, ENOMEM);388 async_answer_0(i id, ENOMEM);387 async_answer_0(chandle, ENOMEM); 388 async_answer_0(icall_handle, ENOMEM); 389 389 return; 390 390 } … … 393 393 if (rc != EOK) { 394 394 fibril_rwlock_read_unlock(&device_tree.rwlock); 395 async_answer_0(c allid, rc);396 async_answer_0(i id, rc);397 return; 398 } 399 400 fibril_rwlock_read_unlock(&device_tree.rwlock); 401 402 errno_t retval = async_data_read_finalize(c allid, hdl_buf, size);395 async_answer_0(chandle, rc); 396 async_answer_0(icall_handle, rc); 397 return; 398 } 399 400 fibril_rwlock_read_unlock(&device_tree.rwlock); 401 402 errno_t retval = async_data_read_finalize(chandle, hdl_buf, size); 403 403 free(hdl_buf); 404 404 405 async_answer_1(i id, retval, act_size);405 async_answer_1(icall_handle, retval, act_size); 406 406 } 407 407 408 408 /** Get handle for child device of a function. */ 409 static void devman_fun_get_child(cap_call_handle_t i id, ipc_call_t *icall)409 static void devman_fun_get_child(cap_call_handle_t icall_handle, ipc_call_t *icall) 410 410 { 411 411 fun_node_t *fun; … … 416 416 if (fun == NULL || fun->state == FUN_REMOVED) { 417 417 fibril_rwlock_read_unlock(&device_tree.rwlock); 418 async_answer_0(i id, ENOENT);418 async_answer_0(icall_handle, ENOENT); 419 419 return; 420 420 } … … 422 422 if (fun->child == NULL) { 423 423 fibril_rwlock_read_unlock(&device_tree.rwlock); 424 async_answer_0(i id, ENOENT);425 return; 426 } 427 428 async_answer_1(i id, EOK, fun->child->handle);424 async_answer_0(icall_handle, ENOENT); 425 return; 426 } 427 428 async_answer_1(icall_handle, EOK, fun->child->handle); 429 429 430 430 fibril_rwlock_read_unlock(&device_tree.rwlock); … … 437 437 * of this function is linked to state of another function somehow). 438 438 */ 439 static void devman_fun_online(cap_call_handle_t i id, ipc_call_t *icall)439 static void devman_fun_online(cap_call_handle_t icall_handle, ipc_call_t *icall) 440 440 { 441 441 fun_node_t *fun; … … 444 444 fun = find_fun_node(&device_tree, IPC_GET_ARG1(*icall)); 445 445 if (fun == NULL) { 446 async_answer_0(i id, ENOENT);446 async_answer_0(icall_handle, ENOENT); 447 447 return; 448 448 } … … 451 451 fun_del_ref(fun); 452 452 453 async_answer_0(i id, rc);453 async_answer_0(icall_handle, rc); 454 454 } 455 455 … … 462 462 * function somehow). 463 463 */ 464 static void devman_fun_offline(cap_call_handle_t i id, ipc_call_t *icall)464 static void devman_fun_offline(cap_call_handle_t icall_handle, ipc_call_t *icall) 465 465 { 466 466 fun_node_t *fun; … … 469 469 fun = find_fun_node(&device_tree, IPC_GET_ARG1(*icall)); 470 470 if (fun == NULL) { 471 async_answer_0(i id, ENOENT);471 async_answer_0(icall_handle, ENOENT); 472 472 return; 473 473 } … … 476 476 fun_del_ref(fun); 477 477 478 async_answer_0(i id, rc);478 async_answer_0(icall_handle, rc); 479 479 } 480 480 481 481 /** Find handle for the function instance identified by its service ID. */ 482 static void devman_fun_sid_to_handle(cap_call_handle_t i id, ipc_call_t *icall)482 static void devman_fun_sid_to_handle(cap_call_handle_t icall_handle, ipc_call_t *icall) 483 483 { 484 484 fun_node_t *fun; … … 487 487 488 488 if (fun == NULL) { 489 async_answer_0(i id, ENOENT);489 async_answer_0(icall_handle, ENOENT); 490 490 return; 491 491 } … … 496 496 if (fun->state == FUN_REMOVED) { 497 497 fibril_rwlock_read_unlock(&device_tree.rwlock); 498 async_answer_0(i id, ENOENT);499 return; 500 } 501 502 async_answer_1(i id, EOK, fun->handle);498 async_answer_0(icall_handle, ENOENT); 499 return; 500 } 501 502 async_answer_1(icall_handle, EOK, fun->handle); 503 503 fibril_rwlock_read_unlock(&device_tree.rwlock); 504 504 fun_del_ref(fun); … … 506 506 507 507 /** Get list of all registered drivers. */ 508 static void devman_get_drivers(cap_call_handle_t i id, ipc_call_t *icall)509 { 510 cap_call_handle_t c allid;508 static void devman_get_drivers(cap_call_handle_t icall_handle, ipc_call_t *icall) 509 { 510 cap_call_handle_t chandle; 511 511 size_t size; 512 512 size_t act_size; 513 513 errno_t rc; 514 514 515 if (!async_data_read_receive(&c allid, &size)) {516 async_answer_0(i id, EREFUSED);515 if (!async_data_read_receive(&chandle, &size)) { 516 async_answer_0(icall_handle, EREFUSED); 517 517 return; 518 518 } … … 520 520 devman_handle_t *hdl_buf = (devman_handle_t *) malloc(size); 521 521 if (hdl_buf == NULL) { 522 async_answer_0(c allid, ENOMEM);523 async_answer_0(i id, ENOMEM);522 async_answer_0(chandle, ENOMEM); 523 async_answer_0(icall_handle, ENOMEM); 524 524 return; 525 525 } … … 527 527 rc = driver_get_list(&drivers_list, hdl_buf, size, &act_size); 528 528 if (rc != EOK) { 529 async_answer_0(c allid, rc);530 async_answer_0(i id, rc);531 return; 532 } 533 534 errno_t retval = async_data_read_finalize(c allid, hdl_buf, size);529 async_answer_0(chandle, rc); 530 async_answer_0(icall_handle, rc); 531 return; 532 } 533 534 errno_t retval = async_data_read_finalize(chandle, hdl_buf, size); 535 535 free(hdl_buf); 536 536 537 async_answer_1(i id, retval, act_size);538 } 539 540 static void devman_driver_get_devices(cap_call_handle_t i id, ipc_call_t *icall)541 { 542 cap_call_handle_t c allid;537 async_answer_1(icall_handle, retval, act_size); 538 } 539 540 static void devman_driver_get_devices(cap_call_handle_t icall_handle, ipc_call_t *icall) 541 { 542 cap_call_handle_t chandle; 543 543 size_t size; 544 544 size_t act_size; 545 545 errno_t rc; 546 546 547 if (!async_data_read_receive(&c allid, &size)) {548 async_answer_0(i id, EREFUSED);547 if (!async_data_read_receive(&chandle, &size)) { 548 async_answer_0(icall_handle, EREFUSED); 549 549 return; 550 550 } … … 552 552 driver_t *drv = driver_find(&drivers_list, IPC_GET_ARG1(*icall)); 553 553 if (drv == NULL) { 554 async_answer_0(c allid, ENOENT);555 async_answer_0(i id, ENOENT);554 async_answer_0(chandle, ENOENT); 555 async_answer_0(icall_handle, ENOENT); 556 556 return; 557 557 } … … 559 559 devman_handle_t *hdl_buf = (devman_handle_t *) malloc(size); 560 560 if (hdl_buf == NULL) { 561 async_answer_0(c allid, ENOMEM);562 async_answer_0(i id, ENOMEM);561 async_answer_0(chandle, ENOMEM); 562 async_answer_0(icall_handle, ENOMEM); 563 563 return; 564 564 } … … 567 567 if (rc != EOK) { 568 568 fibril_rwlock_read_unlock(&device_tree.rwlock); 569 async_answer_0(c allid, rc);570 async_answer_0(i id, rc);571 return; 572 } 573 574 errno_t retval = async_data_read_finalize(c allid, hdl_buf, size);569 async_answer_0(chandle, rc); 570 async_answer_0(icall_handle, rc); 571 return; 572 } 573 574 errno_t retval = async_data_read_finalize(chandle, hdl_buf, size); 575 575 free(hdl_buf); 576 576 577 async_answer_1(i id, retval, act_size);577 async_answer_1(icall_handle, retval, act_size); 578 578 } 579 579 580 580 581 581 /** Find driver by name. */ 582 static void devman_driver_get_handle(cap_call_handle_t i id, ipc_call_t *icall)582 static void devman_driver_get_handle(cap_call_handle_t icall_handle, ipc_call_t *icall) 583 583 { 584 584 char *drvname; … … 586 586 errno_t rc = async_data_write_accept((void **) &drvname, true, 0, 0, 0, 0); 587 587 if (rc != EOK) { 588 async_answer_0(i id, rc);588 async_answer_0(icall_handle, rc); 589 589 return; 590 590 } … … 595 595 596 596 if (driver == NULL) { 597 async_answer_0(i id, ENOENT);598 return; 599 } 600 601 async_answer_1(i id, EOK, driver->handle);597 async_answer_0(icall_handle, ENOENT); 598 return; 599 } 600 601 async_answer_1(icall_handle, EOK, driver->handle); 602 602 } 603 603 604 604 /** Get driver match ID. */ 605 static void devman_driver_get_match_id(cap_call_handle_t i id, ipc_call_t *icall)605 static void devman_driver_get_match_id(cap_call_handle_t icall_handle, ipc_call_t *icall) 606 606 { 607 607 devman_handle_t handle = IPC_GET_ARG1(*icall); … … 610 610 driver_t *drv = driver_find(&drivers_list, handle); 611 611 if (drv == NULL) { 612 async_answer_0(i id, ENOMEM);613 return; 614 } 615 616 cap_call_handle_t data_c allid;612 async_answer_0(icall_handle, ENOMEM); 613 return; 614 } 615 616 cap_call_handle_t data_chandle; 617 617 size_t data_len; 618 if (!async_data_read_receive(&data_c allid, &data_len)) {619 async_answer_0(i id, EINVAL);618 if (!async_data_read_receive(&data_chandle, &data_len)) { 619 async_answer_0(icall_handle, EINVAL); 620 620 return; 621 621 } … … 623 623 void *buffer = malloc(data_len); 624 624 if (buffer == NULL) { 625 async_answer_0(data_c allid, ENOMEM);626 async_answer_0(i id, ENOMEM);625 async_answer_0(data_chandle, ENOMEM); 626 async_answer_0(icall_handle, ENOMEM); 627 627 return; 628 628 } … … 633 633 fibril_mutex_unlock(&drv->driver_mutex); 634 634 free(buffer); 635 async_answer_0(data_c allid, ENOMEM);636 async_answer_0(i id, ENOMEM);635 async_answer_0(data_chandle, ENOMEM); 636 async_answer_0(icall_handle, ENOMEM); 637 637 return; 638 638 } … … 645 645 } 646 646 647 async_data_read_finalize(data_c allid, mid->id, sent_length);648 async_answer_1(i id, EOK, mid->score);647 async_data_read_finalize(data_chandle, mid->id, sent_length); 648 async_answer_1(icall_handle, EOK, mid->score); 649 649 650 650 fibril_mutex_unlock(&drv->driver_mutex); … … 654 654 655 655 /** Get driver name. */ 656 static void devman_driver_get_name(cap_call_handle_t i id, ipc_call_t *icall)656 static void devman_driver_get_name(cap_call_handle_t icall_handle, ipc_call_t *icall) 657 657 { 658 658 devman_handle_t handle = IPC_GET_ARG1(*icall); … … 660 660 driver_t *drv = driver_find(&drivers_list, handle); 661 661 if (drv == NULL) { 662 async_answer_0(i id, ENOMEM);663 return; 664 } 665 666 cap_call_handle_t data_c allid;662 async_answer_0(icall_handle, ENOMEM); 663 return; 664 } 665 666 cap_call_handle_t data_chandle; 667 667 size_t data_len; 668 if (!async_data_read_receive(&data_c allid, &data_len)) {669 async_answer_0(i id, EINVAL);668 if (!async_data_read_receive(&data_chandle, &data_len)) { 669 async_answer_0(icall_handle, EINVAL); 670 670 return; 671 671 } … … 673 673 void *buffer = malloc(data_len); 674 674 if (buffer == NULL) { 675 async_answer_0(data_c allid, ENOMEM);676 async_answer_0(i id, ENOMEM);675 async_answer_0(data_chandle, ENOMEM); 676 async_answer_0(icall_handle, ENOMEM); 677 677 return; 678 678 } … … 685 685 } 686 686 687 async_data_read_finalize(data_c allid, drv->name, sent_length);688 async_answer_0(i id, EOK);687 async_data_read_finalize(data_chandle, drv->name, sent_length); 688 async_answer_0(icall_handle, EOK); 689 689 690 690 fibril_mutex_unlock(&drv->driver_mutex); … … 694 694 695 695 /** Get driver state. */ 696 static void devman_driver_get_state(cap_call_handle_t i id, ipc_call_t *icall)696 static void devman_driver_get_state(cap_call_handle_t icall_handle, ipc_call_t *icall) 697 697 { 698 698 driver_t *drv; … … 700 700 drv = driver_find(&drivers_list, IPC_GET_ARG1(*icall)); 701 701 if (drv == NULL) { 702 async_answer_0(i id, ENOENT);703 return; 704 } 705 706 async_answer_1(i id, EOK, (sysarg_t) drv->state);702 async_answer_0(icall_handle, ENOENT); 703 return; 704 } 705 706 async_answer_1(icall_handle, EOK, (sysarg_t) drv->state); 707 707 } 708 708 709 709 /** Forcibly load a driver. */ 710 static void devman_driver_load(cap_call_handle_t i id, ipc_call_t *icall)710 static void devman_driver_load(cap_call_handle_t icall_handle, ipc_call_t *icall) 711 711 { 712 712 driver_t *drv; … … 715 715 drv = driver_find(&drivers_list, IPC_GET_ARG1(*icall)); 716 716 if (drv == NULL) { 717 async_answer_0(i id, ENOENT);717 async_answer_0(icall_handle, ENOENT); 718 718 return; 719 719 } … … 723 723 fibril_mutex_unlock(&drv->driver_mutex); 724 724 725 async_answer_0(i id, rc);725 async_answer_0(icall_handle, rc); 726 726 } 727 727 728 728 /** Unload a driver by user request. */ 729 static void devman_driver_unload(cap_call_handle_t i id, ipc_call_t *icall)729 static void devman_driver_unload(cap_call_handle_t icall_handle, ipc_call_t *icall) 730 730 { 731 731 driver_t *drv; … … 734 734 drv = driver_find(&drivers_list, IPC_GET_ARG1(*icall)); 735 735 if (drv == NULL) { 736 async_answer_0(i id, ENOENT);736 async_answer_0(icall_handle, ENOENT); 737 737 return; 738 738 } … … 742 742 fibril_mutex_unlock(&drv->driver_mutex); 743 743 744 async_answer_0(i id, rc);744 async_answer_0(icall_handle, rc); 745 745 } 746 746 747 747 /** Function for handling connections from a client to the device manager. */ 748 void devman_connection_client(cap_call_handle_t i id, ipc_call_t *icall, void *arg)748 void devman_connection_client(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg) 749 749 { 750 750 /* Accept connection. */ 751 async_answer_0(i id, EOK);751 async_answer_0(icall_handle, EOK); 752 752 753 753 while (true) { 754 754 ipc_call_t call; 755 cap_call_handle_t c allid= async_get_call(&call);755 cap_call_handle_t chandle = async_get_call(&call); 756 756 757 757 if (!IPC_GET_IMETHOD(call)) … … 760 760 switch (IPC_GET_IMETHOD(call)) { 761 761 case DEVMAN_DEVICE_GET_HANDLE: 762 devman_function_get_handle(c allid, &call);762 devman_function_get_handle(chandle, &call); 763 763 break; 764 764 case DEVMAN_DEV_GET_PARENT: 765 devman_dev_get_parent(c allid, &call);765 devman_dev_get_parent(chandle, &call); 766 766 break; 767 767 case DEVMAN_DEV_GET_FUNCTIONS: 768 devman_dev_get_functions(c allid, &call);768 devman_dev_get_functions(chandle, &call); 769 769 break; 770 770 case DEVMAN_FUN_GET_CHILD: 771 devman_fun_get_child(c allid, &call);771 devman_fun_get_child(chandle, &call); 772 772 break; 773 773 case DEVMAN_FUN_GET_MATCH_ID: 774 devman_fun_get_match_id(c allid, &call);774 devman_fun_get_match_id(chandle, &call); 775 775 break; 776 776 case DEVMAN_FUN_GET_NAME: 777 devman_fun_get_name(c allid, &call);777 devman_fun_get_name(chandle, &call); 778 778 break; 779 779 case DEVMAN_FUN_GET_DRIVER_NAME: 780 devman_fun_get_driver_name(c allid, &call);780 devman_fun_get_driver_name(chandle, &call); 781 781 break; 782 782 case DEVMAN_FUN_GET_PATH: 783 devman_fun_get_path(c allid, &call);783 devman_fun_get_path(chandle, &call); 784 784 break; 785 785 case DEVMAN_FUN_ONLINE: 786 devman_fun_online(c allid, &call);786 devman_fun_online(chandle, &call); 787 787 break; 788 788 case DEVMAN_FUN_OFFLINE: 789 devman_fun_offline(c allid, &call);789 devman_fun_offline(chandle, &call); 790 790 break; 791 791 case DEVMAN_FUN_SID_TO_HANDLE: 792 devman_fun_sid_to_handle(c allid, &call);792 devman_fun_sid_to_handle(chandle, &call); 793 793 break; 794 794 case DEVMAN_GET_DRIVERS: 795 devman_get_drivers(c allid, &call);795 devman_get_drivers(chandle, &call); 796 796 break; 797 797 case DEVMAN_DRIVER_GET_DEVICES: 798 devman_driver_get_devices(c allid, &call);798 devman_driver_get_devices(chandle, &call); 799 799 break; 800 800 case DEVMAN_DRIVER_GET_HANDLE: 801 devman_driver_get_handle(c allid, &call);801 devman_driver_get_handle(chandle, &call); 802 802 break; 803 803 case DEVMAN_DRIVER_GET_MATCH_ID: 804 devman_driver_get_match_id(c allid, &call);804 devman_driver_get_match_id(chandle, &call); 805 805 break; 806 806 case DEVMAN_DRIVER_GET_NAME: 807 devman_driver_get_name(c allid, &call);807 devman_driver_get_name(chandle, &call); 808 808 break; 809 809 case DEVMAN_DRIVER_GET_STATE: 810 devman_driver_get_state(c allid, &call);810 devman_driver_get_state(chandle, &call); 811 811 break; 812 812 case DEVMAN_DRIVER_LOAD: 813 devman_driver_load(c allid, &call);813 devman_driver_load(chandle, &call); 814 814 break; 815 815 case DEVMAN_DRIVER_UNLOAD: 816 devman_driver_unload(c allid, &call);816 devman_driver_unload(chandle, &call); 817 817 break; 818 818 default: 819 async_answer_0(c allid, ENOENT);819 async_answer_0(chandle, ENOENT); 820 820 } 821 821 }
Note:
See TracChangeset
for help on using the changeset viewer.