Changeset 0ee4322 in mainline for uspace/srv/vfs/vfs_ops.c
- Timestamp:
- 2008-01-13T13:19:37Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d0dc74ae
- Parents:
- 4fb6bf36
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_ops.c
r4fb6bf36 r0ee4322 690 690 } 691 691 692 void vfs_truncate(ipc_callid_t rid, ipc_call_t *request) 693 { 694 int fd = IPC_GET_ARG1(*request); 695 size_t size = IPC_GET_ARG2(*request); 696 ipcarg_t rc; 697 698 vfs_file_t *file = vfs_file_get(fd); 699 if (!file) { 700 ipc_answer_0(rid, ENOENT); 701 return; 702 } 703 futex_down(&file->lock); 704 705 rwlock_write_lock(&file->node->contents_rwlock); 706 int fs_phone = vfs_grab_phone(file->node->fs_handle); 707 rc = async_req_3_0(fs_phone, VFS_TRUNCATE, (ipcarg_t)file->node->dev_handle, 708 (ipcarg_t)file->node->index, (ipcarg_t)size); 709 vfs_release_phone(fs_phone); 710 if (rc == EOK) 711 file->node->size = size; 712 rwlock_write_unlock(&file->node->contents_rwlock); 713 714 futex_up(&file->lock); 715 716 return rc; 717 } 718 692 719 atomic_t fs_head_futex = FUTEX_INITIALIZER; 693 720 link_t fs_head;
Note:
See TracChangeset
for help on using the changeset viewer.