Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:default_file_splice_read

Proto:static ssize_t default_file_splice_read(struct file *in, loff_t *ppos, struct pipe_inode_info *pipe, size_t len, unsigned int flags)

Type:ssize_t

Parameter:

TypeParameterName
struct file *in
loff_t *ppos
struct pipe_inode_info *pipe
size_tlen
unsigned intflags
380  copied = 0
384  If pipe_full - Return true if the pipe is full*@head: The pipe ring head pointer*@tail: The pipe ring tail pointer*@limit: The maximum amount of slots available. Then Return -EAGAIN
391  offset = ppos & ~PAGE_MASK
393  iov_iter_pipe( & to, generic data direction definitions , pipe, len + offset)
395  res = iov_iter_get_pages_alloc( & to, & pages, len + offset, & base)
396  If res <= 0 Then Return -ENOMEM
399  nr_pages = DIV_ROUND_UP(res + base, PAGE_SIZE)
401  vec = __vec
402  If nr_pages > PIPE_DEF_BUFFERS Then
403  vec = kmalloc_array - allocate memory for an array.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
405  res = -ENOMEM
406  Go to out
410  mask = ring_size - 1
411  offset = offset
412  len -= offset
414  When i < nr_pages cycle
415  this_len = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(size_t, len, PAGE_SIZE - offset)
416  and that should *never* hold a userland pointer = page_address(pages[i]) + offset
417  iov_len = this_len
418  len -= this_len
419  offset = 0
422  res = kernel_readv(in, vec, nr_pages, * ppos)
423  If res > 0 Then
424  copied = res
425  ppos += res
428  If vec != __vec Then kfree(vec)
430  out :
431  When i < nr_pages cycle Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
433  kvfree() - Free memory.*@addr: Pointer to allocated memory.* kvfree frees memory allocated by any of vmalloc(), kmalloc() or kvmalloc().* It is slightly more efficient to use kfree() or vfree() if you are certain* that you know which one to use.
434  iov_iter_advance( & to, copied)
435  Return res