Changeset 973ef9fc in mainline for uspace/lib/c/generic/devmap.c


Ignore:
Timestamp:
2010-12-25T21:20:28Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
631ee0c
Parents:
1bfd3d3 (diff), 09178b7f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    r1bfd3d3 r973ef9fc  
    107107        aid_t req = async_send_2(phone, DEVMAP_DRIVER_REGISTER, 0, 0, &answer);
    108108       
    109         ipcarg_t retval = async_data_write_start(phone, name, str_size(name));
     109        sysarg_t retval = async_data_write_start(phone, name, str_size(name));
    110110        if (retval != EOK) {
    111111                async_wait_for(req, NULL);
     
    116116        async_set_client_connection(conn);
    117117       
    118         ipcarg_t callback_phonehash;
     118        sysarg_t callback_phonehash;
    119119        ipc_connect_to_me(phone, 0, 0, 0, &callback_phonehash);
    120120        async_wait_for(req, &retval);
     
    127127/** Register new device.
    128128 *
    129  * @param namespace Namespace name.
     129 * The @p interface is used when forwarding connection to the driver.
     130 * If not 0, the first argument is the interface and the second argument
     131 * is the devmap handle of the device.
     132 * When the interface is zero (default), the first argument is directly
     133 * the handle (to ensure backward compatibility).
     134 *
     135 * @param fqdn Fully qualified device name.
     136 * @param[out] handle Handle to the created instance of device.
     137 * @param interface Interface when forwarding.
     138 *
     139 */
     140int devmap_device_register_with_iface(const char *fqdn,
     141    devmap_handle_t *handle, sysarg_t interface)
     142{
     143        int phone = devmap_get_phone(DEVMAP_DRIVER, IPC_FLAG_BLOCKING);
     144       
     145        if (phone < 0)
     146                return phone;
     147       
     148        async_serialize_start();
     149       
     150        ipc_call_t answer;
     151        aid_t req = async_send_2(phone, DEVMAP_DEVICE_REGISTER, interface, 0,
     152            &answer);
     153       
     154        sysarg_t retval = async_data_write_start(phone, fqdn, str_size(fqdn));
     155        if (retval != EOK) {
     156                async_wait_for(req, NULL);
     157                async_serialize_end();
     158                return retval;
     159        }
     160       
     161        async_wait_for(req, &retval);
     162       
     163        async_serialize_end();
     164       
     165        if (retval != EOK) {
     166                if (handle != NULL)
     167                        *handle = -1;
     168                return retval;
     169        }
     170       
     171        if (handle != NULL)
     172                *handle = (devmap_handle_t) IPC_GET_ARG1(answer);
     173       
     174        return retval;
     175}
     176
     177/** Register new device.
     178 *
    130179 * @param fqdn      Fully qualified device name.
    131180 * @param handle    Output: Handle to the created instance of device.
     
    134183int devmap_device_register(const char *fqdn, devmap_handle_t *handle)
    135184{
    136         int phone = devmap_get_phone(DEVMAP_DRIVER, IPC_FLAG_BLOCKING);
    137        
    138         if (phone < 0)
    139                 return phone;
    140        
    141         async_serialize_start();
    142        
    143         ipc_call_t answer;
    144         aid_t req = async_send_2(phone, DEVMAP_DEVICE_REGISTER, 0, 0,
    145             &answer);
    146        
    147         ipcarg_t retval = async_data_write_start(phone, fqdn, str_size(fqdn));
    148         if (retval != EOK) {
    149                 async_wait_for(req, NULL);
    150                 async_serialize_end();
    151                 return retval;
    152         }
    153        
    154         async_wait_for(req, &retval);
    155        
    156         async_serialize_end();
    157        
    158         if (retval != EOK) {
    159                 if (handle != NULL)
    160                         *handle = -1;
    161                 return retval;
    162         }
    163        
    164         if (handle != NULL)
    165                 *handle = (devmap_handle_t) IPC_GET_ARG1(answer);
    166        
    167         return retval;
    168 }
     185        return devmap_device_register_with_iface(fqdn, handle, 0);
     186}
     187
    169188
    170189int devmap_device_get_handle(const char *fqdn, devmap_handle_t *handle, unsigned int flags)
     
    181200            &answer);
    182201       
    183         ipcarg_t retval = async_data_write_start(phone, fqdn, str_size(fqdn));
     202        sysarg_t retval = async_data_write_start(phone, fqdn, str_size(fqdn));
    184203        if (retval != EOK) {
    185204                async_wait_for(req, NULL);
     
    217236            &answer);
    218237       
    219         ipcarg_t retval = async_data_write_start(phone, name, str_size(name));
     238        sysarg_t retval = async_data_write_start(phone, name, str_size(name));
    220239        if (retval != EOK) {
    221240                async_wait_for(req, NULL);
     
    247266                return phone;
    248267       
    249         ipcarg_t type;
     268        sysarg_t type;
    250269        int retval = async_req_1_1(phone, DEVMAP_HANDLE_PROBE, handle, &type);
    251270        if (retval != EOK)
     
    260279       
    261280        if (flags & IPC_FLAG_BLOCKING) {
    262                 phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAP,
     281                phone = async_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAP,
    263282                    DEVMAP_CONNECT_TO_DEVICE, handle);
    264283        } else {
    265                 phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAP,
     284                phone = async_connect_me_to(PHONE_NS, SERVICE_DEVMAP,
    266285                    DEVMAP_CONNECT_TO_DEVICE, handle);
    267286        }
     
    277296                return -1;
    278297       
    279         ipcarg_t null_id;
     298        sysarg_t null_id;
    280299        int retval = async_req_0_1(phone, DEVMAP_NULL_CREATE, &null_id);
    281300        if (retval != EOK)
     
    292311                return;
    293312       
    294         async_req_1_0(phone, DEVMAP_NULL_DESTROY, (ipcarg_t) null_id);
     313        async_req_1_0(phone, DEVMAP_NULL_DESTROY, (sysarg_t) null_id);
    295314}
    296315
    297316static size_t devmap_count_namespaces_internal(int phone)
    298317{
    299         ipcarg_t count;
     318        sysarg_t count;
    300319        int retval = async_req_0_1(phone, DEVMAP_GET_NAMESPACE_COUNT, &count);
    301320        if (retval != EOK)
     
    307326static size_t devmap_count_devices_internal(int phone, devmap_handle_t ns_handle)
    308327{
    309         ipcarg_t count;
     328        sysarg_t count;
    310329        int retval = async_req_1_1(phone, DEVMAP_GET_DEVICE_COUNT, ns_handle, &count);
    311330        if (retval != EOK)
     
    375394                }
    376395               
    377                 ipcarg_t retval;
     396                sysarg_t retval;
    378397                async_wait_for(req, &retval);
    379398                async_serialize_end();
     
    427446                }
    428447               
    429                 ipcarg_t retval;
     448                sysarg_t retval;
    430449                async_wait_for(req, &retval);
    431450                async_serialize_end();
Note: See TracChangeset for help on using the changeset viewer.