Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Determine where to splice to/from.

Proto:static long do_splice(struct file *in, loff_t __user *off_in, struct file *out, loff_t __user *off_out, size_t len, unsigned int flags)

Type:long

Parameter:

TypeParameterName
struct file *in
loff_t __user *off_in
struct file *out
loff_t __user *off_out
size_tlen
unsigned intflags
1121  ipipe = After the inode slimming patch, i_pipe/i_bdev/i_cdev share the same* location, so checking ->i_pipe is not enough to verify that this is a* pipe.
1122  opipe = After the inode slimming patch, i_pipe/i_bdev/i_cdev share the same* location, so checking ->i_pipe is not enough to verify that this is a* pipe.
1124  If ipipe && opipe Then
1125  If off_in || off_out Then Return -ESPIPE
1128  If Not (f_mode & le is open for reading ) Then Return -EBADF
1131  If Not (f_mode & le is open for writing ) Then Return -EBADF
1135  If ipipe == opipe Then Return -EINVAL
1138  If (f_flags | f_flags) & O_NONBLOCK Then flags |= don't block on the pipe splicing (but
1141  Return splice_pipe_to_pipe(ipipe, opipe, len, flags)
1144  If ipipe Then
1145  If off_in Then Return -ESPIPE
1147  If off_out Then
1148  If Not (f_mode & le can be accessed using pwrite ) Then Return -EINVAL
1150  If copy_from_user( & offset, off_out, sizeof(loff_t)) Then Return -EFAULT
1152  Else
1153  offset = f_pos
1156  If Value for the false possibility is greater at compile time(!(f_mode & le is open for writing )) Then Return -EBADF
1159  If Value for the false possibility is greater at compile time(f_flags & O_APPEND) Then Return -EINVAL
1162  ret = rw_verify_area(WRITE, out, & offset, len)
1163  If Value for the false possibility is greater at compile time(ret < 0) Then Return ret
1166  If f_flags & O_NONBLOCK Then flags |= don't block on the pipe splicing (but
1169  file_start_write(out)
1170  ret = Attempt to initiate a splice from pipe to file.
1171  file_end_write(out)
1173  If Not off_out Then f_pos = offset
1175  Else if copy_to_user(off_out, & offset, sizeof(loff_t)) Then ret = -EFAULT
1178  Return ret
1181  If opipe Then
1182  If off_out Then Return -ESPIPE
1184  If off_in Then
1185  If Not (f_mode & le can be accessed using pread ) Then Return -EINVAL
1187  If copy_from_user( & offset, off_in, sizeof(loff_t)) Then Return -EFAULT
1189  Else
1190  offset = f_pos
1193  If f_flags & O_NONBLOCK Then flags |= don't block on the pipe splicing (but
1196  pipe_lock(opipe)
1197  ret = wait_for_space(opipe, flags)
1198  If Not ret Then
1207  pipe_unlock(opipe)
1208  If ret > 0 Then wakeup_pipe_readers(opipe)
1210  If Not off_in Then f_pos = offset
1212  Else if copy_to_user(off_in, & offset, sizeof(loff_t)) Then ret = -EFAULT
1215  Return ret
1218  Return -EINVAL
Caller
NameDescribe
SYSCALL_DEFINE6