Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:lay_switch_subbuf - switch to a new sub-buffer*@buf: channel buffer*@length: size of current event* Returns either the length passed in or 0 if full.* Performs sub-buffer-switch tasks such as invoking callbacks,

Proto:size_t relay_switch_subbuf(struct rchan_buf *buf, size_t length)

Type:size_t

Parameter:

TypeParameterName
struct rchan_buf *buf
size_tlength
746  If Value for the false possibility is greater at compile time(length > sub-buffer size ) Then Go to toobig
749  If current offset into sub-buffer != sub-buffer size + 1 Then
750  mporary variable = sub-buffer size - current offset into sub-buffer
751  old_subbuf = count of sub-buffers produced % number of sub-buffers per buffer
752  padding counts per sub-buffer [old_subbuf] = mporary variable
753  count of sub-buffers produced ++
754  If channel file dentry Then i_size += sub-buffer size - padding counts per sub-buffer [old_subbuf]
758  Else ytes consumed before VFS inited += sub-buffer size - padding counts per sub-buffer [old_subbuf]
761  smp_mb()
773  old = start of current sub-buffer
774  new_subbuf = count of sub-buffers produced % number of sub-buffers per buffer
775  new = start of channel buffer + new_subbuf * sub-buffer size
776  current offset into sub-buffer = 0
777  If Not subbuf_start(buf, new, old, mporary variable ) Then
778  current offset into sub-buffer = sub-buffer size + 1
779  Return 0
781  start of current sub-buffer = new
782  padding counts per sub-buffer [new_subbuf] = 0
784  If Value for the false possibility is greater at compile time(length + current offset into sub-buffer > sub-buffer size ) Then Go to toobig
787  Return length
789  toobig :
790  tried to log event > subbuf size = length
791  Return 0
Caller
NameDescribe
relay_flushlay_flush - close the channel*@chan: the channel* Flushes all channel buffers, i.e. forces buffer switch.