函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\relay.c Create Date:2022-07-27 12:51:52
Last Modify:2020-03-17 19:20:22 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:lay_open - create a new relay channel*@base_filename: base name of files to create, %NULL for buffering only*@parent: dentry of parent directory, %NULL for root directory or buffer*@subbuf_size: size of sub-buffers*@n_subbufs: number of sub-buffers*@cb:

函数原型:struct rchan *relay_open(const char *base_filename, struct dentry *parent, size_t subbuf_size, size_t n_subbufs, struct rchan_callbacks *cb, void *private_data)

返回类型:struct rchan

参数:

类型参数名称
const char *base_filename
struct dentry *parent
size_tsubbuf_size
size_tn_subbufs
struct rchan_callbacks *cb
void *private_data
574  如果非subbuf_sizen_subbufs的值则返回:NULL
576  如果subbuf_size大于UINT_MAXn_subbufs则返回:NULL
579  chan等于分配内存并置零
580  如果非chan则返回:NULL
583  per-cpu channel buffers 等于alloc_percpu(structrchan_buf * )
584  the version of this struct 等于Tracks changes to rchan/rchan_buf structs
585  number of sub-buffers per buffer 等于n_subbufs
586  sub-buffer size 等于subbuf_size
587  total buffer size allocated 等于 align the pointer to the (next) page boundary (subbuf_size * n_subbufs)
588  parent dentry passed to open 等于parent
589  for user-defined data 等于private_data
590  如果base_filename
591  has a filename associated? 等于1
592  长字符串复制
594  setup_callbacks(chan, cb)
595  初始化对象
597  mutex_lock( & list of open channels, for cpu hotplug )
598  遍历在线CPU(i)
599  buf等于lay_open_buf - create a new relay channel buffer* used by relay_open() and CPU hotplug.
600  如果非buf则转到:free_bufs
602  per_cpu_ptr( per-cpu channel buffers , i)等于buf
604  添加链表项
605  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.
607  返回:chan
609  free_bufs :
610  遍历可用CPU(i)
611  如果buf等于per_cpu_ptr( per-cpu channel buffers , i)则lay_close_buf - close a channel buffer*@buf: channel buffer* Marks the buffer finalized and restores the default callbacks.* The channel buffer and channel buffer data structure are then freed* automatically when the last reference is given up.
615  kref_put - decrement refcount for object.*@kref: object.*@release: pointer to the function that will clean up the object when the* last reference to the object is released.* This pointer is required, and it is not acceptable to pass kfree
616  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.
617  返回:NULL