Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:r_file_splice_write - splice data from a pipe to a file*@pipe: pipe info*@out: file to write to*@ppos: position in @out*@len: number of bytes to splice*@flags: splice modifier flags* Description:* Will either move or copy pages (determined by @flags

Proto:ssize_t iter_file_splice_write(struct pipe_inode_info *pipe, struct file *out, loff_t *ppos, size_t len, unsigned int flags)

Type:ssize_t

Parameter:

TypeParameterName
struct pipe_inode_info *pipe
struct file *out
loff_t *ppos
size_tlen
unsigned intflags
695  struct splice_desc sd = {maining length = len, splice flags = flags, le position = * ppos, le to read/write = out, }
701  nbufs = max_usage
702  array = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
706  If Value for the false possibility is greater at compile time(!array) Then Return -ENOMEM
709  pipe_lock(pipe)
711  splice_from_pipe_begin - start splicing from pipe*@sd: information about the splice operation* Description:* This function should be called before a loop containing* splice_from_pipe_next() and splice_from_pipe_feed() to
712  When maining length cycle
718  ret = splice_from_pipe_next - wait for some data to splice from*@pipe: pipe to splice from*@sd: information about the splice operation* Description:* This function will wait for some data and return a positive* value (one) if pipe buffers are available
719  If ret <= 0 Then Break
723  kfree(array)
724  nbufs = max_usage
727  If Not array Then
728  ret = -ENOMEM
729  Break
733  head = head
734  tail = tail
735  mask = ring_size - 1
738  left = maining length
740  buf = bufs[tail & mask]
741  this_len = len
743  If this_len > left Then this_len = left
748  If ret == -ENODATA Then ret = 0
750  Go to done
753  bv_page = page
754  bv_len = this_len
755  bv_offset = offset
756  left -= this_len
759  iov_iter_bvec( & from, WRITE, array, n, maining length - left)
760  ret = vfs_iter_write(out, & from, & le position , 0)
761  If ret <= 0 Then Break
764  umber of bytes already spliced += ret
765  maining length -= ret
766  ppos = le position
769  tail = tail
770  When ret cycle
771  buf = bufs[tail & mask]
772  If ret >= len Then
780  Else
781  offset += ret
782  len -= ret
783  ret = 0
787  done :
788  kfree(array)
789  splice_from_pipe_end - finish splicing from pipe*@pipe: pipe to splice from*@sd: information about the splice operation* Description:* This function will wake up pipe writers if necessary
791  pipe_unlock(pipe)
793  If umber of bytes already spliced Then ret = umber of bytes already spliced
796  Return ret