Changes in uspace/srv/vfs/vfs_ops.c [b72efe8:27b76ca] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_ops.c
rb72efe8 r27b76ca 76 76 vfs_node_t *mr_node; 77 77 fs_index_t rindex; 78 size_t rsize;78 aoff64_t rsize; 79 79 unsigned rlnkcnt; 80 80 async_exch_t *exch; … … 146 146 147 147 rindex = (fs_index_t) IPC_GET_ARG1(answer); 148 rsize = ( size_t) IPC_GET_ARG2(answer);149 rlnkcnt = (unsigned) IPC_GET_ARG 3(answer);148 rsize = (aoff64_t) MERGE_LOUP32(IPC_GET_ARG2(answer), IPC_GET_ARG3(answer)); 149 rlnkcnt = (unsigned) IPC_GET_ARG4(answer); 150 150 151 151 mr_res.triplet.fs_handle = fs_handle; … … 229 229 if (rc == EOK) { 230 230 rindex = (fs_index_t) IPC_GET_ARG1(answer); 231 rsize = (size_t) IPC_GET_ARG2(answer); 232 rlnkcnt = (unsigned) IPC_GET_ARG3(answer); 231 rsize = (aoff64_t) MERGE_LOUP32(IPC_GET_ARG2(answer), 232 IPC_GET_ARG3(answer)); 233 rlnkcnt = (unsigned) IPC_GET_ARG4(answer); 233 234 234 235 mr_res.triplet.fs_handle = fs_handle; … … 617 618 } 618 619 619 void vfs_open_node(ipc_callid_t rid, ipc_call_t *request)620 {621 // FIXME: check for sanity of the supplied fs, dev and index622 623 /*624 * The interface is open_node(fs, dev, index, oflag).625 */626 vfs_lookup_res_t lr;627 628 lr.triplet.fs_handle = IPC_GET_ARG1(*request);629 lr.triplet.devmap_handle = IPC_GET_ARG2(*request);630 lr.triplet.index = IPC_GET_ARG3(*request);631 int oflag = IPC_GET_ARG4(*request);632 633 fibril_rwlock_read_lock(&namespace_rwlock);634 635 int rc = vfs_open_node_internal(&lr);636 if (rc != EOK) {637 fibril_rwlock_read_unlock(&namespace_rwlock);638 async_answer_0(rid, rc);639 return;640 }641 642 vfs_node_t *node = vfs_node_get(&lr);643 fibril_rwlock_read_unlock(&namespace_rwlock);644 645 /* Truncate the file if requested and if necessary. */646 if (oflag & O_TRUNC) {647 fibril_rwlock_write_lock(&node->contents_rwlock);648 if (node->size) {649 rc = vfs_truncate_internal(node->fs_handle,650 node->devmap_handle, node->index, 0);651 if (rc) {652 fibril_rwlock_write_unlock(&node->contents_rwlock);653 vfs_node_put(node);654 async_answer_0(rid, rc);655 return;656 }657 node->size = 0;658 }659 fibril_rwlock_write_unlock(&node->contents_rwlock);660 }661 662 /*663 * Get ourselves a file descriptor and the corresponding vfs_file_t664 * structure.665 */666 int fd = vfs_fd_alloc((oflag & O_DESC) != 0);667 if (fd < 0) {668 vfs_node_put(node);669 async_answer_0(rid, fd);670 return;671 }672 vfs_file_t *file = vfs_file_get(fd);673 file->node = node;674 if (oflag & O_APPEND)675 file->append = true;676 677 /*678 * The following increase in reference count is for the fact that the679 * file is being opened and that a file structure is pointing to it.680 * It is necessary so that the file will not disappear when681 * vfs_node_put() is called. The reference will be dropped by the682 * respective VFS_IN_CLOSE.683 */684 vfs_node_addref(node);685 vfs_node_put(node);686 vfs_file_put(file);687 688 /* Success! Return the new file descriptor to the client. */689 async_answer_1(rid, EOK, fd);690 }691 692 620 void vfs_sync(ipc_callid_t rid, ipc_call_t *request) 693 621 { … … 795 723 ipc_call_t answer; 796 724 if (read) { 797 rc = async_data_read_forward_ 3_1(fs_exch, VFS_OUT_READ,798 file->node->devmap_handle, file->node->index, file->pos,799 &answer);725 rc = async_data_read_forward_4_1(fs_exch, VFS_OUT_READ, 726 file->node->devmap_handle, file->node->index, 727 LOWER32(file->pos), UPPER32(file->pos), &answer); 800 728 } else { 801 729 if (file->append) 802 730 file->pos = file->node->size; 803 731 804 rc = async_data_write_forward_ 3_1(fs_exch, VFS_OUT_WRITE,805 file->node->devmap_handle, file->node->index, file->pos,806 &answer);732 rc = async_data_write_forward_4_1(fs_exch, VFS_OUT_WRITE, 733 file->node->devmap_handle, file->node->index, 734 LOWER32(file->pos), UPPER32(file->pos), &answer); 807 735 } 808 736 … … 821 749 /* Update the cached version of node's size. */ 822 750 if (rc == EOK) 823 file->node->size = IPC_GET_ARG2(answer); 751 file->node->size = MERGE_LOUP32(IPC_GET_ARG2(answer), 752 IPC_GET_ARG3(answer)); 824 753 fibril_rwlock_write_unlock(&file->node->contents_rwlock); 825 754 } … … 1347 1276 } 1348 1277 1278 void vfs_wait_handle(ipc_callid_t rid, ipc_call_t *request) 1279 { 1280 int fd = vfs_wait_handle_internal(); 1281 async_answer_1(rid, EOK, fd); 1282 } 1283 1349 1284 /** 1350 1285 * @}
Note:
See TracChangeset
for help on using the changeset viewer.