函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\splice.c Create Date:2022-07-29 10:42:10
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称: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

函数原型:ssize_t iter_file_splice_write(struct pipe_inode_info *pipe, struct file *out, loff_t *ppos, size_t len, unsigned int flags)

返回类型:ssize_t

参数:

类型参数名称
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等于分配数组内存并置零
706  如果此条件成立可能性小(为编译器优化)(!array)则返回:负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 maining length 循环
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  如果ret小于等于0则退出
723  释放内存
724  nbufs等于max_usage
727  如果非array
728  ret等于负ENOMEM
729  退出
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  如果this_len大于leftthis_len等于left
748  如果ret恒等于负ENODATAret等于0
750  转到: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  如果ret小于等于0则退出
764  umber of bytes already spliced 加等于ret
765  maining length 减等于ret
766  ppos等于le position
769  tail等于tail
770 ret循环
771  buf等于bufs[tail & mask]
772  如果ret大于等于len
780  否则
781  offset加等于ret
782  len减等于ret
783  ret等于0
787  done :
788  释放内存
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  如果umber of bytes already spliced ret等于umber of bytes already spliced
796  返回:ret