Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:block\bio.c Create Date:2022-07-28 16:56:14
Last Modify:2020-03-17 23:13:58 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:_copy_kern - copy kernel address into bio*@q: the struct request_queue for the bio*@data: pointer to buffer to copy*@len: length in bytes*@gfp_mask: allocation flags for bio and page allocation*@reading: data direction is READ* copy the kernel address

Proto:struct bio *bio_copy_kern(struct request_queue *q, void *data, unsigned int len, gfp_t gfp_mask, int reading)

Type:struct bio

Parameter:

TypeParameterName
struct request_queue *q
void *data
unsigned intlen
gfp_tgfp_mask
intreading
1602  kaddr = data
1603  end = kaddr + len + PAGE_SIZE - 1 >> PAGE_SHIFT determines the page size
1604  start = kaddr >> PAGE_SHIFT determines the page size
1606  p = data
1607  nr_pages = 0
1612  If end < start Then Return ERR_PTR( - EINVAL)
1615  nr_pages = end - start
1616  bio = bio_kmalloc(gfp_mask, nr_pages)
1617  If Not bio Then Return ERR_PTR( - ENOMEM)
1620  When len cycle
1622  bytes = PAGE_SIZE
1624  If bytes > len Then bytes = len
1627  page = alloc_page(* queue needs bounce pages for pages above this limit | gfp_mask)
1628  If Not page Then Go to cleanup
1631  If Not reading Then memcpy(page_address(page), p, bytes)
1634  If bio_add_pc_page(q, bio, page, bytes, 0) < bytes Then Break
1637  len -= bytes
1638  p += bytes
1641  If reading Then
1642  bi_end_io = bio_copy_kern_endio_read
1643  bi_private = data
1644  Else
1645  bi_end_io = bio_copy_kern_endio
1648  Return bio
1650  cleanup :
1651  bio_free_pages(bio)
1652  _put - release a reference to a bio*@bio: bio to release reference to* Description:* Put a reference to a &struct bio, either one you have gotten with* bio_alloc, bio_get or bio_clone_*. The last put of a bio will free it.
1653  Return ERR_PTR( - ENOMEM)
Caller
NameDescribe
blk_rq_map_kernlk_rq_map_kern - map kernel data to a request, for passthrough requests*@q: request queue where request should be inserted*@rq: request to fill*@kbuf: the kernel buffer*@len: length of user data*@gfp_mask: memory allocation flags* Description: