Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:mpi_read_raw_from_sgl() - Function allocates an MPI and populates it with* data from the sgl* This function works in the same way as the mpi_read_raw_data, but it* takes an sgl instead of void * buffer. i.e. it allocates

Proto:MPI mpi_read_raw_from_sgl(struct scatterlist *sgl, unsigned int nbytes)

Type:MPI

Parameter:

TypeParameterName
struct scatterlist *sgl
unsigned intnbytes
338  MPI val = NULL
340  ents = sg_nents_for_len - return total count of entries in scatterlist* needed to satisfy the supplied length*@sg: The scatterlist*@len: The total required length* Description:* Determines the number of entries in sg that are required to meet* the supplied
341  If ents < 0 Then Return NULL
344  sg_miter_start - start mapping iteration over a sg list*@miter: sg mapping iter to be started*@sgl: sg list to iterate over*@nents: number of sg entries* Description:* Starts mapping iterator @miter.* Context:* Don't care.
346  lzeros = 0
347  len = 0
348  When nbytes > 0 cycle
349  When len && Not buff cycle
350  lzeros++
351  len--
352  buff++
355  If len && buff Then Break
358  sg_miter_next - proceed mapping iterator to the next mapping*@miter: sg mapping iter to proceed* Description:* Proceeds @miter to the next mapping. @miter should have been started* using sg_miter_start(). On successful return, @miter->page,
359  buff = pointer to the mapped area
360  len = length of the mapped area
362  nbytes -= lzeros
363  lzeros = 0
366  number of consumed bytes = lzeros
368  nbytes -= lzeros
369  nbits = nbytes * 8
370  If nbits > MAX_EXTERN_MPI_BITS Then
371  sg_miter_stop - stop mapping iteration*@miter: sg mapping iter to be stopped* Description:* Stops mapping iterator @miter. @miter should have been started* using sg_miter_start(). A stopped iteration can be resumed by* calling sg_miter_next() on it
372  pr_info("MPI: mpi too large (%u bits)\n", nbits)
373  Return NULL
376  If nbytes > 0 Then nbits -= _leading_zeros - Count the number of zeros from the MSB back*@x: The value* Count the number of leading zeros from the MSB going towards the LSB in @x.* If the MSB of @x is set, the result is 0. - BITS_PER_LONG - 8
379  sg_miter_stop - stop mapping iteration*@miter: sg mapping iter to be stopped* Description:* Stops mapping iterator @miter. @miter should have been started* using sg_miter_start(). A stopped iteration can be resumed by* calling sg_miter_next() on it
381  nlimbs = DIV_ROUND_UP(nbytes, BYTES_PER_MPI_LIMB)
382  val = -- mpiutil.c --
383  If Not val Then Return NULL
386  the real number of valid bits (info only) = nbits
387  indicates a negative number = 0
388  number of valid limbs = nlimbs
390  If nbytes == 0 Then Return val
393  j = nlimbs - 1
394  a = 0
395  z = BYTES_PER_MPI_LIMB - nbytes % BYTES_PER_MPI_LIMB
396  z %= BYTES_PER_MPI_LIMB
398  When sg_miter_next - proceed mapping iterator to the next mapping*@miter: sg mapping iter to proceed* Description:* Proceeds @miter to the next mapping. @miter should have been started* using sg_miter_start(). On successful return, @miter->page, cycle
399  buff = pointer to the mapped area
400  len = length of the mapped area
402  When x < len cycle
403  a <<= 8
404  a |= buff++
405  If ( z + x + 1) % BYTES_PER_MPI_LIMB == 0 Then
407  a = 0
410  z += x
413  Return val