Changeset 83937ccd in mainline for uspace/srv/vfs/vfs_ops.c


Ignore:
Timestamp:
2009-05-19T21:49:05Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
854c564
Parents:
27fd651
Message:

Rudimentary support for non-root mounts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs_ops.c

    r27fd651 r83937ccd  
    8585{
    8686        vfs_lookup_res_t mp_res;
     87        vfs_lookup_res_t mr_res;
    8788        vfs_node_t *mp_node = NULL;
     89        vfs_node_t *mr_node;
     90        fs_index_t rindex;
     91        size_t rsize;
     92        unsigned rlnkcnt;
    8893        ipcarg_t rc;
    8994        int phone;
    9095        aid_t msg;
    9196        ipc_call_t answer;
     97                       
    9298
    9399        /* Resolve the path to the mountpoint. */
     
    130136                /* We still don't have the root file system mounted. */
    131137                if (str_cmp(mp, "/") == 0) {
    132                         vfs_lookup_res_t mr_res;
    133                         vfs_node_t *mr_node;
    134                         fs_index_t rindex;
    135                         size_t rsize;
    136                         unsigned rlnkcnt;
    137                        
    138138                        /*
    139139                         * For this simple, but important case,
     
    202202         */
    203203       
     204        int mountee_phone = vfs_grab_phone(fs_handle);
     205        assert(mountee_phone >= 0);
     206        vfs_release_phone(mountee_phone);
     207
    204208        phone = vfs_grab_phone(mp_res.triplet.fs_handle);
    205209        msg = async_send_4(phone, VFS_MOUNT,
     
    208212            (ipcarg_t) fs_handle,
    209213            (ipcarg_t) dev_handle, &answer);
     214       
     215        /* send connection */
     216        rc = async_req_1_0(phone, IPC_M_CONNECTION_CLONE, mountee_phone);
     217        if (rc != EOK) {
     218                async_wait_for(msg, NULL);
     219                vfs_release_phone(phone);
     220                /* Mount failed, drop reference to mp_node. */
     221                if (mp_node)
     222                        vfs_node_put(mp_node);
     223                ipc_answer_0(rid, rc);
     224                return;
     225        }
     226       
    210227        /* send the mount options */
    211228        rc = ipc_data_write_start(phone, (void *)opts, str_size(opts));
     
    228245        }
    229246       
     247        rindex = (fs_index_t) IPC_GET_ARG1(answer);
     248        rsize = (size_t) IPC_GET_ARG2(answer);
     249        rlnkcnt = (unsigned) IPC_GET_ARG3(answer);
     250       
     251        mr_res.triplet.fs_handle = fs_handle;
     252        mr_res.triplet.dev_handle = dev_handle;
     253        mr_res.triplet.index = rindex;
     254        mr_res.size = rsize;
     255        mr_res.lnkcnt = rlnkcnt;
     256        mr_res.type = VFS_NODE_DIRECTORY;
     257       
     258        /* Add reference to the mounted root. */
     259        mr_node = vfs_node_get(&mr_res);
     260        assert(mr_node);
     261
    230262        ipc_answer_0(rid, rc);
    231263}
Note: See TracChangeset for help on using the changeset viewer.