Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:search - binary search an array of elements*@key: pointer to item being searched for*@base: pointer to first element to search*@num: number of elements*@size: size of each element*@cmp: pointer to comparison function

Proto:void *bsearch(const void *key, const void *base, size_t num, size_t size, cmp_func_t cmp)

Type:void

Parameter:

TypeParameterName
const void *key
const void *base
size_tnum
size_tsize
cmp_func_tcmp
37  When num > 0 cycle
38  pivot = base + (num >> 1) * size
39  result = cmp(key, pivot)
41  If result == 0 Then Return pivot
44  If result > 0 Then
45  base = pivot + size
46  num--
48  num >>= 1
51  Return NULL
Caller
NameDescribe
map_id_range_down_maxmap_id_range_down_max - Find idmap via binary search in ordered idmap array.* Can only be called if number of mappings exceeds UID_GID_MAP_MAX_BASE_EXTENTS.
map_id_up_maxmap_id_up_max - Find idmap via binary search in ordered idmap array.* Can only be called if number of mappings exceeds UID_GID_MAP_MAX_BASE_EXTENTS.
find_subprog