Changeset b4cbef1 in mainline for uspace/srv/vfs/vfs_ops.c
- Timestamp:
- 2010-02-03T16:52:37Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3b3e776, eda925a
- Parents:
- 472c09d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_ops.c
r472c09d rb4cbef1 794 794 795 795 /* 796 * Now we need to receive a call with client's797 * IPC_M_DATA_READ/IPC_M_DATA_WRITE request.798 */799 ipc_callid_t callid;800 int res;801 if (read)802 res = async_data_read_receive(&callid, NULL);803 else804 res = async_data_write_receive(&callid, NULL);805 if (!res) {806 ipc_answer_0(callid, EINVAL);807 ipc_answer_0(rid, EINVAL);808 return;809 }810 811 /*812 796 * Lock the open file structure so that no other thread can manipulate 813 797 * the same open file at a time. … … 833 817 } 834 818 835 int fs_phone = vfs_grab_phone(file->node->fs_handle); 836 837 /* Make a VFS_READ/VFS_WRITE request at the destination FS server. */ 838 aid_t msg; 839 ipc_call_t answer; 840 if (!read && file->append) 841 file->pos = file->node->size; 842 msg = async_send_3(fs_phone, read ? VFS_OUT_READ : VFS_OUT_WRITE, 843 file->node->dev_handle, file->node->index, file->pos, &answer); 844 845 /* 846 * Forward the IPC_M_DATA_READ/IPC_M_DATA_WRITE request to the 819 int fs_phone = vfs_grab_phone(file->node->fs_handle); 820 821 /* 822 * Make a VFS_READ/VFS_WRITE request at the destination FS server 823 * and forward the IPC_M_DATA_READ/IPC_M_DATA_WRITE request to the 847 824 * destination FS server. The call will be routed as if sent by 848 825 * ourselves. Note that call arguments are immutable in this case so we 849 826 * don't have to bother. 850 827 */ 851 ipc_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);852 853 /* Wait for reply from the FS server. */854 828 ipcarg_t rc; 855 async_wait_for(msg, &rc); 829 ipc_call_t answer; 830 if (read) { 831 if (file->append) 832 file->pos = file->node->size; 833 834 rc = async_data_read_forward_3_1(fs_phone, VFS_OUT_READ, 835 file->node->dev_handle, file->node->index, file->pos, 836 &answer); 837 } else { 838 rc = async_data_forward_3_1(fs_phone, VFS_OUT_WRITE, 839 file->node->dev_handle, file->node->index, file->pos, 840 &answer); 841 } 856 842 857 843 vfs_release_phone(fs_phone); 858 844 859 845 size_t bytes = IPC_GET_ARG1(answer); 860 846 861 847 if (file->node->type == VFS_NODE_DIRECTORY) 862 848 fibril_rwlock_read_unlock(&namespace_rwlock);
Note:
See TracChangeset
for help on using the changeset viewer.