Changeset 42d08592 in mainline
- Timestamp:
- 2016-09-02T12:28:18Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e503517a
- Parents:
- 2a2fbc8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_ops.c
r2a2fbc8 r42d08592 734 734 } 735 735 736 static void vfs_rdwr(ipc_callid_t rid, ipc_call_t *request, bool read) 736 typedef sysarg_t (* rdwr_ipc_cb_t)(async_exch_t *, vfs_file_t *, ipc_call_t *, 737 bool, void *); 738 739 static sysarg_t rdwr_ipc_client(async_exch_t *exch, vfs_file_t *file, 740 ipc_call_t *answer, bool read, void *data) 741 { 742 /* 743 * Make a VFS_READ/VFS_WRITE request at the destination FS server 744 * and forward the IPC_M_DATA_READ/IPC_M_DATA_WRITE request to the 745 * destination FS server. The call will be routed as if sent by 746 * ourselves. Note that call arguments are immutable in this case so we 747 * don't have to bother. 748 */ 749 750 if (read) { 751 return async_data_read_forward_4_1(exch, VFS_OUT_READ, 752 file->node->service_id, file->node->index, 753 LOWER32(file->pos), UPPER32(file->pos), answer); 754 } else { 755 return async_data_write_forward_4_1(exch, VFS_OUT_WRITE, 756 file->node->service_id, file->node->index, 757 LOWER32(file->pos), UPPER32(file->pos), answer); 758 } 759 } 760 761 static void vfs_rdwr(ipc_callid_t rid, ipc_call_t *request, bool read, 762 rdwr_ipc_cb_t ipc_cb, void *ipc_cb_data) 737 763 { 738 764 /* … … 786 812 async_exch_t *fs_exch = vfs_exchange_grab(file->node->fs_handle); 787 813 788 /* 789 * Make a VFS_READ/VFS_WRITE request at the destination FS server 790 * and forward the IPC_M_DATA_READ/IPC_M_DATA_WRITE request to the 791 * destination FS server. The call will be routed as if sent by 792 * ourselves. Note that call arguments are immutable in this case so we 793 * don't have to bother. 794 */ 795 sysarg_t rc; 814 if (!read && file->append) 815 file->pos = file->node->size; 816 817 /* 818 * Handle communication with the endpoint FS. 819 */ 796 820 ipc_call_t answer; 797 if (read) { 798 rc = async_data_read_forward_4_1(fs_exch, VFS_OUT_READ, 799 file->node->service_id, file->node->index, 800 LOWER32(file->pos), UPPER32(file->pos), &answer); 801 } else { 802 if (file->append) 803 file->pos = file->node->size; 804 805 rc = async_data_write_forward_4_1(fs_exch, VFS_OUT_WRITE, 806 file->node->service_id, file->node->index, 807 LOWER32(file->pos), UPPER32(file->pos), &answer); 808 } 821 sysarg_t rc = ipc_cb(fs_exch, file, &answer, read, ipc_cb_data); 809 822 810 823 vfs_exchange_release(fs_exch); … … 842 855 void vfs_read(ipc_callid_t rid, ipc_call_t *request) 843 856 { 844 vfs_rdwr(rid, request, true );857 vfs_rdwr(rid, request, true, rdwr_ipc_client, NULL); 845 858 } 846 859 847 860 void vfs_write(ipc_callid_t rid, ipc_call_t *request) 848 861 { 849 vfs_rdwr(rid, request, false );862 vfs_rdwr(rid, request, false, rdwr_ipc_client, NULL); 850 863 } 851 864
Note:
See TracChangeset
for help on using the changeset viewer.