Changes in uspace/lib/c/generic/devman.c [d0dd7b5:b72efe8] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/devman.c
rd0dd7b5 rb72efe8 271 271 } 272 272 273 int devman_add_device_to_c ategory(devman_handle_t devman_handle,274 const char *c at_name)273 int devman_add_device_to_class(devman_handle_t devman_handle, 274 const char *class_name) 275 275 { 276 276 async_exch_t *exch = devman_exchange_begin_blocking(DEVMAN_DRIVER); 277 277 278 278 ipc_call_t answer; 279 aid_t req = async_send_1(exch, DEVMAN_ADD_DEVICE_TO_C ATEGORY,279 aid_t req = async_send_1(exch, DEVMAN_ADD_DEVICE_TO_CLASS, 280 280 devman_handle, &answer); 281 sysarg_t retval = async_data_write_start(exch, c at_name,282 str_size(c at_name));281 sysarg_t retval = async_data_write_start(exch, class_name, 282 str_size(class_name)); 283 283 284 284 devman_exchange_end(exch); … … 308 308 } 309 309 310 /** Remove function from device.311 *312 * Request devman to remove function owned by this driver task.313 * @param funh Devman handle of the function314 *315 * @return EOK on success or negative error code.316 */317 int devman_remove_function(devman_handle_t funh)318 {319 async_exch_t *exch;320 sysarg_t retval;321 322 exch = devman_exchange_begin_blocking(DEVMAN_DRIVER);323 retval = async_req_1_0(exch, DEVMAN_REMOVE_FUNCTION, (sysarg_t) funh);324 devman_exchange_end(exch);325 326 return (int) retval;327 }328 329 310 async_sess_t *devman_parent_device_connect(exch_mgmt_t mgmt, 330 311 devman_handle_t handle, unsigned int flags) … … 352 333 exch = devman_exchange_begin(DEVMAN_CLIENT); 353 334 if (exch == NULL) 354 return ENOMEM;335 return errno; 355 336 } 356 337 … … 383 364 } 384 365 366 int devman_device_get_handle_by_class(const char *classname, 367 const char *devname, devman_handle_t *handle, unsigned int flags) 368 { 369 async_exch_t *exch; 370 371 if (flags & IPC_FLAG_BLOCKING) 372 exch = devman_exchange_begin_blocking(DEVMAN_CLIENT); 373 else { 374 exch = devman_exchange_begin(DEVMAN_CLIENT); 375 if (exch == NULL) 376 return errno; 377 } 378 379 ipc_call_t answer; 380 aid_t req = async_send_1(exch, DEVMAN_DEVICE_GET_HANDLE_BY_CLASS, 381 flags, &answer); 382 sysarg_t retval = async_data_write_start(exch, classname, 383 str_size(classname)); 384 385 if (retval != EOK) { 386 devman_exchange_end(exch); 387 async_wait_for(req, NULL); 388 return retval; 389 } 390 391 retval = async_data_write_start(exch, devname, 392 str_size(devname)); 393 394 devman_exchange_end(exch); 395 396 if (retval != EOK) { 397 async_wait_for(req, NULL); 398 return retval; 399 } 400 401 async_wait_for(req, &retval); 402 403 if (retval != EOK) { 404 if (handle != NULL) 405 *handle = (devman_handle_t) -1; 406 407 return retval; 408 } 409 410 if (handle != NULL) 411 *handle = (devman_handle_t) IPC_GET_ARG1(answer); 412 413 return retval; 414 } 415 385 416 int devman_get_device_path(devman_handle_t handle, char *path, size_t path_size) 386 417 { 387 418 async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT); 388 419 if (exch == NULL) 389 return ENOMEM;420 return errno; 390 421 391 422 ipc_call_t answer; … … 432 463 } 433 464 434 int devman_fun_sid_to_handle(service_id_t sid, devman_handle_t *handle)435 {436 async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT);437 if (exch == NULL)438 return ENOMEM;439 440 sysarg_t retval = async_req_1_1(exch, DEVMAN_FUN_SID_TO_HANDLE,441 sid, handle);442 443 devman_exchange_end(exch);444 return (int) retval;445 }446 447 465 /** @} 448 466 */
Note:
See TracChangeset
for help on using the changeset viewer.