Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:lay_file_read_subbuf_avail - return bytes available in sub-buffer*@read_pos: file read position*@buf: relay channel buffer

Proto:static size_t relay_file_read_subbuf_avail(size_t read_pos, struct rchan_buf *buf)

Type:size_t

Parameter:

TypeParameterName
size_tread_pos
struct rchan_buf *buf
1041  avail = 0
1043  subbuf_size = sub-buffer size
1045  write_subbuf = (start of current sub-buffer - start of channel buffer ) / subbuf_size
1046  write_offset = If current offset into sub-buffer > subbuf_size Then subbuf_size Else current offset into sub-buffer
1047  read_subbuf = read_pos / subbuf_size
1048  read_offset = read_pos % subbuf_size
1049  padding = padding counts per sub-buffer [read_subbuf]
1051  If read_subbuf == write_subbuf Then
1052  If read_offset + padding < write_offset Then avail = write_offset - read_offset + padding
1054  Else avail = subbuf_size - padding - read_offset
1057  Return avail
Caller
NameDescribe
relay_file_read