函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:block\bio.c Create Date:2022-07-27 18:31:27
Last Modify:2020-03-17 23:13:58 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:_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

函数原型:struct bio *bio_copy_kern(struct request_queue *q, void *data, unsigned int len, gfp_t gfp_mask, int reading)

返回类型:struct bio

参数:

类型参数名称
struct request_queue *q
void *data
unsigned intlen
gfp_tgfp_mask
intreading
1602  kaddr等于data
1603  end等于kaddrlenPAGE_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  如果end小于start则返回:错误号
1615  nr_pages等于endstart
1616  bio等于bio_kmalloc(gfp_mask, nr_pages)
1617  如果非bio则返回:错误号
1620 len循环
1622  bytes等于PAGE_SIZE
1624  如果bytes大于lenbytes等于len
1627  page等于alloc_page(* queue needs bounce pages for pages above this limit | gfp_mask)
1628  如果非page则转到:cleanup
1631  如果非readingmemcpy(page_address(page), p, bytes)
1634  如果bio_add_pc_page(q, bio, page, bytes, 0)小于bytes退出
1637  len减等于bytes
1638  p加等于bytes
1641  如果reading
1642  bi_end_io等于bio_copy_kern_endio_read
1643  bi_private等于data
1644  否则
1645  bi_end_io等于bio_copy_kern_endio
1648  返回: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  返回:错误号
调用者
名称描述
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: