Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:__tracing_open

Proto:static struct trace_iterator *__tracing_open(struct inode *inode, struct file *file, bool snapshot)

Type:struct trace_iterator

Parameter:

TypeParameterName
struct inode *inode
struct file *file
boolsnapshot
4162  tr = s or device private pointer
4166  If Kill all tracing for good (never come back).* It is initialized to 1 but will turn to zero if the initialization* of the tracer is successful. But that is the only place that sets* this back to zero. Then Return ERR_PTR( - ENODEV)
4169  iter = __seq_open_private(file, & tracer_seq_ops, size of iter )
4170  If Not iter Then Return ERR_PTR( - ENOMEM)
4173  buffer_iter = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
4175  If Not buffer_iter Then Go to release
4182  mutex_lock( & race_types_lock is used to protect the trace_types list.)
4183  trace = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
4184  If Not trace Then Go to fail
4187  trace = current_trace
4189  If Not zalloc_cpumask_var( & started, GFP_KERNEL) Then Go to fail
4192  tr = tr
4200  trace_buffer = trace_buffer
4201  it's true when current open file is snapshot = snapshot
4202  pos = -1
4203  cpu_file = Should be used after trace_array_get(), trace_types_lock* ensures that i_cdev was already initialized.
4204  mutex_init - initialize the mutex*@mutex: the mutex to be initialized* Initialize the mutex to unlocked state.* It is not allowed to initialize an already locked mutex.( & mutex)
4207  If trace && open Then open(iter)
4211  If g_buffer_overruns - get the number of overruns in buffer*@buffer: The ring buffer* Returns the total number of overruns in the ring buffer* (all CPU entries) Then iter_flags |= TRACE_FILE_ANNOTATE
4215  If is this clock in nanoseconds? Then iter_flags |= TRACE_FILE_TIME_IN_NS
4219  If Not it's true when current open file is snapshot Then tracing_stop_tr(tr)
4222  If cpu_file == RING_BUFFER_ALL_CPUS Then
4228  g_buffer_read_prepare_sync - Synchronize a set of prepare calls* All previously invoked ring_buffer_read_prepare calls to prepare* iterators will be synchronized. Afterwards, read_buffer_read_start* calls on those iterators are allowed.
4233  Else
4234  cpu = cpu_file
4235  buffer_iter[cpu] = g_buffer_read_prepare - Prepare for a non consuming read of the buffer*@buffer: The ring buffer to read from*@cpu: The cpu buffer to iterate over*@flags: gfp flags to use for memory allocation* This performs the initial preparations necessary to iterate
4238  g_buffer_read_prepare_sync - Synchronize a set of prepare calls* All previously invoked ring_buffer_read_prepare calls to prepare* iterators will be synchronized. Afterwards, read_buffer_read_start* calls on those iterators are allowed.
4239  g_buffer_read_start - start a non consuming read of the buffer*@iter: The iterator returned by ring_buffer_read_prepare* This finalizes the startup of an iteration through the buffer
4240  tracing_iter_reset(iter, cpu)
4243  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
4245  Return iter
4247  fail :
4248  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
4249  kfree(trace)
4250  kfree(buffer_iter)
4251  release :
4252  seq_release_private(inode, file)
4253  Return ERR_PTR( - ENOMEM)
Caller
NameDescribe
tracing_open