Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:sg_calculate_split

Proto:static int sg_calculate_split(struct scatterlist *in, int nents, int nb_splits, off_t skip, const size_t *sizes, struct sg_splitter *splitters, bool mapped)

Type:int

Parameter:

TypeParameterName
struct scatterlist *in
intnents
intnb_splits
off_tskip
const size_t *sizes
struct sg_splitter *splitters
boolmapped
26  size = sizes[0]
27  curr = splitters
30  When i < nb_splits cycle
31  in_sg0 = NULL
32  nents = 0
36  sglen = If mapped Then sg_dma_len(sg) Else length
37  If skip > sglen Then
38  skip -= sglen
39  Continue
42  len = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(size_t, size, sglen - skip)
43  If Not in_sg0 Then
44  in_sg0 = sg
45  skip_sg0 = skip
47  size -= len
48  nents++
49  length_last_sg = len
51  When Not size && skip + len < sglen && --nb_splits > 0 cycle
52  curr++
53  size = *++sizes
54  skip += len
57  in_sg0 = sg
58  skip_sg0 = skip
59  nents = 1
61  size -= len
63  skip = 0
65  If Not size && --nb_splits > 0 Then
66  curr++
67  size = *++sizes
70  If Not nb_splits Then Break
74  Return If size || Not in_sg0 Then -EINVAL Else 0
Caller
NameDescribe
sg_splitsg_split - split a scatterlist into several scatterlists*@in: the input sg list*@in_mapped_nents: the result of a dma_map_sg(in,