Changeset f658458 in mainline for uspace/lib/libc/generic/devman.c


Ignore:
Timestamp:
2010-05-02T20:49:09Z (14 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bb864a0
Parents:
25a7e11d
Message:

parts of generic char interface, fixed some bugs

File:
1 edited

Legend:

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

    r25a7e11d rf658458  
    230230}
    231231
     232int devman_device_get_handle(const char *pathname, device_handle_t *handle, unsigned int flags)
     233{
     234        int phone = devman_get_phone(DEVMAN_CLIENT, flags);
     235       
     236        if (phone < 0)
     237                return phone;
     238       
     239        async_serialize_start();
     240       
     241        ipc_call_t answer;
     242        aid_t req = async_send_2(phone, DEVMAN_DEVICE_GET_HANDLE, flags, 0,
     243            &answer);
     244       
     245        ipcarg_t retval = async_data_write_start(phone, pathname, str_size(pathname));
     246        if (retval != EOK) {
     247                async_wait_for(req, NULL);
     248                async_serialize_end();
     249                return retval;
     250        }
     251       
     252        async_wait_for(req, &retval);
     253       
     254        async_serialize_end();
     255       
     256        if (retval != EOK) {
     257                if (handle != NULL)
     258                        *handle = (device_handle_t) -1;
     259                return retval;
     260        }
     261       
     262        if (handle != NULL)
     263                *handle = (device_handle_t) IPC_GET_ARG1(answer);
     264       
     265        return retval;
     266}
     267
     268
    232269/** @}
    233270 */
Note: See TracChangeset for help on using the changeset viewer.