Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:tracing_buffers_splice_read

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

Type:ssize_t

Parameter:

TypeParameterName
struct file *file
loff_t *ppos
struct pipe_inode_info *pipe
size_tlen
unsigned intflags
7499  info = needed for tty driver, and maybe others
7500  iter = iter
7503  struct splice_pipe_desc spd = {page map = pages_def, pages[] may not be contig = partial_def, pages[] & partial[] arrays size = PIPE_DEF_BUFFERS, ps associated with output pipe = & Pipe buffer operations for a buffer. , spd_release = Callback from splice_to_pipe(), if we need to release some pages* at the end of the spd in case we error'ed out in filling the pipe., }
7512  ret = 0
7519  If ppos & PAGE_SIZE - 1 Then Return -EINVAL
7522  If len & PAGE_SIZE - 1 Then
7523  If len < PAGE_SIZE Then Return -EINVAL
7525  len &= PAGE_MASK
7528  If r dynamic pipe sizing Then Return -ENOMEM
7531  again :
7532  trace_access_lock(cpu_file)
7533  entries = g_buffer_entries_cpu - get the number of entries in a cpu buffer*@buffer: The ring buffer*@cpu: The per CPU buffer to get the entries from.
7535  When i < pages[] & partial[] arrays size && len && entries cycle
7539  ref = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
7540  If Not ref Then
7541  ret = -ENOMEM
7542  Break
7545  _set - set a refcount's value*@r: the refcount*@n: value to which the refcount will be set
7546  buffer = buffer
7547  page = g_buffer_alloc_read_page - allocate a page to read from buffer*@buffer: the buffer to allocate for
7548  If IS_ERR(page) Then
7549  ret = PTR_ERR(page)
7550  page = NULL
7551  kfree(ref)
7552  Break
7554  cpu = cpu_file
7556  r = g_buffer_read_page - extract a page from the ring buffer*@buffer: buffer to extract from*@data_page: the page to use allocated from ring_buffer_alloc_read_page*@len: amount to extract*@cpu: the cpu of the buffer to extract
7558  If r < 0 Then
7561  kfree(ref)
7562  Break
7565  page = virt_to_page(kaddr) returns a valid pointer if and only if* virt_addr_valid(kaddr) returns true.(page)
7567  page map [i] = page
7568  len = PAGE_SIZE
7569  offset = 0
7570  private = ref
7571  umber of populated pages in map ++
7572  ppos += PAGE_SIZE
7574  entries = g_buffer_entries_cpu - get the number of entries in a cpu buffer*@buffer: The ring buffer*@cpu: The per CPU buffer to get the entries from.
7577  trace_access_unlock(cpu_file)
7578  umber of populated pages in map = i
7581  If Not umber of populated pages in map Then
7582  If ret Then Go to out
7585  ret = -EAGAIN
7586  If f_flags & O_NONBLOCK || flags & don't block on the pipe splicing (but Then Go to out
7589  ret = wait_on_pipe(iter, buffer_percent)
7590  If ret Then Go to out
7593  Go to again
7596  ret = splice_to_pipe - fill passed data into a pipe*@pipe: pipe to fill*@spd: data to fill* Description:*@spd contains a map of pages and len/offset tuples, along with* the struct pipe_buf_operations associated with these pages. This
7597  out :
7598  splice_shrink_spd( & spd)
7600  Return ret