函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:block\scsi_ioctl.c Create Date:2022-07-27 19:12:00
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:sg_scsi_ioctl -- handle deprecated SCSI_IOCTL_SEND_COMMAND ioctl*@q: request queue to send scsi commands down*@disk: gendisk to operate on (option)*@mode: mode used to open the file through which the ioctl has been* submitted*@sic: userspace structure

函数原型:int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, struct scsi_ioctl_command __user *sic)

返回类型:int

参数:

类型参数名称
struct request_queue *q
struct gendisk *disk
fmode_tmode
struct scsi_ioctl_command __user *sic
416  enum{OMAX_SB_LEN = 16}
421  char * buffer = NULL
423  如果非sic则返回:负EINVAL
429  如果Careful: we have to cast the result to the type of the pointer* for sign reasons(in_len, & inlen)则返回:负EFAULT
431  如果Careful: we have to cast the result to the type of the pointer* for sign reasons(out_len, & outlen)则返回:负EFAULT
433  如果in_len大于PAGE_SIZEout_len大于PAGE_SIZE则返回:负EINVAL
435  如果Careful: we have to cast the result to the type of the pointer* for sign reasons(opcode, data)则返回:负EFAULT
438  bytes等于两数取大(in_len, out_len)
439  如果bytes
440  buffer等于分配内存并置零
441  如果非buffer则返回:负ENOMEM
446  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.
447  如果是错误
448  err等于错误
449  转到:error_free_buffer
451  req等于scsi_req(rq)
453  cmdlen等于COMMAND_SIZE(opcode)
458  err等于负EFAULT
459  cmd_len等于cmdlen
460  如果copy_from_user(cmd, data, cmdlen)则转到:error
463  如果in_lencopy_from_user(buffer, data + cmdlen, in_len)则转到:error
466  err等于blk_verify_command(cmd, mode)
467  如果err则转到:error
471  retries等于5
474  :opcode恒等于SEND_DIAGNOSTIC
475  :opcode恒等于FORMAT_UNIT
476  timeout等于default timeouts
477  retries等于1
478  退出
479  :opcode恒等于START_STOP
480  timeout等于START_STOP_TIMEOUT
481  退出
482  :opcode恒等于MOVE_MEDIUM
483  timeout等于MOVE_MEDIUM_TIMEOUT
484  退出
485  :opcode恒等于READ_ELEMENT_STATUS
486  timeout等于READ_ELEMENT_STATUS_TIMEOUT
487  退出
488  :opcode恒等于READ_DEFECT_DATA
489  timeout等于READ_DEFECT_DATA_TIMEOUT
490  retries等于1
491  退出
492  默认
493  timeout等于default timeout for SG_IO if none specified
494  退出
497  如果byteslk_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:
498  err等于DRIVER_ERROR左移24位
499  转到:error
502  将请求插入队列执行
504  err等于result按位与0xff
505  如果err
506  如果sense_lensense
507  bytes等于如果OMAX_SB_LEN大于sense_lensense_len否则OMAX_SB_LEN
509  如果copy_to_user(data, sense, bytes)则err等于负EFAULT
512  否则
513  如果copy_to_user(data, buffer, out_len)则err等于负EFAULT
517  error :
518  blk_put_request(rq)
520  error_free_buffer :
521  释放内存
523  返回:err
调用者
名称描述
scsi_cmd_ioctl