Ignore:
File:
1 edited

Legend:

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

    rc69646f8 r27b76ca  
    5454
    5555/* Forward declarations of static functions. */
    56 static int vfs_truncate_internal(fs_handle_t, service_id_t, fs_index_t,
     56static int vfs_truncate_internal(fs_handle_t, devmap_handle_t, fs_index_t,
    5757    aoff64_t);
    5858
     
    6565vfs_pair_t rootfs = {
    6666        .fs_handle = 0,
    67         .service_id = 0
     67        .devmap_handle = 0
    6868};
    6969
    70 static void vfs_mount_internal(ipc_callid_t rid, service_id_t service_id,
     70static void vfs_mount_internal(ipc_callid_t rid, devmap_handle_t devmap_handle,
    7171    fs_handle_t fs_handle, char *mp, char *opts)
    7272{
     
    125125                        exch = vfs_exchange_grab(fs_handle);
    126126                        msg = async_send_1(exch, VFS_OUT_MOUNTED,
    127                             (sysarg_t) service_id, &answer);
     127                            (sysarg_t) devmap_handle, &answer);
    128128                        /* Send the mount options */
    129129                        rc = async_data_write_start(exch, (void *)opts,
     
    150150                       
    151151                        mr_res.triplet.fs_handle = fs_handle;
    152                         mr_res.triplet.service_id = service_id;
     152                        mr_res.triplet.devmap_handle = devmap_handle;
    153153                        mr_res.triplet.index = rindex;
    154154                        mr_res.size = rsize;
     
    157157                       
    158158                        rootfs.fs_handle = fs_handle;
    159                         rootfs.service_id = service_id;
     159                        rootfs.devmap_handle = devmap_handle;
    160160                       
    161161                        /* Add reference to the mounted root. */
     
    178178       
    179179        /*
    180          * At this point, we have all necessary pieces: file system handle
    181          * and service ID, and we know the mount point VFS node.
     180         * At this point, we have all necessary pieces: file system and device
     181         * handles, and we know the mount point VFS node.
    182182         */
    183183       
     
    187187        exch = vfs_exchange_grab(mp_res.triplet.fs_handle);
    188188        msg = async_send_4(exch, VFS_OUT_MOUNT,
    189             (sysarg_t) mp_res.triplet.service_id,
     189            (sysarg_t) mp_res.triplet.devmap_handle,
    190190            (sysarg_t) mp_res.triplet.index,
    191191            (sysarg_t) fs_handle,
    192             (sysarg_t) service_id, &answer);
     192            (sysarg_t) devmap_handle, &answer);
    193193       
    194194        /* Send connection */
     
    224224        }
    225225       
    226         /*
    227          * Wait for the answer before releasing the exchange to avoid deadlock
    228          * in case the answer depends on further calls to the same file system.
    229          * Think of a case when mounting a FS on a file_bd backed by a file on
    230          * the same FS.
    231          */
     226        vfs_exchange_release(exch);
    232227        async_wait_for(msg, &rc);
    233         vfs_exchange_release(exch);
    234228       
    235229        if (rc == EOK) {
     
    240234               
    241235                mr_res.triplet.fs_handle = fs_handle;
    242                 mr_res.triplet.service_id = service_id;
     236                mr_res.triplet.devmap_handle = devmap_handle;
    243237                mr_res.triplet.index = rindex;
    244238                mr_res.size = rsize;
     
    261255void vfs_mount(ipc_callid_t rid, ipc_call_t *request)
    262256{
    263         service_id_t service_id;
     257        devmap_handle_t devmap_handle;
    264258
    265259        /*
     
    268262         * in the request.
    269263         */
    270         service_id = (service_id_t) IPC_GET_ARG1(*request);
     264        devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
    271265       
    272266        /*
     
    356350       
    357351        /* Do the mount */
    358         vfs_mount_internal(rid, service_id, fs_handle, mp, opts);
     352        vfs_mount_internal(rid, devmap_handle, fs_handle, mp, opts);
    359353        free(mp);
    360354        free(fs_name);
     
    415409         */
    416410        if (vfs_nodes_refcount_sum_get(mr_node->fs_handle,
    417             mr_node->service_id) != 2) {
     411            mr_node->devmap_handle) != 2) {
    418412                fibril_rwlock_write_unlock(&namespace_rwlock);
    419413                vfs_node_put(mr_node);
     
    436430                exch = vfs_exchange_grab(mr_node->fs_handle);
    437431                rc = async_req_1_0(exch, VFS_OUT_UNMOUNTED,
    438                     mr_node->service_id);
     432                    mr_node->devmap_handle);
    439433                vfs_exchange_release(exch);
    440434               
     
    447441               
    448442                rootfs.fs_handle = 0;
    449                 rootfs.service_id = 0;
     443                rootfs.devmap_handle = 0;
    450444        } else {
    451445               
     
    476470                exch = vfs_exchange_grab(mp_node->fs_handle);
    477471                rc = async_req_2_0(exch, VFS_OUT_UNMOUNT,
    478                     mp_node->service_id, mp_node->index);
     472                    mp_node->devmap_handle, mp_node->index);
    479473                vfs_exchange_release(exch);
    480474               
     
    581575                if (node->size) {
    582576                        rc = vfs_truncate_internal(node->fs_handle,
    583                             node->service_id, node->index, 0);
     577                            node->devmap_handle, node->index, 0);
    584578                        if (rc) {
    585579                                fibril_rwlock_write_unlock(&node->contents_rwlock);
     
    645639        aid_t msg;
    646640        ipc_call_t answer;
    647         msg = async_send_2(fs_exch, VFS_OUT_SYNC, file->node->service_id,
     641        msg = async_send_2(fs_exch, VFS_OUT_SYNC, file->node->devmap_handle,
    648642            file->node->index, &answer);
    649643       
     
    730724        if (read) {
    731725                rc = async_data_read_forward_4_1(fs_exch, VFS_OUT_READ,
    732                     file->node->service_id, file->node->index,
     726                    file->node->devmap_handle, file->node->index,
    733727                    LOWER32(file->pos), UPPER32(file->pos), &answer);
    734728        } else {
     
    737731               
    738732                rc = async_data_write_forward_4_1(fs_exch, VFS_OUT_WRITE,
    739                     file->node->service_id, file->node->index,
     733                    file->node->devmap_handle, file->node->index,
    740734                    LOWER32(file->pos), UPPER32(file->pos), &answer);
    741735        }
     
    868862}
    869863
    870 int vfs_truncate_internal(fs_handle_t fs_handle, service_id_t service_id,
     864int vfs_truncate_internal(fs_handle_t fs_handle, devmap_handle_t devmap_handle,
    871865    fs_index_t index, aoff64_t size)
    872866{
    873867        async_exch_t *exch = vfs_exchange_grab(fs_handle);
    874868        sysarg_t rc = async_req_4_0(exch, VFS_OUT_TRUNCATE,
    875             (sysarg_t) service_id, (sysarg_t) index, LOWER32(size),
     869            (sysarg_t) devmap_handle, (sysarg_t) index, LOWER32(size),
    876870            UPPER32(size));
    877871        vfs_exchange_release(exch);
     
    896890        fibril_rwlock_write_lock(&file->node->contents_rwlock);
    897891        rc = vfs_truncate_internal(file->node->fs_handle,
    898             file->node->service_id, file->node->index, size);
     892            file->node->devmap_handle, file->node->index, size);
    899893        if (rc == EOK)
    900894                file->node->size = size;
     
    930924       
    931925        aid_t msg;
    932         msg = async_send_3(exch, VFS_OUT_STAT, file->node->service_id,
     926        msg = async_send_3(exch, VFS_OUT_STAT, file->node->devmap_handle,
    933927            file->node->index, true, NULL);
    934928        async_forward_fast(callid, exch, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
     
    983977       
    984978        aid_t msg;
    985         msg = async_send_3(exch, VFS_OUT_STAT, node->service_id,
     979        msg = async_send_3(exch, VFS_OUT_STAT, node->devmap_handle,
    986980            node->index, false, NULL);
    987981        async_forward_fast(callid, exch, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
     
    11601154        /* Check whether linking to the same file system instance. */
    11611155        if ((old_node->fs_handle != new_par_lr.triplet.fs_handle) ||
    1162             (old_node->service_id != new_par_lr.triplet.service_id)) {
     1156            (old_node->devmap_handle != new_par_lr.triplet.devmap_handle)) {
    11631157                fibril_rwlock_write_unlock(&namespace_rwlock);
    11641158                vfs_node_put(old_node);
Note: See TracChangeset for help on using the changeset viewer.