Changes in uspace/lib/c/generic/devman.c [b7fd2a0:cde999a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/devman.c
rb7fd2a0 rcde999a 176 176 177 177 /** Register running driver with device manager. */ 178 errno_t devman_driver_register(const char *name)178 int devman_driver_register(const char *name) 179 179 { 180 180 async_exch_t *exch = devman_exchange_begin_blocking(INTERFACE_DDF_DRIVER); … … 182 182 ipc_call_t answer; 183 183 aid_t req = async_send_2(exch, DEVMAN_DRIVER_REGISTER, 0, 0, &answer); 184 errno_t retval = async_data_write_start(exch, name, str_size(name));184 int retval = async_data_write_start(exch, name, str_size(name)); 185 185 186 186 devman_exchange_end(exch); … … 213 213 * 214 214 */ 215 errno_t devman_add_function(const char *name, fun_type_t ftype,215 int devman_add_function(const char *name, fun_type_t ftype, 216 216 match_id_list_t *match_ids, devman_handle_t devh, devman_handle_t *funh) 217 217 { … … 222 222 aid_t req = async_send_3(exch, DEVMAN_ADD_FUNCTION, (sysarg_t) ftype, 223 223 devh, match_count, &answer); 224 errno_t retval = async_data_write_start(exch, name, str_size(name));224 int retval = async_data_write_start(exch, name, str_size(name)); 225 225 if (retval != EOK) { 226 226 devman_exchange_end(exch); … … 264 264 } 265 265 266 errno_t devman_add_device_to_category(devman_handle_t devman_handle,266 int devman_add_device_to_category(devman_handle_t devman_handle, 267 267 const char *cat_name) 268 268 { … … 272 272 aid_t req = async_send_1(exch, DEVMAN_ADD_DEVICE_TO_CATEGORY, 273 273 devman_handle, &answer); 274 errno_t retval = async_data_write_start(exch, cat_name,274 int retval = async_data_write_start(exch, cat_name, 275 275 str_size(cat_name)); 276 276 … … 307 307 * @return EOK on success or an error code. 308 308 */ 309 errno_t devman_remove_function(devman_handle_t funh)309 int devman_remove_function(devman_handle_t funh) 310 310 { 311 311 async_exch_t *exch; 312 errno_t retval;312 int retval; 313 313 314 314 exch = devman_exchange_begin_blocking(INTERFACE_DDF_DRIVER); … … 319 319 } 320 320 321 errno_t devman_drv_fun_online(devman_handle_t funh)321 int devman_drv_fun_online(devman_handle_t funh) 322 322 { 323 323 async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_DRIVER); … … 325 325 return ENOMEM; 326 326 327 errno_t retval = async_req_1_0(exch, DEVMAN_DRV_FUN_ONLINE, funh);328 329 devman_exchange_end(exch); 330 return retval; 331 } 332 333 errno_t devman_drv_fun_offline(devman_handle_t funh)327 int retval = async_req_1_0(exch, DEVMAN_DRV_FUN_ONLINE, funh); 328 329 devman_exchange_end(exch); 330 return retval; 331 } 332 333 int devman_drv_fun_offline(devman_handle_t funh) 334 334 { 335 335 async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_DRIVER); … … 337 337 return ENOMEM; 338 338 339 errno_t retval = async_req_1_0(exch, DEVMAN_DRV_FUN_OFFLINE, funh);339 int retval = async_req_1_0(exch, DEVMAN_DRV_FUN_OFFLINE, funh); 340 340 341 341 devman_exchange_end(exch); … … 358 358 } 359 359 360 errno_t devman_fun_get_handle(const char *pathname, devman_handle_t *handle,360 int devman_fun_get_handle(const char *pathname, devman_handle_t *handle, 361 361 unsigned int flags) 362 362 { … … 374 374 aid_t req = async_send_2(exch, DEVMAN_DEVICE_GET_HANDLE, flags, 0, 375 375 &answer); 376 errno_t retval = async_data_write_start(exch, pathname,376 int retval = async_data_write_start(exch, pathname, 377 377 str_size(pathname)); 378 378 … … 399 399 } 400 400 401 static errno_t devman_get_str_internal(sysarg_t method, sysarg_t arg1,401 static int devman_get_str_internal(sysarg_t method, sysarg_t arg1, 402 402 sysarg_t arg2, sysarg_t *r1, char *buf, size_t buf_size) 403 403 { … … 405 405 ipc_call_t dreply; 406 406 size_t act_size; 407 errno_t dretval;407 int dretval; 408 408 409 409 exch = devman_exchange_begin_blocking(INTERFACE_DDF_CLIENT); … … 421 421 } 422 422 423 errno_t retval;423 int retval; 424 424 async_wait_for(req, &retval); 425 425 … … 437 437 } 438 438 439 errno_t devman_fun_get_path(devman_handle_t handle, char *buf, size_t buf_size)439 int devman_fun_get_path(devman_handle_t handle, char *buf, size_t buf_size) 440 440 { 441 441 return devman_get_str_internal(DEVMAN_FUN_GET_PATH, handle, 0, NULL, … … 443 443 } 444 444 445 errno_t devman_fun_get_match_id(devman_handle_t handle, size_t index, char *buf,445 int devman_fun_get_match_id(devman_handle_t handle, size_t index, char *buf, 446 446 size_t buf_size, unsigned int *rscore) 447 447 { 448 errno_t rc;448 int rc; 449 449 sysarg_t score = 0; 450 450 … … 458 458 } 459 459 460 errno_t devman_fun_get_name(devman_handle_t handle, char *buf, size_t buf_size)460 int devman_fun_get_name(devman_handle_t handle, char *buf, size_t buf_size) 461 461 { 462 462 return devman_get_str_internal(DEVMAN_FUN_GET_NAME, handle, 0, NULL, … … 464 464 } 465 465 466 errno_t devman_fun_get_driver_name(devman_handle_t handle, char *buf, size_t buf_size)466 int devman_fun_get_driver_name(devman_handle_t handle, char *buf, size_t buf_size) 467 467 { 468 468 return devman_get_str_internal(DEVMAN_FUN_GET_DRIVER_NAME, handle, 0, … … 470 470 } 471 471 472 errno_t devman_fun_online(devman_handle_t funh)472 int devman_fun_online(devman_handle_t funh) 473 473 { 474 474 async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT); … … 476 476 return ENOMEM; 477 477 478 errno_t retval = async_req_1_0(exch, DEVMAN_FUN_ONLINE, funh);479 480 devman_exchange_end(exch); 481 return retval; 482 } 483 484 errno_t devman_fun_offline(devman_handle_t funh)478 int retval = async_req_1_0(exch, DEVMAN_FUN_ONLINE, funh); 479 480 devman_exchange_end(exch); 481 return retval; 482 } 483 484 int devman_fun_offline(devman_handle_t funh) 485 485 { 486 486 async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT); … … 488 488 return ENOMEM; 489 489 490 errno_t retval = async_req_1_0(exch, DEVMAN_FUN_OFFLINE, funh);491 492 devman_exchange_end(exch); 493 return retval; 494 } 495 496 static errno_t devman_get_handles_once(sysarg_t method, sysarg_t arg1,490 int retval = async_req_1_0(exch, DEVMAN_FUN_OFFLINE, funh); 491 492 devman_exchange_end(exch); 493 return retval; 494 } 495 496 static int devman_get_handles_once(sysarg_t method, sysarg_t arg1, 497 497 devman_handle_t *handle_buf, size_t buf_size, size_t *act_size) 498 498 { … … 501 501 ipc_call_t answer; 502 502 aid_t req = async_send_1(exch, method, arg1, &answer); 503 errno_t rc = async_data_read_start(exch, handle_buf, buf_size);503 int rc = async_data_read_start(exch, handle_buf, buf_size); 504 504 505 505 devman_exchange_end(exch); … … 510 510 } 511 511 512 errno_t retval;512 int retval; 513 513 async_wait_for(req, &retval); 514 514 … … 531 531 * @return EOK on success or an error code 532 532 */ 533 static errno_t devman_get_handles_internal(sysarg_t method, sysarg_t arg1,533 static int devman_get_handles_internal(sysarg_t method, sysarg_t arg1, 534 534 devman_handle_t **data, size_t *count) 535 535 { … … 537 537 size_t act_size; 538 538 size_t alloc_size; 539 errno_t rc;539 int rc; 540 540 541 541 *data = NULL; … … 574 574 } 575 575 576 errno_t devman_fun_get_child(devman_handle_t funh, devman_handle_t *devh)576 int devman_fun_get_child(devman_handle_t funh, devman_handle_t *devh) 577 577 { 578 578 async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT); … … 580 580 return ENOMEM; 581 581 582 errno_t retval = async_req_1_1(exch, DEVMAN_FUN_GET_CHILD,582 int retval = async_req_1_1(exch, DEVMAN_FUN_GET_CHILD, 583 583 funh, devh); 584 584 … … 587 587 } 588 588 589 errno_t devman_dev_get_functions(devman_handle_t devh, devman_handle_t **funcs,589 int devman_dev_get_functions(devman_handle_t devh, devman_handle_t **funcs, 590 590 size_t *count) 591 591 { … … 594 594 } 595 595 596 errno_t devman_dev_get_parent(devman_handle_t devh, devman_handle_t *funh)596 int devman_dev_get_parent(devman_handle_t devh, devman_handle_t *funh) 597 597 { 598 598 async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT); … … 600 600 return ENOMEM; 601 601 602 errno_t retval = async_req_1_1(exch, DEVMAN_DEV_GET_PARENT,602 int retval = async_req_1_1(exch, DEVMAN_DEV_GET_PARENT, 603 603 devh, funh); 604 604 … … 607 607 } 608 608 609 errno_t devman_fun_sid_to_handle(service_id_t sid, devman_handle_t *handle)609 int devman_fun_sid_to_handle(service_id_t sid, devman_handle_t *handle) 610 610 { 611 611 async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT); … … 613 613 return ENOMEM; 614 614 615 errno_t retval = async_req_1_1(exch, DEVMAN_FUN_SID_TO_HANDLE,615 int retval = async_req_1_1(exch, DEVMAN_FUN_SID_TO_HANDLE, 616 616 sid, handle); 617 617 … … 620 620 } 621 621 622 errno_t devman_get_drivers(devman_handle_t **drvs,622 int devman_get_drivers(devman_handle_t **drvs, 623 623 size_t *count) 624 624 { … … 626 626 } 627 627 628 errno_t devman_driver_get_devices(devman_handle_t drvh, devman_handle_t **devs,628 int devman_driver_get_devices(devman_handle_t drvh, devman_handle_t **devs, 629 629 size_t *count) 630 630 { … … 633 633 } 634 634 635 errno_t devman_driver_get_handle(const char *drvname, devman_handle_t *handle)635 int devman_driver_get_handle(const char *drvname, devman_handle_t *handle) 636 636 { 637 637 async_exch_t *exch; … … 643 643 ipc_call_t answer; 644 644 aid_t req = async_send_0(exch, DEVMAN_DRIVER_GET_HANDLE, &answer); 645 errno_t retval = async_data_write_start(exch, drvname,645 int retval = async_data_write_start(exch, drvname, 646 646 str_size(drvname)); 647 647 … … 668 668 } 669 669 670 errno_t devman_driver_get_match_id(devman_handle_t handle, size_t index, char *buf,670 int devman_driver_get_match_id(devman_handle_t handle, size_t index, char *buf, 671 671 size_t buf_size, unsigned int *rscore) 672 672 { 673 errno_t rc;673 int rc; 674 674 sysarg_t score = 0; 675 675 … … 683 683 } 684 684 685 errno_t devman_driver_get_name(devman_handle_t handle, char *buf, size_t buf_size)685 int devman_driver_get_name(devman_handle_t handle, char *buf, size_t buf_size) 686 686 { 687 687 return devman_get_str_internal(DEVMAN_DRIVER_GET_NAME, handle, 0, NULL, … … 689 689 } 690 690 691 errno_t devman_driver_get_state(devman_handle_t drvh, driver_state_t *rstate)691 int devman_driver_get_state(devman_handle_t drvh, driver_state_t *rstate) 692 692 { 693 693 sysarg_t state; … … 696 696 return ENOMEM; 697 697 698 errno_t rc = async_req_1_1(exch, DEVMAN_DRIVER_GET_STATE, drvh,698 int rc = async_req_1_1(exch, DEVMAN_DRIVER_GET_STATE, drvh, 699 699 &state); 700 700 … … 707 707 } 708 708 709 errno_t devman_driver_load(devman_handle_t drvh)709 int devman_driver_load(devman_handle_t drvh) 710 710 { 711 711 async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT); … … 713 713 return ENOMEM; 714 714 715 errno_t rc = async_req_1_0(exch, DEVMAN_DRIVER_LOAD, drvh);715 int rc = async_req_1_0(exch, DEVMAN_DRIVER_LOAD, drvh); 716 716 717 717 devman_exchange_end(exch); … … 719 719 } 720 720 721 errno_t devman_driver_unload(devman_handle_t drvh)721 int devman_driver_unload(devman_handle_t drvh) 722 722 { 723 723 async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT); … … 725 725 return ENOMEM; 726 726 727 errno_t rc = async_req_1_0(exch, DEVMAN_DRIVER_UNLOAD, drvh);727 int rc = async_req_1_0(exch, DEVMAN_DRIVER_UNLOAD, drvh); 728 728 729 729 devman_exchange_end(exch);
Note:
See TracChangeset
for help on using the changeset viewer.