Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\open.c Create Date:2022-07-28 20:00:51
Last Modify:2020-03-18 10:16:03 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:vfs_truncate

Proto:long vfs_truncate(const struct path *path, loff_t length)

Type:long

Parameter:

TypeParameterName
const struct path *path
loff_tlength
74  inode = d_inode
77  If S_ISDIR(i_mode) Then Return -EISDIR
79  If Not S_ISREG(i_mode) Then Return -EINVAL
82  error = mnt_want_write(mnt)
83  If error Then Go to out
86  error = inode_permission(inode, MAY_WRITE)
87  If error Then Go to mnt_drop_write_and_out
90  error = -EPERM
91  If IS_APPEND(inode) Then Go to mnt_drop_write_and_out
94  error = gets write permission for a file
95  If error Then Go to mnt_drop_write_and_out
102  error = break_lease(inode, O_WRONLY)
103  If error Then Go to put_write_and_out
106  error = locks_verify_truncate(inode, NULL, length)
107  If Not error Then error = security_path_truncate(path)
109  If Not error Then error = do_truncate(dentry, length, 0, NULL)
112  put_write_and_out :
113  releases this write permission
114  mnt_drop_write_and_out :
115  mnt_drop_write(mnt)
116  out :
117  Return error
Caller
NameDescribe
do_sys_truncate