Changeset 51774cd in mainline
- Timestamp:
- 2017-04-04T21:31:40Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2166728
- Parents:
- 59f388a
- Location:
- uspace
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/ipc/vfs.h
r59f388a r51774cd 41 41 42 42 #define FS_NAME_MAXLEN 20 43 #define MAX_PATH_LEN ( 64* 1024)43 #define MAX_PATH_LEN (32 * 1024) 44 44 #define MAX_MNTOPTS_LEN 256 45 45 #define PLB_SIZE (2 * MAX_PATH_LEN) … … 84 84 VFS_OUT_CLOSE = IPC_FIRST_USER_METHOD, 85 85 VFS_OUT_DESTROY, 86 VFS_OUT_GET_SIZE,87 86 VFS_OUT_IS_EMPTY, 88 87 VFS_OUT_LINK, -
uspace/lib/fs/libfs.c
r59f388a r51774cd 231 231 } 232 232 233 static void vfs_out_get_size(ipc_callid_t rid, ipc_call_t *req)234 {235 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req);236 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*req);237 int rc;238 239 fs_node_t *node = NULL;240 rc = libfs_ops->node_get(&node, service_id, index);241 if (rc != EOK)242 async_answer_0(rid, rc);243 if (node == NULL)244 async_answer_0(rid, EINVAL);245 246 uint64_t size = libfs_ops->size_get(node);247 libfs_ops->node_put(node);248 249 async_answer_2(rid, EOK, LOWER32(size), UPPER32(size));250 }251 252 233 static void vfs_out_is_empty(ipc_callid_t rid, ipc_call_t *req) 253 234 { … … 330 311 vfs_out_statfs(callid, &call); 331 312 break; 332 case VFS_OUT_GET_SIZE:333 vfs_out_get_size(callid, &call);334 break;335 313 case VFS_OUT_IS_EMPTY: 336 314 vfs_out_is_empty(callid, &call); … … 651 629 rc = ops->unlink(par, cur, component); 652 630 if (rc == EOK) { 653 int64_t size = ops->size_get(cur); 654 int32_t lsize = LOWER32(size); 655 if (lsize != size) 656 lsize = -1; 657 631 aoff64_t size = ops->size_get(cur); 658 632 async_answer_5(rid, fs_handle, service_id, 659 ops->index_get(cur), last, lsize, 660 ops->is_directory(cur)); 633 ops->index_get(cur), 634 (ops->is_directory(cur) << 16) | last, 635 LOWER32(size), UPPER32(size)); 661 636 } else { 662 637 async_answer_0(rid, rc); … … 703 678 } 704 679 705 int64_t size = ops->size_get(cur); 706 int32_t lsize = LOWER32(size); 707 if (lsize != size) 708 lsize = -1; 709 710 async_answer_5(rid, fs_handle, service_id, ops->index_get(cur), last, 711 lsize, ops->is_directory(cur)); 680 aoff64_t size = ops->size_get(cur); 681 async_answer_5(rid, fs_handle, service_id, ops->index_get(cur), 682 (ops->is_directory(cur) << 16) | last, LOWER32(size), 683 UPPER32(size)); 712 684 713 685 out: -
uspace/srv/vfs/vfs.h
r59f388a r51774cd 113 113 vfs_node_type_t type; /**< Partial info about the node type. */ 114 114 115 int64_t size; /**< Cached size if the node is a file. */115 aoff64_t size; /**< Cached size if the node is a file. */ 116 116 117 117 /** … … 185 185 extern unsigned vfs_nodes_refcount_sum_get(fs_handle_t, service_id_t); 186 186 187 extern int64_t vfs_node_get_size(vfs_node_t *node);188 187 extern bool vfs_node_has_children(vfs_node_t *node); 189 188 -
uspace/srv/vfs/vfs_lookup.c
r59f388a r51774cd 226 226 227 227 unsigned last = *pfirst + *plen; 228 *pfirst = IPC_GET_ARG3(answer) ;228 *pfirst = IPC_GET_ARG3(answer) & 0xffff; 229 229 *plen = last - *pfirst; 230 230 … … 232 232 result->triplet.service_id = (service_id_t) IPC_GET_ARG1(answer); 233 233 result->triplet.index = (fs_index_t) IPC_GET_ARG2(answer); 234 result->size = (int64_t)(int32_t) IPC_GET_ARG4(answer);235 result->type = IPC_GET_ARG5(answer) ?234 result->size = MERGE_LOUP32(IPC_GET_ARG4(answer), IPC_GET_ARG5(answer)); 235 result->type = (IPC_GET_ARG3(answer) >> 16) ? 236 236 VFS_NODE_DIRECTORY : VFS_NODE_FILE; 237 237 return EOK; -
uspace/srv/vfs/vfs_node.c
r59f388a r51774cd 315 315 } 316 316 317 int64_t vfs_node_get_size(vfs_node_t *node)318 {319 if (node->size == -1) {320 sysarg_t sz1 = 0;321 sysarg_t sz2 = 0;322 323 async_exch_t *exch = vfs_exchange_grab(node->fs_handle);324 (void) async_req_2_2(exch, VFS_OUT_GET_SIZE, node->service_id,325 node->index, &sz1, &sz2);326 vfs_exchange_release(exch);327 328 node->size = MERGE_LOUP32(sz1, sz2);329 }330 return node->size;331 }332 333 317 bool vfs_node_has_children(vfs_node_t *node) 334 318 { -
uspace/srv/vfs/vfs_ops.c
r59f388a r51774cd 439 439 async_exch_t *fs_exch = vfs_exchange_grab(file->node->fs_handle); 440 440 441 if (!read && file->append) { 442 if (file->node->size == -1) 443 file->node->size = vfs_node_get_size(file->node); 441 if (!read && file->append) 444 442 pos = file->node->size; 445 }446 443 447 444 /*
Note:
See TracChangeset
for help on using the changeset viewer.