Changeset 852b801 in mainline for uspace/srv/vfs/vfs_ops.c
- Timestamp:
- 2009-06-28T18:59:02Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 75160a6
- Parents:
- 4198f9c3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_ops.c
r4198f9c3 r852b801 642 642 } 643 643 644 void vfs_node(ipc_callid_t rid, ipc_call_t *request)645 {646 int fd = IPC_GET_ARG1(*request);647 648 /* Lookup the file structure corresponding to the file descriptor. */649 vfs_file_t *file = vfs_file_get(fd);650 if (!file) {651 ipc_answer_0(rid, ENOENT);652 return;653 }654 655 ipc_answer_3(rid, EOK, file->node->fs_handle, file->node->dev_handle,656 file->node->index);657 }658 659 void vfs_device(ipc_callid_t rid, ipc_call_t *request)660 {661 int fd = IPC_GET_ARG1(*request);662 663 /* Lookup the file structure corresponding to the file descriptor. */664 vfs_file_t *file = vfs_file_get(fd);665 if (!file) {666 ipc_answer_0(rid, ENOENT);667 return;668 }669 670 /*671 * Lock the open file structure so that no other thread can manipulate672 * the same open file at a time.673 */674 fibril_mutex_lock(&file->lock);675 int fs_phone = vfs_grab_phone(file->node->fs_handle);676 677 /* Make a VFS_OUT_DEVICE request at the destination FS server. */678 aid_t msg;679 ipc_call_t answer;680 msg = async_send_2(fs_phone, VFS_OUT_DEVICE, file->node->dev_handle,681 file->node->index, &answer);682 683 /* Wait for reply from the FS server. */684 ipcarg_t rc;685 async_wait_for(msg, &rc);686 687 vfs_release_phone(fs_phone);688 fibril_mutex_unlock(&file->lock);689 690 ipc_answer_1(rid, EOK, IPC_GET_ARG1(answer));691 }692 693 644 void vfs_sync(ipc_callid_t rid, ipc_call_t *request) 694 645 { … … 975 926 fibril_mutex_unlock(&file->lock); 976 927 ipc_answer_0(rid, (ipcarg_t)rc); 928 } 929 930 void vfs_fstat(ipc_callid_t rid, ipc_call_t *request) 931 { 932 int fd = IPC_GET_ARG1(*request); 933 size_t size = IPC_GET_ARG2(*request); 934 ipcarg_t rc; 935 936 vfs_file_t *file = vfs_file_get(fd); 937 if (!file) { 938 ipc_answer_0(rid, ENOENT); 939 return; 940 } 941 942 ipc_callid_t callid; 943 if (!ipc_data_read_receive(&callid, NULL)) { 944 ipc_answer_0(callid, EINVAL); 945 ipc_answer_0(rid, EINVAL); 946 return; 947 } 948 949 fibril_mutex_lock(&file->lock); 950 951 int fs_phone = vfs_grab_phone(file->node->fs_handle); 952 953 aid_t msg; 954 msg = async_send_3(fs_phone, VFS_OUT_STAT, file->node->dev_handle, 955 file->node->index, true, NULL); 956 ipc_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME); 957 async_wait_for(msg, &rc); 958 vfs_release_phone(fs_phone); 959 960 fibril_mutex_unlock(&file->lock); 961 ipc_answer_0(rid, rc); 962 } 963 964 void vfs_stat(ipc_callid_t rid, ipc_call_t *request) 965 { 977 966 } 978 967
Note:
See TracChangeset
for help on using the changeset viewer.