Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\printk\printk.c Create Date:2022-07-28 10:07:31
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:kmsg_dump_get_buffer - copy kmsg log lines*@dumper: registered kmsg dumper*@syslog: include the "<4>" prefixes*@buf: buffer to copy the line to*@size: maximum size of the buffer*@len: length of line placed into buffer* Start at the end of the kmsg buffer

Proto:bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog, char *buf, size_t size, size_t *len)

Type:bool

Parameter:

TypeParameterName
struct kmsg_dumper *dumper
boolsyslog
char *buf
size_tsize
size_t *len
3253  l = 0
3254  bool ret = false
3255  time = printk_time
3257  If Not active Then Go to out
3260  logbuf_lock_irqsave(flags)
3261  If cur_seq < dex and sequence number of the first record stored in the buffer Then
3263  cur_seq = dex and sequence number of the first record stored in the buffer
3264  private state of the kmsg iterator = log_first_idx
3268  If cur_seq >= next_seq Then
3269  logbuf_unlock_irqrestore(flags)
3270  Go to out
3274  seq = cur_seq
3275  idx = private state of the kmsg iterator
3276  When seq < next_seq cycle
3277  msg = get record by index; idx must point to valid msg
3279  l += msg_print_text(msg, true, time, NULL, 0)
3280  idx = get next record; idx must point to valid msg
3281  seq++
3285  seq = cur_seq
3286  idx = private state of the kmsg iterator
3287  When l >= size && seq < next_seq cycle
3288  msg = get record by index; idx must point to valid msg
3290  l -= msg_print_text(msg, true, time, NULL, 0)
3291  idx = get next record; idx must point to valid msg
3292  seq++
3296  next_seq = seq
3297  next_idx = idx
3299  l = 0
3300  When seq < next_seq cycle
3301  msg = get record by index; idx must point to valid msg
3303  l += msg_print_text(msg, syslog, time, buf + l, size - l)
3304  idx = get next record; idx must point to valid msg
3305  seq++
3308  next_seq = next_seq
3309  next_idx = next_idx
3310  ret = true
3311  logbuf_unlock_irqrestore(flags)
3312  out :
3313  If len Then len = l
3315  Return ret