Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\relay.c Create Date:2022-07-28 11:46:45
Last Modify:2020-03-17 19:20:22 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name: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.

Proto:static void *relay_alloc_buf(struct rchan_buf *buf, size_t *size)

Type:void

Parameter:

TypeParameterName
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  If Not array of current buffer pages Then Return NULL
135  When i < n_pages cycle
136  array of current buffer pages [i] = alloc_page(GFP_KERNEL)
137  If Value for the false possibility is greater at compile time(!array of current buffer pages [i]) Then Go to 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  If Not mem Then Go to depopulate
145  memset(mem, 0, * size)
146  umber of current buffer pages = n_pages
147  Return mem
149  depopulate :
150  When j < i cycle __free_page(array of current buffer pages [j])
152  an array of pointers of struct page
153  Return NULL
Caller
NameDescribe
relay_create_buflay_create_buf - allocate and initialize a channel buffer*@chan: the relay channel* Returns channel buffer if successful, %NULL otherwise.