函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:lay_alloc_buf - allocate a channel buffer*@buf: the buffer struct*@size: total size of the buffer* Returns a pointer to the resulting buffer, %NULL if unsuccessful. The* passed in size will get page aligned, if it isn't already.

函数原型:static void *relay_alloc_buf(struct rchan_buf *buf, size_t *size)

返回类型:void

参数:

类型参数名称
struct rchan_buf *buf
size_t *size
128  size等于 align the pointer to the (next) page boundary ( * size)
129  n_pages等于size右移PAGE_SHIFT determines the page size
131  array of current buffer pages 等于allocate an array of pointers of struct page
132  如果非array of current buffer pages 则返回:NULL
135 i小于n_pages循环
136  array of current buffer pages [i]等于alloc_page(GFP_KERNEL)
137  如果此条件成立可能性小(为编译器优化)(!array of current buffer pages [i])则转到:depopulate
139  set_page_private(array of current buffer pages [i], (unsignedlong)buf)
141  mem等于vmap(array of current buffer pages , n_pages, vmap()ed pages , PAGE_KERNEL)
142  如果非mem则转到:depopulate
145  memset(mem, 0, * size)
146  umber of current buffer pages 等于n_pages
147  返回:mem
149  depopulate :
150 j小于i循环__free_page(array of current buffer pages [j])
152  an array of pointers of struct page
153  返回:NULL
调用者
名称描述
relay_create_buflay_create_buf - allocate and initialize a channel buffer*@chan: the relay channel* Returns channel buffer if successful, %NULL otherwise.