Changeset 1090b8c in mainline for uspace/lib/libc/generic/vfs/vfs.c


Ignore:
Timestamp:
2009-05-18T19:45:17Z (16 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c00589d
Parents:
c5747fe
Message:

C binding for devmap. Gets rid of duplicate code.

File:
1 edited

Legend:

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

    rc5747fe r1090b8c  
    4949#include <errno.h>
    5050#include <string.h>
    51 #include <ipc/devmap.h>
     51#include <devmap.h>
    5252#include "../../../srv/vfs/vfs.h"
    5353
     
    116116}
    117117
    118 static int device_get_handle(const char *name, dev_handle_t *handle,
    119     const unsigned int flags)
    120 {
    121         int phone;
    122        
    123         if (flags & IPC_FLAG_BLOCKING)
    124                 phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAP, DEVMAP_CLIENT, 0);
    125         else
    126                 phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAP, DEVMAP_CLIENT, 0);
    127        
    128         if (phone < 0)
    129                 return phone;
    130        
    131         ipc_call_t answer;
    132         aid_t req = async_send_2(phone, DEVMAP_DEVICE_GET_HANDLE, flags, 0,
    133             &answer);
    134        
    135         ipcarg_t retval = ipc_data_write_start(phone, name, str_size(name) + 1);
    136        
    137         if (retval != EOK) {
    138                 async_wait_for(req, NULL);
    139                 ipc_hangup(phone);
    140                 return retval;
    141         }
    142        
    143         async_wait_for(req, &retval);
    144        
    145         if (handle != NULL)
    146                 *handle = -1;
    147        
    148         if (retval == EOK) {
    149                 if (handle != NULL)
    150                         *handle = (dev_handle_t) IPC_GET_ARG1(answer);
    151         }
    152        
    153         ipc_hangup(phone);
    154         return retval;
    155 }
    156 
    157118int mount(const char *fs_name, const char *mp, const char *dev,
    158     const char *opts, const unsigned int flags)
     119    const char *opts, unsigned int flags)
    159120{
    160121        int res;
     
    163124        dev_handle_t dev_handle;
    164125       
    165         res = device_get_handle(dev, &dev_handle, flags);
     126        res = devmap_device_get_handle(dev, &dev_handle, flags);
    166127        if (res != EOK)
    167128                return res;
Note: See TracChangeset for help on using the changeset viewer.