Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\vmalloc.c Create Date:2022-07-28 15:00:36
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:vread() - read vmalloc area in a safe way.*@buf: buffer for reading data*@addr: vm address.*@count: number of bytes to be read.* This function checks that addr is a valid vmalloc'ed area, and* copy data from that area to a given buffer

Proto:long vread(char *buf, char *addr, unsigned long count)

Type:long

Parameter:

TypeParameterName
char *buf
char *addr
unsigned longcount
2919  buf_start = buf
2920  buflen = count
2924  If addr + count < count Then count = -addr
2927  spin_lock( & vmap_area_lock)
2929  If Not count Then Break
2932  If Not in "busy" tree Then Continue
2935  vm = in "busy" tree
2936  vaddr = addr
2937  If addr >= vaddr + Lowlevel-APIs (not for driver use!) Then Continue
2939  When addr < vaddr cycle
2940  If count == 0 Then Go to finished
2942  buf = '\0'
2943  buf++
2944  addr++
2945  count--
2947  n = vaddr + Lowlevel-APIs (not for driver use!) - addr
2948  If n > count Then n = count
2950  If Not (flags & remap() and friends ) Then small helper routine , copy contents to buf from addr.* If the page is not present, fill zero.
2952  Else memset(buf, 0, n)
2954  buf += n
2955  addr += n
2956  count -= n
2958  finished :
2959  spin_unlock( & vmap_area_lock)
2961  If buf == buf_start Then Return 0
2964  If buf != buf_start + buflen Then memset(buf, 0, buflen - (buf - buf_start))
2967  Return buflen