| Function report | 
| Source Code: block\scsi_ioctl.c | Create Date:2022-07-28 17:36:29 | 
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name: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
Proto:int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, struct scsi_ioctl_command __user *sic)
Type:int
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| struct request_queue * | q | |
| struct gendisk * | disk | |
| fmode_t | mode | |
| struct scsi_ioctl_command __user * | sic | 
| 416 | enum{OMAX_SB_LEN = 16} | 
| 421 | char * buffer = NULL | 
| 429 | If Get a simple variable from user space(in_len, & inlen) Then Return -EFAULT | 
| 431 | If Get a simple variable from user space(out_len, & outlen) Then Return -EFAULT | 
| 435 | If Get a simple variable from user space(opcode, data) Then Return -EFAULT | 
| 438 | bytes = max - return maximum of two values of the same or compatible types*@x: first value*@y: second value(in_len, out_len) | 
| 439 | If bytes Then | 
| 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. | 
| 449 | Go to error_free_buffer | 
| 453 | cmdlen = COMMAND_SIZE(opcode) | 
| 460 | If copy_from_user(cmd, data, cmdlen) Then Go to error | 
| 466 | err = blk_verify_command(cmd, mode) | 
| 471 | retries = 5 | 
| 474 | Case opcode == SEND_DIAGNOSTIC | 
| 475 | Case opcode == FORMAT_UNIT | 
| 479 | Case opcode == START_STOP | 
| 480 | timeout = START_STOP_TIMEOUT | 
| 481 | Break | 
| 482 | Case opcode == MOVE_MEDIUM | 
| 483 | timeout = MOVE_MEDIUM_TIMEOUT | 
| 484 | Break | 
| 485 | Case opcode == READ_ELEMENT_STATUS | 
| 487 | Break | 
| 488 | Case opcode == READ_DEFECT_DATA | 
| 492 | Default | 
| 494 | Break | 
| 498 | err = DRIVER_ERROR << 24 | 
| 499 | Go to error | 
| 505 | If err Then | 
| 507 | bytes = If OMAX_SB_LEN > sense_len Then sense_len Else OMAX_SB_LEN | 
| 512 | Else | 
| 517 | error : | 
| 518 | blk_put_request(rq) | 
| 520 | error_free_buffer : | 
| 523 | Return err | 
| Name | Describe | 
|---|---|
| scsi_cmd_ioctl | 
| Source code conversion tool public plug-in interface | X | 
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |