Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Allocate a buffer consisting of a set of pages with a virtual mapping* applied over them.

Proto:static void *big_key_alloc_buffer(size_t len)

Type:void

Parameter:

TypeParameterName
size_tlen
162  npg = len + PAGE_SIZE - 1 >> PAGE_SHIFT determines the page size
165  buf = 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).
169  If Not buf Then Return NULL
172  nr_pages = npg
173  sg = pages + npg
174  sg_init_table - Initialize SG table*@sgl: The SG table*@nents: Number of entries in table* Notes:* If this is part of a chained sg table, sg_mark_end() should be* used only on the last table part.
176  When i < nr_pages cycle
177  pages[i] = alloc_page(GFP_KERNEL)
178  If Not pages[i] Then Go to nomem
181  l = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(size_t, len, PAGE_SIZE)
182  sg_set_page - Set sg entry to point at given page*@sg: SG entry*@page: The page*@len: Length of data*@offset: Offset into page* Description:* Use this function to set an sg entry pointing at a page, never assign* the page directly
183  len -= l
186  virt = vmap(pages, nr_pages, vmap()ed pages , PAGE_KERNEL)
187  If Not virt Then Go to nomem
190  Return buf
192  nomem :
193  Free up the buffer.
194  Return NULL
Caller
NameDescribe
big_key_preparsePreparse a big key
big_key_readad the key data* - the key's semaphore is read-locked