Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:vfs_fallocate

Proto:int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len)

Type:int

Parameter:

TypeParameterName
struct file *file
intmode
loff_toffset
loff_tlen
231  inode = file_inode(file)
234  If offset < 0 || len <= 0 Then Return -EINVAL
238  If mode & ~FALLOC_FL_SUPPORTED_MASK Then Return -EOPNOTSUPP
242  If (mode & (de-allocates range | FALLOC_FL_ZERO_RANGE is used to convert a range of file to zeros preferably* without issuing data IO)) == (de-allocates range | FALLOC_FL_ZERO_RANGE is used to convert a range of file to zeros preferably* without issuing data IO) Then Return -EOPNOTSUPP
247  If mode & de-allocates range && Not (mode & default is extend size ) Then Return -EOPNOTSUPP
252  If mode & FALLOC_FL_COLLAPSE_RANGE is used to remove a range of a file* without leaving a hole in the file. The contents of the file beyond* the range being removed is appended to the start offset of the range* being removed (i && mode & ~FALLOC_FL_COLLAPSE_RANGE is used to remove a range of a file* without leaving a hole in the file. The contents of the file beyond* the range being removed is appended to the start offset of the range* being removed (i Then Return -EINVAL
257  If mode & FALLOC_FL_INSERT_RANGE is use to insert space within the file size without* overwriting any existing data. The contents of the file beyond offset are* shifted towards right by len bytes to create a hole. As such, this && mode & ~FALLOC_FL_INSERT_RANGE is use to insert space within the file size without* overwriting any existing data. The contents of the file beyond offset are* shifted towards right by len bytes to create a hole. As such, this Then Return -EINVAL
262  If mode & FALLOC_FL_UNSHARE_RANGE is used to unshare shared blocks within the* file size without overwriting any existing data && mode & ~(FALLOC_FL_UNSHARE_RANGE is used to unshare shared blocks within the* file size without overwriting any existing data | default is extend size ) Then Return -EINVAL
266  If Not (f_mode & le is open for writing ) Then Return -EBADF
272  If mode & ~default is extend size && IS_APPEND(inode) Then Return -EPERM
275  If IS_IMMUTABLE(inode) Then Return -EPERM
281  If IS_SWAPFILE(inode) Then Return -ETXTBSY
288  ret = security_file_permission(file, MAY_WRITE)
289  If ret Then Return ret
292  If S_ISFIFO(i_mode) Then Return -ESPIPE
295  If S_ISDIR(i_mode) Then Return -EISDIR
298  If Not S_ISREG(i_mode) && Not S_ISBLK(i_mode) Then Return -ENODEV
302  If offset + len > s_maxbytes || offset + len < 0 Then Return -EFBIG
305  If Not fallocate Then Return -EOPNOTSUPP
308  file_start_write(file)
309  ret = fallocate(file, mode, offset, len)
318  If ret == 0 Then snotify_modify - file was modified
321  file_end_write(file)
322  Return ret
Caller
NameDescribe
ksys_fallocate
ioctl_preallocateThis provides compatibility with legacy XFS pre-allocation ioctls* which predate the fallocate syscall.* Only the l_start, l_len and l_whence fields of the 'struct space_resv'* are used here, rest are ignored.
compat_ioctl_preallocatejust account for different alignment