Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:block\bsg.c Create Date:2022-07-28 17:37:33
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:bsg_sg_io

Proto:static int bsg_sg_io(struct request_queue *q, fmode_t mode, void __user *uarg)

Type:int

Parameter:

TypeParameterName
struct request_queue *q
fmode_tmode
void __user *uarg
142  If copy_from_user( & hdr, uarg, size of hdr ) Then Return -EFAULT
145  If Not class_dev Then Return -ENXIO
148  If [i] 'Q' to differentiate from v3 != 'Q' Then Return -EINVAL
150  ret = check_proto( & hdr)
151  If ret Then Return ret
154  rq = lk_get_request - allocate a request*@q: request queue to allocate a request for*@op: operation (REQ_OP_*) and REQ_* flags, e.g. REQ_SYNC.*@flags: BLK_MQ_REQ_* flags, e.g. BLK_MQ_REQ_NOWAIT.
156  If IS_ERR(rq) Then Return PTR_ERR(rq)
159  ret = fill_hdr(rq, & hdr, mode)
160  If ret Then Return ret
163  timeout = msecs_to_jiffies: - convert milliseconds to jiffies*@m: time in milliseconds* conversion is done as follows:* - negative values mean 'infinite timeout' (MAX_JIFFY_OFFSET)* - 'too large' values [that would result in larger than
164  If Not timeout Then timeout = * sg stuff
166  If Not timeout Then timeout = default timeout for SG_IO if none specified
168  If timeout < BLK_MIN_SG_TIMEOUT Then timeout = BLK_MIN_SG_TIMEOUT
171  If [i] bytes to be transferred to device Then
172  ret = blk_rq_map_user(q, rq, NULL, uptr64( [i], [*i] ), [i] bytes to be transferred to device , GFP_KERNEL)
174  Else if [i] bytes to be transferred from device Then
175  ret = blk_rq_map_user(q, rq, NULL, uptr64( [i], [*o] ), [i] bytes to be transferred from device , GFP_KERNEL)
179  If ret Then Go to out_free_rq
182  bio = bio
184  lk_execute_rq - insert a request into queue for execution*@q: queue to insert the request in*@bd_disk: matching gendisk*@rq: request to insert*@at_head: insert request at head or tail of queue* Description:* Insert a fully prepared request at the back of
185  ret = complete_rq(rq, & hdr)
186  lk_rq_unmap_user - unmap a request with user data*@bio: start of bio list* Description:* Unmap a rq previously mapped by blk_rq_map_user(). The caller must* supply the original rq->bio from the blk_rq_map_user() return, since
188  out_free_rq :
189  free_rq(rq)
190  blk_put_request(rq)
191  If Not ret && copy_to_user(uarg, & hdr, size of hdr ) Then Return -EFAULT
193  Return ret
Caller
NameDescribe
bsg_ioctl