Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\filemap.c Create Date:2022-07-28 14:03:04
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Performs necessary checks before doing a clone.* Can adjust amount of bytes to clone via @req_count argument.* Returns appropriate error code that caller should return or* zero in case the clone should be allowed.

Proto:int generic_remap_checks(struct file *file_in, loff_t pos_in, struct file *file_out, loff_t pos_out, loff_t *req_count, unsigned int remap_flags)

Type:int

Parameter:

TypeParameterName
struct file *file_in
loff_tpos_in
struct file *file_out
loff_tpos_out
loff_t *req_count
unsigned intremap_flags
2979  inode_in = host
2980  inode_out = host
2981  count = req_count
2984  bs = s_blocksize
2988  If Not IS_ALIGNED(pos_in, bs) || Not IS_ALIGNED(pos_out, bs) Then Return -EINVAL
2992  If pos_in + count < pos_in || pos_out + count < pos_out Then Return -EINVAL
2995  size_in = NOTE: in a 32bit arch with a preemptable kernel and* an UP compile the i_size_read/write must be atomic* with respect to the local cpu (unlike with preempt disabled),* but they don't need to be atomic with respect to other cpus like in* true SMP (so they
2996  size_out = NOTE: in a 32bit arch with a preemptable kernel and* an UP compile the i_size_read/write must be atomic* with respect to the local cpu (unlike with preempt disabled),* but they don't need to be atomic with respect to other cpus like in* true SMP (so they
2999  If remap_flags & These flags control the behavior of the remap_file_range function pointer.* If it is called with len == 0 that means "remap to end of source file".* See Documentation/filesystems/vfs.rst for more details about this call. && ( pos_in >= size_in || pos_in + count > size_in || pos_out >= size_out || pos_out + count > size_out ) Then Return -EINVAL
3005  If pos_in >= size_in Then Return -EINVAL
3007  count = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(count, size_in - (uint64_t)pos_in)
3009  ret = Don't operate on ranges the page cache doesn't support, and don't exceed the* LFS limits. If pos is under the limit it becomes a short access. If it* exceeds the limit we return -EFBIG.
3010  If ret Then Return ret
3020  If pos_in + count == size_in Then
3021  bcount = @a is a power of 2 value (size_in, bs) - pos_in
3022  Else
3023  If Not IS_ALIGNED(count, bs) Then count = ALIGN_DOWN(count, bs)
3025  bcount = count
3029  If inode_in == inode_out && pos_out + bcount > pos_in && pos_out < pos_in + bcount Then Return -EINVAL
3038  If req_count != count && Not (remap_flags & REMAP_FILE_CAN_SHORTEN) Then Return -EINVAL
3041  req_count = count
3042  Return 0