Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:traverse

Proto:static int traverse(struct seq_file *m, loff_t offset)

Type:int

Parameter:

TypeParameterName
struct seq_file *m
loff_toffset
93  pos = 0
94  error = 0
97  version = 0
98  index = 0
99  count = from = 0
100  If Not offset Then Return 0
103  If Not buf Then
104  buf = seq_buf_alloc(size = PAGE_SIZE)
105  If Not buf Then Return -ENOMEM
108  p = start(m, & index)
109  When p cycle
110  error = PTR_ERR(p)
111  If IS_ERR(p) Then Break
113  error = show(m, p)
114  If error < 0 Then Break
117  error = 0
118  count = 0
120  If seq_has_overflowed - check if the buffer has overflowed*@m: the seq_file handle* seq_files have a buffer which may overflow. When this happens a larger* buffer is reallocated and all the data will be printed again. Then Go to Eoverflow
122  p = next(m, p, & index)
123  If pos + count > offset Then
124  from = offset - pos
125  count -= from
126  Break
128  pos += count
129  count = 0
130  If pos == offset Then Break
133  stop(m, p)
134  Return error
136  Eoverflow :
137  stop(m, p)
138  kvfree() - Free memory.*@addr: Pointer to allocated memory.* kvfree frees memory allocated by any of vmalloc(), kmalloc() or kvmalloc().* It is slightly more efficient to use kfree() or vfree() if you are certain* that you know which one to use.
139  count = 0
140  buf = seq_buf_alloc(size <<= 1)
141  Return If Not buf Then -ENOMEM Else -EAGAIN
Caller
NameDescribe
seq_readseq_read - ->read() method for sequential files.*@file: the file to read from*@buf: the buffer to read to*@size: the maximum number of bytes to read*@ppos: the current position in the file* Ready-made ->f_op->read()
seq_lseekseq_lseek - ->llseek() method for sequential files.*@file: the file in question*@offset: new position*@whence: 0 for absolute, 1 for relative position* Ready-made ->f_op->llseek()