Changeset 415c7e0d in mainline for uspace/srv/vfs/vfs_ops.c
- Timestamp:
- 2009-06-28T21:41:13Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bfd247f
- Parents:
- 75160a6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_ops.c
r75160a6 r415c7e0d 964 964 void vfs_stat(ipc_callid_t rid, ipc_call_t *request) 965 965 { 966 size_t len; 967 ipc_callid_t callid; 968 969 if (!ipc_data_write_receive(&callid, &len)) { 970 ipc_answer_0(callid, EINVAL); 971 ipc_answer_0(rid, EINVAL); 972 return; 973 } 974 char *path = malloc(len + 1); 975 if (!path) { 976 ipc_answer_0(callid, ENOMEM); 977 ipc_answer_0(rid, ENOMEM); 978 return; 979 } 980 int rc; 981 if ((rc = ipc_data_write_finalize(callid, path, len))) { 982 ipc_answer_0(rid, rc); 983 free(path); 984 return; 985 } 986 path[len] = '\0'; 987 988 if (!ipc_data_read_receive(&callid, NULL)) { 989 free(path); 990 ipc_answer_0(callid, EINVAL); 991 ipc_answer_0(rid, EINVAL); 992 return; 993 } 994 995 vfs_lookup_res_t lr; 996 fibril_rwlock_read_lock(&namespace_rwlock); 997 rc = vfs_lookup_internal(path, L_NONE, &lr, NULL); 998 free(path); 999 if (rc != EOK) { 1000 fibril_rwlock_read_unlock(&namespace_rwlock); 1001 ipc_answer_0(callid, rc); 1002 ipc_answer_0(rid, rc); 1003 return; 1004 } 1005 vfs_node_t *node = vfs_node_get(&lr); 1006 if (!node) { 1007 fibril_rwlock_read_unlock(&namespace_rwlock); 1008 ipc_answer_0(callid, ENOMEM); 1009 ipc_answer_0(rid, ENOMEM); 1010 return; 1011 } 1012 1013 fibril_rwlock_read_unlock(&namespace_rwlock); 1014 1015 int fs_phone = vfs_grab_phone(node->fs_handle); 1016 aid_t msg; 1017 msg = async_send_3(fs_phone, VFS_OUT_STAT, node->dev_handle, 1018 node->index, false, NULL); 1019 ipc_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME); 1020 async_wait_for(msg, &rc); 1021 vfs_release_phone(fs_phone); 1022 1023 ipc_answer_0(rid, rc); 1024 1025 vfs_node_put(node); 966 1026 } 967 1027
Note:
See TracChangeset
for help on using the changeset viewer.