Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/devman.c

    rcde999a rb7fd2a0  
    176176
    177177/** Register running driver with device manager. */
    178 int devman_driver_register(const char *name)
     178errno_t devman_driver_register(const char *name)
    179179{
    180180        async_exch_t *exch = devman_exchange_begin_blocking(INTERFACE_DDF_DRIVER);
     
    182182        ipc_call_t answer;
    183183        aid_t req = async_send_2(exch, DEVMAN_DRIVER_REGISTER, 0, 0, &answer);
    184         int retval = async_data_write_start(exch, name, str_size(name));
     184        errno_t retval = async_data_write_start(exch, name, str_size(name));
    185185       
    186186        devman_exchange_end(exch);
     
    213213 *
    214214 */
    215 int devman_add_function(const char *name, fun_type_t ftype,
     215errno_t devman_add_function(const char *name, fun_type_t ftype,
    216216    match_id_list_t *match_ids, devman_handle_t devh, devman_handle_t *funh)
    217217{
     
    222222        aid_t req = async_send_3(exch, DEVMAN_ADD_FUNCTION, (sysarg_t) ftype,
    223223            devh, match_count, &answer);
    224         int retval = async_data_write_start(exch, name, str_size(name));
     224        errno_t retval = async_data_write_start(exch, name, str_size(name));
    225225        if (retval != EOK) {
    226226                devman_exchange_end(exch);
     
    264264}
    265265
    266 int devman_add_device_to_category(devman_handle_t devman_handle,
     266errno_t devman_add_device_to_category(devman_handle_t devman_handle,
    267267    const char *cat_name)
    268268{
     
    272272        aid_t req = async_send_1(exch, DEVMAN_ADD_DEVICE_TO_CATEGORY,
    273273            devman_handle, &answer);
    274         int retval = async_data_write_start(exch, cat_name,
     274        errno_t retval = async_data_write_start(exch, cat_name,
    275275            str_size(cat_name));
    276276       
     
    307307 * @return EOK on success or an error code.
    308308 */
    309 int devman_remove_function(devman_handle_t funh)
     309errno_t devman_remove_function(devman_handle_t funh)
    310310{
    311311        async_exch_t *exch;
    312         int retval;
     312        errno_t retval;
    313313       
    314314        exch = devman_exchange_begin_blocking(INTERFACE_DDF_DRIVER);
     
    319319}
    320320
    321 int devman_drv_fun_online(devman_handle_t funh)
     321errno_t devman_drv_fun_online(devman_handle_t funh)
    322322{
    323323        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_DRIVER);
     
    325325                return ENOMEM;
    326326       
    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)
     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
     333errno_t devman_drv_fun_offline(devman_handle_t funh)
    334334{
    335335        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_DRIVER);
     
    337337                return ENOMEM;
    338338       
    339         int retval = async_req_1_0(exch, DEVMAN_DRV_FUN_OFFLINE, funh);
     339        errno_t retval = async_req_1_0(exch, DEVMAN_DRV_FUN_OFFLINE, funh);
    340340       
    341341        devman_exchange_end(exch);
     
    358358}
    359359
    360 int devman_fun_get_handle(const char *pathname, devman_handle_t *handle,
     360errno_t devman_fun_get_handle(const char *pathname, devman_handle_t *handle,
    361361    unsigned int flags)
    362362{
     
    374374        aid_t req = async_send_2(exch, DEVMAN_DEVICE_GET_HANDLE, flags, 0,
    375375            &answer);
    376         int retval = async_data_write_start(exch, pathname,
     376        errno_t retval = async_data_write_start(exch, pathname,
    377377            str_size(pathname));
    378378       
     
    399399}
    400400
    401 static int devman_get_str_internal(sysarg_t method, sysarg_t arg1,
     401static errno_t devman_get_str_internal(sysarg_t method, sysarg_t arg1,
    402402    sysarg_t arg2, sysarg_t *r1, char *buf, size_t buf_size)
    403403{
     
    405405        ipc_call_t dreply;
    406406        size_t act_size;
    407         int dretval;
     407        errno_t dretval;
    408408       
    409409        exch = devman_exchange_begin_blocking(INTERFACE_DDF_CLIENT);
     
    421421        }
    422422       
    423         int retval;
     423        errno_t retval;
    424424        async_wait_for(req, &retval);
    425425       
     
    437437}
    438438
    439 int devman_fun_get_path(devman_handle_t handle, char *buf, size_t buf_size)
     439errno_t devman_fun_get_path(devman_handle_t handle, char *buf, size_t buf_size)
    440440{
    441441        return devman_get_str_internal(DEVMAN_FUN_GET_PATH, handle, 0, NULL,
     
    443443}
    444444
    445 int devman_fun_get_match_id(devman_handle_t handle, size_t index, char *buf,
     445errno_t devman_fun_get_match_id(devman_handle_t handle, size_t index, char *buf,
    446446    size_t buf_size, unsigned int *rscore)
    447447{
    448         int rc;
     448        errno_t rc;
    449449        sysarg_t score = 0;
    450450
     
    458458}
    459459
    460 int devman_fun_get_name(devman_handle_t handle, char *buf, size_t buf_size)
     460errno_t devman_fun_get_name(devman_handle_t handle, char *buf, size_t buf_size)
    461461{
    462462        return devman_get_str_internal(DEVMAN_FUN_GET_NAME, handle, 0, NULL,
     
    464464}
    465465
    466 int devman_fun_get_driver_name(devman_handle_t handle, char *buf, size_t buf_size)
     466errno_t devman_fun_get_driver_name(devman_handle_t handle, char *buf, size_t buf_size)
    467467{
    468468        return devman_get_str_internal(DEVMAN_FUN_GET_DRIVER_NAME, handle, 0,
     
    470470}
    471471
    472 int devman_fun_online(devman_handle_t funh)
     472errno_t devman_fun_online(devman_handle_t funh)
    473473{
    474474        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
     
    476476                return ENOMEM;
    477477       
    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)
     478        errno_t retval = async_req_1_0(exch, DEVMAN_FUN_ONLINE, funh);
     479       
     480        devman_exchange_end(exch);
     481        return retval;
     482}
     483
     484errno_t devman_fun_offline(devman_handle_t funh)
    485485{
    486486        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
     
    488488                return ENOMEM;
    489489       
    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,
     490        errno_t retval = async_req_1_0(exch, DEVMAN_FUN_OFFLINE, funh);
     491       
     492        devman_exchange_end(exch);
     493        return retval;
     494}
     495
     496static errno_t devman_get_handles_once(sysarg_t method, sysarg_t arg1,
    497497    devman_handle_t *handle_buf, size_t buf_size, size_t *act_size)
    498498{
     
    501501        ipc_call_t answer;
    502502        aid_t req = async_send_1(exch, method, arg1, &answer);
    503         int rc = async_data_read_start(exch, handle_buf, buf_size);
     503        errno_t rc = async_data_read_start(exch, handle_buf, buf_size);
    504504       
    505505        devman_exchange_end(exch);
     
    510510        }
    511511       
    512         int retval;
     512        errno_t retval;
    513513        async_wait_for(req, &retval);
    514514       
     
    531531 * @return              EOK on success or an error code
    532532 */
    533 static int devman_get_handles_internal(sysarg_t method, sysarg_t arg1,
     533static errno_t devman_get_handles_internal(sysarg_t method, sysarg_t arg1,
    534534    devman_handle_t **data, size_t *count)
    535535{
     
    537537        size_t act_size;
    538538        size_t alloc_size;
    539         int rc;
     539        errno_t rc;
    540540
    541541        *data = NULL;
     
    574574}
    575575
    576 int devman_fun_get_child(devman_handle_t funh, devman_handle_t *devh)
     576errno_t devman_fun_get_child(devman_handle_t funh, devman_handle_t *devh)
    577577{
    578578        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
     
    580580                return ENOMEM;
    581581       
    582         int retval = async_req_1_1(exch, DEVMAN_FUN_GET_CHILD,
     582        errno_t retval = async_req_1_1(exch, DEVMAN_FUN_GET_CHILD,
    583583            funh, devh);
    584584       
     
    587587}
    588588
    589 int devman_dev_get_functions(devman_handle_t devh, devman_handle_t **funcs,
     589errno_t devman_dev_get_functions(devman_handle_t devh, devman_handle_t **funcs,
    590590    size_t *count)
    591591{
     
    594594}
    595595
    596 int devman_dev_get_parent(devman_handle_t devh, devman_handle_t *funh)
     596errno_t devman_dev_get_parent(devman_handle_t devh, devman_handle_t *funh)
    597597{
    598598        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
     
    600600                return ENOMEM;
    601601       
    602         int retval = async_req_1_1(exch, DEVMAN_DEV_GET_PARENT,
     602        errno_t retval = async_req_1_1(exch, DEVMAN_DEV_GET_PARENT,
    603603            devh, funh);
    604604       
     
    607607}
    608608
    609 int devman_fun_sid_to_handle(service_id_t sid, devman_handle_t *handle)
     609errno_t devman_fun_sid_to_handle(service_id_t sid, devman_handle_t *handle)
    610610{
    611611        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
     
    613613                return ENOMEM;
    614614       
    615         int retval = async_req_1_1(exch, DEVMAN_FUN_SID_TO_HANDLE,
     615        errno_t retval = async_req_1_1(exch, DEVMAN_FUN_SID_TO_HANDLE,
    616616            sid, handle);
    617617       
     
    620620}
    621621
    622 int devman_get_drivers(devman_handle_t **drvs,
     622errno_t devman_get_drivers(devman_handle_t **drvs,
    623623    size_t *count)
    624624{
     
    626626}
    627627
    628 int devman_driver_get_devices(devman_handle_t drvh, devman_handle_t **devs,
     628errno_t devman_driver_get_devices(devman_handle_t drvh, devman_handle_t **devs,
    629629    size_t *count)
    630630{
     
    633633}
    634634
    635 int devman_driver_get_handle(const char *drvname, devman_handle_t *handle)
     635errno_t devman_driver_get_handle(const char *drvname, devman_handle_t *handle)
    636636{
    637637        async_exch_t *exch;
     
    643643        ipc_call_t answer;
    644644        aid_t req = async_send_0(exch, DEVMAN_DRIVER_GET_HANDLE, &answer);
    645         int retval = async_data_write_start(exch, drvname,
     645        errno_t retval = async_data_write_start(exch, drvname,
    646646            str_size(drvname));
    647647       
     
    668668}
    669669
    670 int devman_driver_get_match_id(devman_handle_t handle, size_t index, char *buf,
     670errno_t devman_driver_get_match_id(devman_handle_t handle, size_t index, char *buf,
    671671    size_t buf_size, unsigned int *rscore)
    672672{
    673         int rc;
     673        errno_t rc;
    674674        sysarg_t score = 0;
    675675
     
    683683}
    684684
    685 int devman_driver_get_name(devman_handle_t handle, char *buf, size_t buf_size)
     685errno_t devman_driver_get_name(devman_handle_t handle, char *buf, size_t buf_size)
    686686{
    687687        return devman_get_str_internal(DEVMAN_DRIVER_GET_NAME, handle, 0, NULL,
     
    689689}
    690690
    691 int devman_driver_get_state(devman_handle_t drvh, driver_state_t *rstate)
     691errno_t devman_driver_get_state(devman_handle_t drvh, driver_state_t *rstate)
    692692{
    693693        sysarg_t state;
     
    696696                return ENOMEM;
    697697       
    698         int rc = async_req_1_1(exch, DEVMAN_DRIVER_GET_STATE, drvh,
     698        errno_t rc = async_req_1_1(exch, DEVMAN_DRIVER_GET_STATE, drvh,
    699699            &state);
    700700       
     
    707707}
    708708
    709 int devman_driver_load(devman_handle_t drvh)
     709errno_t devman_driver_load(devman_handle_t drvh)
    710710{
    711711        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
     
    713713                return ENOMEM;
    714714       
    715         int rc = async_req_1_0(exch, DEVMAN_DRIVER_LOAD, drvh);
     715        errno_t rc = async_req_1_0(exch, DEVMAN_DRIVER_LOAD, drvh);
    716716       
    717717        devman_exchange_end(exch);
     
    719719}
    720720
    721 int devman_driver_unload(devman_handle_t drvh)
     721errno_t devman_driver_unload(devman_handle_t drvh)
    722722{
    723723        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
     
    725725                return ENOMEM;
    726726       
    727         int rc = async_req_1_0(exch, DEVMAN_DRIVER_UNLOAD, drvh);
     727        errno_t rc = async_req_1_0(exch, DEVMAN_DRIVER_UNLOAD, drvh);
    728728       
    729729        devman_exchange_end(exch);
Note: See TracChangeset for help on using the changeset viewer.