Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:lay_file_read_avail - boolean, are there unconsumed bytes available?

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

Type:int

Parameter:

TypeParameterName
struct rchan_buf *buf
size_tread_pos
996  subbuf_size = sub-buffer size
997  n_subbufs = number of sub-buffers per buffer
998  produced = count of sub-buffers produced
999  consumed = count of sub-buffers consumed
1001  lay_file_read_consume - update the consumed count for the buffer
1003  consumed = count of sub-buffers consumed
1005  If Value for the false possibility is greater at compile time(current offset into sub-buffer > subbuf_size) Then
1006  If produced == consumed Then Return 0
1008  Return 1
1011  If Value for the false possibility is greater at compile time(produced - consumed >= n_subbufs) Then
1012  consumed = produced - n_subbufs + 1
1013  count of sub-buffers consumed = consumed
1014  ytes consumed in cur read subbuf = 0
1017  produced = produced % n_subbufs * subbuf_size + current offset into sub-buffer
1018  consumed = consumed % n_subbufs * subbuf_size + ytes consumed in cur read subbuf
1020  If consumed > produced Then produced += n_subbufs * subbuf_size
1023  If consumed == produced Then
1024  If current offset into sub-buffer == subbuf_size && count of sub-buffers produced > count of sub-buffers consumed Then Return 1
1027  Return 0
1030  Return 1
Caller
NameDescribe
relay_file_read