Changeset a737667e in mainline
- Timestamp:
- 2017-03-08T09:56:06Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5126f80
- Parents:
- bb9ec2d
- Location:
- uspace
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/vfs/vfs.c
rbb9ec2d ra737667e 1124 1124 int statfs(const char *path, struct statfs *st) 1125 1125 { 1126 sysarg_t rc, rc_orig; 1126 size_t pa_size; 1127 char *pa = vfs_absolutize(path, &pa_size); 1128 if (!pa) { 1129 errno = ENOMEM; 1130 return -1; 1131 } 1132 1133 int fd = _vfs_walk(-1, pa, 0); 1134 if (fd < 0) { 1135 free(pa); 1136 errno = fd; 1137 return -1; 1138 } 1139 1140 free(pa); 1141 1142 sysarg_t rc, ret; 1127 1143 aid_t req; 1128 size_t pa_size; 1129 1130 char *pa = vfs_absolutize(path, &pa_size); 1131 if (pa == NULL) { 1132 errno = ENOMEM; 1133 return -1; 1134 } 1135 1136 async_exch_t *exch = vfs_exchange_begin(); 1137 1138 req = async_send_0(exch, VFS_IN_STATFS, NULL); 1139 rc = async_data_write_start(exch, pa, pa_size); 1140 if (rc != EOK) 1141 goto exit; 1142 1144 1145 async_exch_t *exch = vfs_exchange_begin(); 1146 1147 req = async_send_1(exch, VFS_IN_STATFS, fd, NULL); 1143 1148 rc = async_data_read_start(exch, (void *) st, sizeof(*st)); 1144 1149 1145 exit: 1146 vfs_exchange_end(exch); 1147 free(pa); 1148 async_wait_for(req, &rc_orig); 1149 rc = (rc_orig != EOK ? rc_orig : rc); 1150 1150 vfs_exchange_end(exch); 1151 async_wait_for(req, &ret); 1152 close(fd); 1153 1154 rc = (ret != EOK ? ret : rc); 1151 1155 if (rc != EOK) { 1152 1156 errno = rc; -
uspace/srv/vfs/vfs_ops.c
rbb9ec2d ra737667e 1317 1317 void vfs_statfs(ipc_callid_t rid, ipc_call_t *request) 1318 1318 { 1319 char *path; 1320 int rc = async_data_write_accept((void **) &path, true, 0, 0, 0, NULL); 1321 if (rc != EOK) { 1322 async_answer_0(rid, rc); 1323 return; 1324 } 1319 int fd = IPC_GET_ARG1(*request); 1325 1320 1326 1321 ipc_callid_t callid; 1327 1322 if (!async_data_read_receive(&callid, NULL)) { 1328 free(path);1329 1323 async_answer_0(callid, EINVAL); 1330 1324 async_answer_0(rid, EINVAL); … … 1332 1326 } 1333 1327 1334 vfs_lookup_res_t lr; 1335 fibril_rwlock_read_lock(&namespace_rwlock); 1336 rc = vfs_lookup_internal(root, path, L_NONE, &lr); 1337 free(path); 1338 if (rc != EOK) { 1339 fibril_rwlock_read_unlock(&namespace_rwlock); 1340 async_answer_0(callid, rc); 1341 async_answer_0(rid, rc); 1342 return; 1343 } 1344 vfs_node_t *node = vfs_node_get(&lr); 1345 if (!node) { 1346 fibril_rwlock_read_unlock(&namespace_rwlock); 1347 async_answer_0(callid, ENOMEM); 1348 async_answer_0(rid, ENOMEM); 1349 return; 1350 } 1351 1352 fibril_rwlock_read_unlock(&namespace_rwlock); 1328 vfs_file_t *file = vfs_file_get(fd); 1329 if (!file) { 1330 async_answer_0(callid, EBADF); 1331 async_answer_0(rid, EBADF); 1332 } 1333 1334 vfs_node_t *node = file->node; 1353 1335 1354 1336 async_exch_t *exch = vfs_exchange_grab(node->fs_handle); … … 1364 1346 async_wait_for(msg, &rv); 1365 1347 1348 vfs_file_put(file); 1349 1366 1350 async_answer_0(rid, rv); 1367 1368 vfs_node_put(node);1369 1351 } 1370 1352
Note:
See TracChangeset
for help on using the changeset viewer.