Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:relay_file_read

Proto:static ssize_t relay_file_read(struct file *filp, char __user *buffer, size_t count, loff_t *ppos)

Type:ssize_t

Parameter:

TypeParameterName
struct file *filp
char __user *buffer
size_tcount
loff_t *ppos
1122  buf = needed for tty driver, and maybe others
1124  written = 0
1127  If Not count Then Return 0
1130  inode_lock(file_inode(filp))
1131  Do
1134  If Not lay_file_read_avail - boolean, are there unconsumed bytes available? Then Break
1137  read_start = lay_file_read_start_pos - find the first available byte to read*@read_pos: file read position*@buf: relay channel buffer* If the @read_pos is in the middle of padding, return the* position of the first actually available byte, otherwise
1138  avail = lay_file_read_subbuf_avail - return bytes available in sub-buffer*@read_pos: file read position*@buf: relay channel buffer
1139  If Not avail Then Break
1142  avail = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(count, avail)
1143  from = start of channel buffer + read_start
1144  ret = avail
1145  If copy_to_user(buffer, from, avail) Then Break
1148  buffer += ret
1149  written += ret
1150  count -= ret
1152  lay_file_read_consume - update the consumed count for the buffer
1153  ppos = lay_file_read_end_pos - return the new read position*@read_pos: file read position*@buf: relay channel buffer*@count: number of bytes to be read
1154  When count cycle
1155  inode_unlock(file_inode(filp))
1157  Return written