Changes in uspace/srv/vfs/vfs_ops.c [27b76ca:c69646f8] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_ops.c
r27b76ca rc69646f8 54 54 55 55 /* Forward declarations of static functions. */ 56 static int vfs_truncate_internal(fs_handle_t, devmap_handle_t, fs_index_t,56 static int vfs_truncate_internal(fs_handle_t, service_id_t, fs_index_t, 57 57 aoff64_t); 58 58 … … 65 65 vfs_pair_t rootfs = { 66 66 .fs_handle = 0, 67 . devmap_handle= 067 .service_id = 0 68 68 }; 69 69 70 static void vfs_mount_internal(ipc_callid_t rid, devmap_handle_t devmap_handle,70 static void vfs_mount_internal(ipc_callid_t rid, service_id_t service_id, 71 71 fs_handle_t fs_handle, char *mp, char *opts) 72 72 { … … 125 125 exch = vfs_exchange_grab(fs_handle); 126 126 msg = async_send_1(exch, VFS_OUT_MOUNTED, 127 (sysarg_t) devmap_handle, &answer);127 (sysarg_t) service_id, &answer); 128 128 /* Send the mount options */ 129 129 rc = async_data_write_start(exch, (void *)opts, … … 150 150 151 151 mr_res.triplet.fs_handle = fs_handle; 152 mr_res.triplet. devmap_handle = devmap_handle;152 mr_res.triplet.service_id = service_id; 153 153 mr_res.triplet.index = rindex; 154 154 mr_res.size = rsize; … … 157 157 158 158 rootfs.fs_handle = fs_handle; 159 rootfs. devmap_handle = devmap_handle;159 rootfs.service_id = service_id; 160 160 161 161 /* Add reference to the mounted root. */ … … 178 178 179 179 /* 180 * At this point, we have all necessary pieces: file system and device181 * handles, and we know the mount point VFS node.180 * At this point, we have all necessary pieces: file system handle 181 * and service ID, and we know the mount point VFS node. 182 182 */ 183 183 … … 187 187 exch = vfs_exchange_grab(mp_res.triplet.fs_handle); 188 188 msg = async_send_4(exch, VFS_OUT_MOUNT, 189 (sysarg_t) mp_res.triplet. devmap_handle,189 (sysarg_t) mp_res.triplet.service_id, 190 190 (sysarg_t) mp_res.triplet.index, 191 191 (sysarg_t) fs_handle, 192 (sysarg_t) devmap_handle, &answer);192 (sysarg_t) service_id, &answer); 193 193 194 194 /* Send connection */ … … 224 224 } 225 225 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 */ 232 async_wait_for(msg, &rc); 226 233 vfs_exchange_release(exch); 227 async_wait_for(msg, &rc);228 234 229 235 if (rc == EOK) { … … 234 240 235 241 mr_res.triplet.fs_handle = fs_handle; 236 mr_res.triplet. devmap_handle = devmap_handle;242 mr_res.triplet.service_id = service_id; 237 243 mr_res.triplet.index = rindex; 238 244 mr_res.size = rsize; … … 255 261 void vfs_mount(ipc_callid_t rid, ipc_call_t *request) 256 262 { 257 devmap_handle_t devmap_handle;263 service_id_t service_id; 258 264 259 265 /* … … 262 268 * in the request. 263 269 */ 264 devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);270 service_id = (service_id_t) IPC_GET_ARG1(*request); 265 271 266 272 /* … … 350 356 351 357 /* Do the mount */ 352 vfs_mount_internal(rid, devmap_handle, fs_handle, mp, opts);358 vfs_mount_internal(rid, service_id, fs_handle, mp, opts); 353 359 free(mp); 354 360 free(fs_name); … … 409 415 */ 410 416 if (vfs_nodes_refcount_sum_get(mr_node->fs_handle, 411 mr_node-> devmap_handle) != 2) {417 mr_node->service_id) != 2) { 412 418 fibril_rwlock_write_unlock(&namespace_rwlock); 413 419 vfs_node_put(mr_node); … … 430 436 exch = vfs_exchange_grab(mr_node->fs_handle); 431 437 rc = async_req_1_0(exch, VFS_OUT_UNMOUNTED, 432 mr_node-> devmap_handle);438 mr_node->service_id); 433 439 vfs_exchange_release(exch); 434 440 … … 441 447 442 448 rootfs.fs_handle = 0; 443 rootfs. devmap_handle= 0;449 rootfs.service_id = 0; 444 450 } else { 445 451 … … 470 476 exch = vfs_exchange_grab(mp_node->fs_handle); 471 477 rc = async_req_2_0(exch, VFS_OUT_UNMOUNT, 472 mp_node-> devmap_handle, mp_node->index);478 mp_node->service_id, mp_node->index); 473 479 vfs_exchange_release(exch); 474 480 … … 575 581 if (node->size) { 576 582 rc = vfs_truncate_internal(node->fs_handle, 577 node-> devmap_handle, node->index, 0);583 node->service_id, node->index, 0); 578 584 if (rc) { 579 585 fibril_rwlock_write_unlock(&node->contents_rwlock); … … 639 645 aid_t msg; 640 646 ipc_call_t answer; 641 msg = async_send_2(fs_exch, VFS_OUT_SYNC, file->node-> devmap_handle,647 msg = async_send_2(fs_exch, VFS_OUT_SYNC, file->node->service_id, 642 648 file->node->index, &answer); 643 649 … … 724 730 if (read) { 725 731 rc = async_data_read_forward_4_1(fs_exch, VFS_OUT_READ, 726 file->node-> devmap_handle, file->node->index,732 file->node->service_id, file->node->index, 727 733 LOWER32(file->pos), UPPER32(file->pos), &answer); 728 734 } else { … … 731 737 732 738 rc = async_data_write_forward_4_1(fs_exch, VFS_OUT_WRITE, 733 file->node-> devmap_handle, file->node->index,739 file->node->service_id, file->node->index, 734 740 LOWER32(file->pos), UPPER32(file->pos), &answer); 735 741 } … … 862 868 } 863 869 864 int vfs_truncate_internal(fs_handle_t fs_handle, devmap_handle_t devmap_handle,870 int vfs_truncate_internal(fs_handle_t fs_handle, service_id_t service_id, 865 871 fs_index_t index, aoff64_t size) 866 872 { 867 873 async_exch_t *exch = vfs_exchange_grab(fs_handle); 868 874 sysarg_t rc = async_req_4_0(exch, VFS_OUT_TRUNCATE, 869 (sysarg_t) devmap_handle, (sysarg_t) index, LOWER32(size),875 (sysarg_t) service_id, (sysarg_t) index, LOWER32(size), 870 876 UPPER32(size)); 871 877 vfs_exchange_release(exch); … … 890 896 fibril_rwlock_write_lock(&file->node->contents_rwlock); 891 897 rc = vfs_truncate_internal(file->node->fs_handle, 892 file->node-> devmap_handle, file->node->index, size);898 file->node->service_id, file->node->index, size); 893 899 if (rc == EOK) 894 900 file->node->size = size; … … 924 930 925 931 aid_t msg; 926 msg = async_send_3(exch, VFS_OUT_STAT, file->node-> devmap_handle,932 msg = async_send_3(exch, VFS_OUT_STAT, file->node->service_id, 927 933 file->node->index, true, NULL); 928 934 async_forward_fast(callid, exch, 0, 0, 0, IPC_FF_ROUTE_FROM_ME); … … 977 983 978 984 aid_t msg; 979 msg = async_send_3(exch, VFS_OUT_STAT, node-> devmap_handle,985 msg = async_send_3(exch, VFS_OUT_STAT, node->service_id, 980 986 node->index, false, NULL); 981 987 async_forward_fast(callid, exch, 0, 0, 0, IPC_FF_ROUTE_FROM_ME); … … 1154 1160 /* Check whether linking to the same file system instance. */ 1155 1161 if ((old_node->fs_handle != new_par_lr.triplet.fs_handle) || 1156 (old_node-> devmap_handle != new_par_lr.triplet.devmap_handle)) {1162 (old_node->service_id != new_par_lr.triplet.service_id)) { 1157 1163 fibril_rwlock_write_unlock(&namespace_rwlock); 1158 1164 vfs_node_put(old_node);
Note:
See TracChangeset
for help on using the changeset viewer.