Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:__bitmap_parse - convert an ASCII hex string into a bitmap

Proto:int __bitmap_parse(const char *buf, unsigned int buflen, int is_user, unsigned long *maskp, int nmaskbits)

Type:int

Parameter:

TypeParameterName
const char *buf
unsigned intbuflen
intis_user
unsigned long *maskp
intnmaskbits
394  const char __user __force * ubuf = buf
396  bitmap_zero(maskp, nmaskbits)
398  nchunks = nbits = totaldigits = c = 0
399  Do
400  chunk = 0
401  ndigits = totaldigits
404  When buflen cycle
405  old_c = c
406  If is_user Then
410  Else c = buf++
412  buflen--
425  If c == '\0' || c == ',' Then Break
428  If Not isxdigit(c) Then Return -EINVAL
439  chunk = chunk << 4 | hex_to_bin(c)
440  totaldigits++
442  If ndigits == totaldigits Then Return -EINVAL
444  If nchunks == 0 && chunk == 0 Then Continue
447  __bitmap_shift_left - logical left shift of the bits in a bitmap*@dst : destination bitmap*@src : source bitmap*@shift : shift by this many bits*@nbits : bitmap size, in bits* Shifting left (multiplying) means moving bits in the LS -> MS* direction
448  maskp |= chunk
449  nchunks++
450  nbits += If nchunks == 1 Then nbits_to_hold_value(chunk) Else Bitmap printing & parsing functions: first version by Nadia Yvette Chambers,* second version by Paul Jackson, third by Joe Korty.
451  If nbits > nmaskbits Then Return -EOVERFLOW
453  When buflen && c == ',' cycle
455  Return 0
Caller
NameDescribe
bitmap_parse_usermap_parse_user - convert an ASCII hex string in a user buffer into a bitmap*@ubuf: pointer to user buffer containing string.*@ulen: buffer size in bytes. If string is smaller than this* then it must be terminated with a \0.
bitmap_parse