Function report |
Source Code:block\scsi_ioctl.c |
Create Date:2022-07-28 17:36:50 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:scsi_cmd_ioctl
Proto:int scsi_cmd_ioctl(struct request_queue *q, struct gendisk *bd_disk, fmode_t mode, unsigned int cmd, void __user *arg)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
struct request_queue * | q | |
struct gendisk * | bd_disk | |
fmode_t | mode | |
unsigned int | cmd | |
void __user * | arg |
654 | Case cmd == Example: version 2.1.34 yields 20134 |
655 | err = sg_get_version(arg) |
656 | Break |
658 | err = scsi_get_idlun(q, arg) |
659 | Break |
660 | Case cmd == Used to obtain the bus number for a device |
661 | err = scsi_get_bus(q, arg) |
662 | Break |
663 | Case cmd == unit: jiffies (10ms on i386) |
664 | err = sg_set_timeout(q, arg) |
665 | Break |
666 | Case cmd == yield timeout as _return_ value |
667 | err = sg_get_timeout(q) |
668 | Break |
669 | Case cmd == actual size of reserved buffer |
670 | err = sg_get_reserved_size(q, arg) |
671 | Break |
672 | Case cmd == quest a new reserved buffer size |
673 | err = sg_set_reserved_size(q, arg) |
674 | Break |
675 | Case cmd == rue for emulated host adapter (ATAPI) |
676 | err = will always return that we are ATAPI even for a real SCSI drive, I'm not* so sure this is worth doing anything about (why would you care??) |
677 | Break |
678 | Case cmd == similar effect as write() followed by read() |
681 | err = get_sg_io_hdr( & hdr, arg) |
682 | If err Then Break |
688 | If put_sg_io_hdr( & hdr, arg) Then err = -EFAULT |
690 | Break |
692 | Case cmd == send a packet to the drive |
697 | If copy_from_user( & cgc, arg, size of cgc ) Then Break |
699 | timeout = clock_t_to_jiffies(timeout) |
701 | [i] 'S' for SCSI generic (required) = 'S' |
702 | [i] SCSI command length = size of cmd |
704 | err = 0 |
706 | Case data_direction == CGC_DATA_UNKNOWN |
708 | Break |
709 | Case data_direction == CGC_DATA_WRITE |
711 | Break |
712 | Case data_direction == CGC_DATA_READ |
714 | Break |
715 | Case data_direction == CGC_DATA_NONE |
717 | Break |
718 | Default |
721 | If err Then Break |
726 | If [i], [*o] points to sense_buffer memory Then [i] max length to write to sbp = sizeof(structrequest_sense) |
728 | [i] MAX_UINT->no timeout (unit: millisec) = Convert jiffies to milliseconds and back.* Avoid unnecessary multiplications/divisions in the* two most common HZ cases: |
730 | [i] SCSI command length = size of cmd |
736 | If [o] scsi status Then err = -EIO |
744 | Break |
750 | Case cmd == SCSI_IOCTL_SEND_COMMAND |
753 | If Not arg Then Break |
757 | Break |
758 | Case cmd == pendant of CDROMEJECT |
759 | err = blk_send_start_stop(q, bd_disk, 0x03) |
760 | Break |
761 | Case cmd == Ejects the cdrom media |
762 | err = blk_send_start_stop(q, bd_disk, 0x02) |
763 | Break |
764 | Default |
768 | Return err |
Name | Describe |
---|---|
scsi_cmd_blk_ioctl | |
bsg_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 |