Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:__sg_alloc_table_from_pages - Allocate and initialize an sg table from* an array of pages*@sgt: The sg table header to use*@pages: Pointer to an array of page pointers*@n_pages: Number of pages in the pages array*@offset: Offset from start of the first

Proto:int __sg_alloc_table_from_pages(struct sg_table *sgt, struct page **pages, unsigned int n_pages, unsigned int offset, unsigned long size, unsigned int max_segment, gfp_t gfp_mask)

Type:int

Parameter:

TypeParameterName
struct sg_table *sgt
struct page **pages
unsigned intn_pages
unsigned intoffset
unsigned longsize
unsigned intmax_segment
gfp_tgfp_mask
398  If WARN_ON(!max_segment || offset_in_page(max_segment)) Then Return -EINVAL
402  chunks = 1
403  seg_len = 0
404  When i < n_pages cycle
405  seg_len += PAGE_SIZE
406  If seg_len >= max_segment || page_to_pfn(pages[i]) != page_to_pfn(pages[i - 1]) + 1 Then
408  chunks++
409  seg_len = 0
413  ret = sg_alloc_table - Allocate and initialize an sg table*@table: The sg table header to use*@nents: Number of entries in sg list*@gfp_mask: GFP allocation mask* Description:* Allocate and initialize an sg table. If @nents@ is larger than
414  If Value for the false possibility is greater at compile time(ret) Then Return ret
418  cur_page = 0
423  seg_len = 0
424  When j < n_pages cycle
425  seg_len += PAGE_SIZE
426  If seg_len >= max_segment || page_to_pfn(pages[j]) != page_to_pfn(pages[j - 1]) + 1 Then Break
432  chunk_size = ( j - cur_page << PAGE_SHIFT determines the page size ) - offset
433  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
435  size -= chunk_size
436  offset = 0
437  cur_page = j
440  Return 0
Caller
NameDescribe
sg_alloc_table_from_pagessg_alloc_table_from_pages - Allocate and initialize an sg table from* an array of pages*@sgt: The sg table header to use*@pages: Pointer to an array of page pointers*@n_pages: Number of pages in the pages array*@offset: Offset from start of the first page