Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:sg_split - split a scatterlist into several scatterlists*@in: the input sg list*@in_mapped_nents: the result of a dma_map_sg(in,

Proto:int sg_split(struct scatterlist *in, const int in_mapped_nents, const off_t skip, const int nb_splits, const size_t *split_sizes, struct scatterlist **out, int *out_mapped_nents, gfp_t gfp_mask)

Type:int

Parameter:

TypeParameterName
struct scatterlist *in
const intin_mapped_nents
const off_tskip
const intnb_splits
const size_t *split_sizes
struct scatterlist **out
int *out_mapped_nents
gfp_tgfp_mask
157  splitters = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
158  If Not splitters Then Return -ENOMEM
161  ret = sg_calculate_split(in, sg_nents - return total count of entries in scatterlist*@sg: The scatterlist* Description:* Allows to know how many entries are in sg, taking into acount* chaining as well, nb_splits, skip, split_sizes, splitters, false)
163  If ret < 0 Then Go to err
166  ret = -ENOMEM
167  When i < nb_splits cycle
168  out_sg = kmalloc_array - allocate memory for an array.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
171  If Not out_sg Then Go to err
178  sg_split_phys(splitters, nb_splits)
179  If in_mapped_nents Then
180  ret = sg_calculate_split(in, in_mapped_nents, nb_splits, skip, split_sizes, splitters, true)
182  If ret < 0 Then Go to err
184  sg_split_mapped(splitters, nb_splits)
187  When i < nb_splits cycle
188  out[i] = out_sg
189  If out_mapped_nents Then out_mapped_nents[i] = nents
193  kfree(splitters)
194  Return 0
196  err :
197  When i < nb_splits cycle kfree(out_sg)
199  kfree(splitters)
200  Return ret