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


Ignore:
Timestamp:
2008-06-03T15:05:07Z (16 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d51db07
Parents:
eda8b8b
Message:

mount: resolve device using devmap

File:
1 edited

Legend:

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

    reda8b8b r82405266  
    4949#include <errno.h>
    5050#include <string.h>
     51#include <ipc/devmap.h>
    5152#include "../../srv/vfs/vfs.h"
    5253
     
    103104}
    104105
     106static int device_get_handle(char *name, dev_handle_t *handle)
     107{
     108        int phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAP, DEVMAP_CLIENT, 0);
     109        if (phone < 0)
     110                return phone;
     111       
     112        ipc_call_t answer;
     113        aid_t req = async_send_2(phone, DEVMAP_DEVICE_GET_HANDLE, 0, 0,
     114            &answer);
     115       
     116        ipcarg_t retval = ipc_data_write_start(phone, name, strlen(name) + 1);
     117
     118        if (retval != EOK) {
     119                async_wait_for(req, NULL);
     120                ipc_hangup(phone);
     121                return retval;
     122        }
     123
     124        async_wait_for(req, &retval);
     125
     126        if (handle != NULL)
     127                *handle = -1;
     128       
     129        if (retval == EOK) {
     130                if (handle != NULL)
     131                        *handle = (dev_handle_t) IPC_GET_ARG1(answer);
     132        }
     133       
     134        ipc_hangup(phone);
     135        return retval;
     136}
     137
    105138int mount(const char *fs_name, const char *mp, const char *dev)
    106139{
     
    108141        ipcarg_t rc;
    109142        aid_t req;
    110 
    111         dev_handle_t dev_handle = 0;    /* TODO */
    112 
     143        dev_handle_t dev_handle;
     144       
     145        res = device_get_handle(dev, &dev_handle);
     146        if (res != EOK)
     147                return res;
     148       
    113149        size_t mpa_len;
    114150        char *mpa = absolutize(mp, &mpa_len);
Note: See TracChangeset for help on using the changeset viewer.