Changeset 852b801 in mainline for uspace/srv/vfs
- Timestamp:
- 2009-06-28T18:59:02Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 75160a6
- Parents:
- 4198f9c3
- Location:
- uspace/srv/vfs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs.c
r4198f9c3 r852b801 108 108 vfs_truncate(callid, &call); 109 109 break; 110 case VFS_IN_FSTAT: 111 vfs_fstat(callid, &call); 112 break; 113 case VFS_IN_STAT: 114 vfs_stat(callid, &call); 115 break; 110 116 case VFS_IN_MKDIR: 111 117 vfs_mkdir(callid, &call); … … 117 123 vfs_rename(callid, &call); 118 124 break; 119 case VFS_IN_DEVICE:120 vfs_device(callid, &call);121 break;122 125 case VFS_IN_SYNC: 123 126 vfs_sync(callid, &call); 124 break;125 case VFS_IN_NODE:126 vfs_node(callid, &call);127 127 break; 128 128 default: -
uspace/srv/vfs/vfs.h
r4198f9c3 r852b801 199 199 extern void vfs_open(ipc_callid_t, ipc_call_t *); 200 200 extern void vfs_open_node(ipc_callid_t, ipc_call_t *); 201 extern void vfs_device(ipc_callid_t, ipc_call_t *);202 201 extern void vfs_sync(ipc_callid_t, ipc_call_t *); 203 extern void vfs_node(ipc_callid_t, ipc_call_t *);204 202 extern void vfs_close(ipc_callid_t, ipc_call_t *); 205 203 extern void vfs_read(ipc_callid_t, ipc_call_t *); … … 207 205 extern void vfs_seek(ipc_callid_t, ipc_call_t *); 208 206 extern void vfs_truncate(ipc_callid_t, ipc_call_t *); 207 extern void vfs_fstat(ipc_callid_t, ipc_call_t *); 208 extern void vfs_fstat(ipc_callid_t, ipc_call_t *); 209 extern void vfs_stat(ipc_callid_t, ipc_call_t *); 209 210 extern void vfs_mkdir(ipc_callid_t, ipc_call_t *); 210 211 extern void vfs_unlink(ipc_callid_t, ipc_call_t *); -
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.