Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\relay.c Create Date:2022-07-28 11:47:39
Last Modify:2020-03-17 19:20:22 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:subbuf_splice_actor - splice up to one subbuf's worth of data

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

Type:ssize_t

Parameter:

TypeParameterName
struct file *in
loff_t *ppos
struct pipe_inode_info *pipe
size_tlen
unsigned intflags
int *nonpad_ret
1201  rbuf = needed for tty driver, and maybe others
1202  subbuf_size = sub-buffer size
1203  uint64_t pos = (uint64_t) * ppos
1204  alloc_size = total buffer size allocated
1205  read_start = do_div() is NOT a C function(pos, alloc_size)
1206  read_subbuf = read_start / subbuf_size
1207  padding = padding counts per sub-buffer [read_subbuf]
1208  nonpad_end = read_subbuf * subbuf_size + subbuf_size - padding
1211  struct splice_pipe_desc spd = {page map = pages, umber of populated pages in map = 0, pages[] & partial[] arrays size = PIPE_DEF_BUFFERS, pages[] may not be contig = partial, ps associated with output pipe = & relay_pipe_buf_ops, spd_release = relay_page_release, }
1221  If count of sub-buffers produced == count of sub-buffers consumed Then Return 0
1223  If r dynamic pipe sizing Then Return -ENOMEM
1229  If len > subbuf_size - read_start % subbuf_size Then len = subbuf_size - read_start % subbuf_size
1232  subbuf_pages = total buffer size allocated >> PAGE_SHIFT determines the page size
1233  pidx = read_start / PAGE_SIZE % subbuf_pages
1234  poff = read_start & ~PAGE_MASK
1235  nr_pages = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(unsignedint, subbuf_pages, pages[] & partial[] arrays size )
1237  When umber of populated pages in map < nr_pages cycle
1239  cur_pos = read_start + total_len
1241  If Not len Then Break
1244  this_len = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(unsignedlong, len, PAGE_SIZE - poff)
1245  private = this_len
1247  page map [umber of populated pages in map ] = array of current buffer pages [pidx]
1248  offset = poff
1250  this_end = cur_pos + this_len
1251  If this_end >= nonpad_end Then
1253  private = this_len + padding
1255  len = this_len
1256  private = private
1258  len -= this_len
1259  total_len += this_len
1260  poff = 0
1261  pidx = (pidx + 1) % subbuf_pages
1263  If this_end >= nonpad_end Then
1265  Break
1269  ret = 0
1270  If Not umber of populated pages in map Then Go to out
1273  ret = nonpad_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
1274  If ret < 0 || ret < total_len Then Go to out
1277  If read_start + ret == nonpad_end Then ret += padding
1280  out :
1281  splice_shrink_spd( & spd)
1282  Return ret
Caller
NameDescribe
relay_file_splice_read