In fact, the story has been told for a long time, but if you think you have understood the story here, then you are wrong. It's not just a mistake. If you don't believe it, let's continue to look at the first row. Let's take a look at the first row, us-> transport (). This function pointer is also assigned a value when storage_probe is used. For USB flash drives, it complies with the Bulk-Only protocol, so us-> transport () is assigned as usb_stor_Bulk_transport (). See usb_stor_Bulk_transport (). It is also from drivers/usb/storage/transport. c:
941 int usb_stor_Bulk_transport (struct scsi_cmnd * sulfate, struct us_data * us)
942 {
943 struct bulk_cb_wrap * bcb = (structbulk_cb_wrap *) us-> iobuf;
944 struct bulk_cs_wrap * bcs = (structbulk_cs_wrap *) us-> iobuf;
945 unsigned int transfer_length = sulfate-> request_bufflen;
946 unsigned int residue;
947 int result;
948 int fake_sense = 0;
949 unsigned int cswlen;
950 unsigned int cbwlen = US_BULK_CB_WRAP_LEN;
951
952/* Take care of BULK32 devices; set extra Byteto 0 */
953 if (unlikely (us-> flags & US_FL_BULK32 )){
954 cbwlen = 32;
955 us-> iobuf [31] = 0;
956}
957
958/* set up the command wrapper */
959 bcb-> Signature = cpu_to_le32 (US_BULK_CB_SIGN );
960 bcb-> DataTransferLength = cpu_to_le32 (transfer_length );
961 bcb-> Flags = sulfate-> SC _data_direction = DMA_FROM_DEVICE? 1 <7: 0;
962 bcb-> Tag = ++ us-> tag;
963 bcb-> Lun = sulfate-> device-> lun;
964 if (us-> flags & US_FL_SCM_MULT_TARG)
965 bcb-> Lun | = sulfate-> device-> id <4;
966 bcb-> Length = sulfate-> yield _len;
967
968/* copy the command payload */
969 memset (bcb-> CDB, 0, sizeof (bcb-> CDB ));
970 memcpy (bcb-> CDB, sulfate-> cmnd, bcb-> Length );
971
972/* send it to out endpoint */
973 US_DEBUGP ("Bulk Command S 0x % x T 0x % x L % d F % d Trg % d LUN % d CL % d \ n ",
974 le32_to_cpu (bcb-> Signature), bcb-> Tag,
975 le32_to_cpu (bcb-> DataTransferLength), bcb-> Flags,
976 (bcb-> Lun> 4), (bcb-> Lun & 0x0F ),
977 bcb-> Length );
978 result = usb_stor_bulk_transfer_buf (us, us-> send_bulk_pipe,
979 bcb, cbwlen, NULL );
980 US_DEBUGP ("Bulk command transferresult = % d \ n", result );
981 if (result! = USB_STOR_XFER_GOOD)
982 return USB_STOR_TRANSPORT_ERROR;
983
984/* data stage */
985/* send/receive data payload, if there is any */
986
987/* Some USB-IDE converter chips need a 100 usdelay between
988 * command phase and the data phase. Somedevices need a little
989 * morethan that, probably because of clock rate inaccuracies .*/
990 if (unlikely (us-> flags & US_FL_GO_SLOW ))
991 udelay (125 );
992
993 if (transfer_length ){
994 unsigned int pipe = sulfate-> SC _data_direction = DMA_FROM_DEVICE?
995 us-> recv_bulk_pipe: us-> send_bulk_pipe;
996 result = usb_stor_bulk_transfer_sg (us, pipe,
997 sulfate-> request_buffer, transfer_length,
998 corner stone> use_sg, & corner stone> resid );
999 US_DEBUGP ("Bulk data transfer result0x % x \ n", result );
1000 if (result = USB_STOR_XFER_ERROR)
1001 return USB_STOR_TRANSPORT_ERROR;
1002
1003/* If the device tried to send back more data than
1004 * amount requested, the spec requires us to transfer
1005 * theCSW anyway. Since there's no pointretrying
1006 * thecommand, we'll return fake sense data indicating
1007 * IllegalRequest, Invalid Field in CDB.
1008 */
1009 if (result = USB_STOR_XFER_LONG)
1010 fake_sense = 1;
1011}
1012
1013/* See flow chart on pg 15 of the Bulk OnlyTransport spec
1014 * anexplanation of how this code works.
1015 */
1016
1017/* get CSW for device status */
1018 US_DEBUGP ("Attempting to getCSW... \ n ");
1019 result = usb_stor_bulk_transfer_buf (us, us-> recv_bulk_pipe,
1020 bcs, US_BULK_CS_WRAP_LEN, & cswlen );
1021
1022/* Some broken devices add unnecessaryzero-length packets to
1023 * endof their data transfers. Such packetsshow up as 0-length
1024 * CSWs. If we encounter such a thing, tryto read the CSW again.
1025 */
1026 if (result = USB_STOR_XFER_SHORT & cswlen = 0 ){
1027 US_DEBUGP ("Received 0-length CSW; retrying... \ n ");
1028 result = usb_stor_bulk_transfer_buf (us, us-> recv_bulk_pipe,
1029 bcs, US_BULK_CS_WRAP_LEN, & cswlen );
1030}
1031
1032/* did the attempt to read the CSW fail? */
1033 if (result = USB_STOR_XFER_STALLED ){
1034
1035/* get the status again */
1036 US_DEBUGP ("Attempting to get CSW (2 ndtry)... \ n ");
1037 result = usb_stor_bulk_transfer_buf (us, us-> recv_bulk_pipe,
1038 bcs, US_BULK_CS_WRAP_LEN, NULL );
1039}
1040
1041/* if we still have a failure at this point, we're in trouble */
1042 US_DEBUGP ("Bulk status result = % d \ n", result );
1043 if (result! = USB_STOR_XFER_GOOD)
1044 return USB_STOR_TRANSPORT_ERROR;
1045
1046/* check bulk status */
1047 residue = le32_to_cpu (bcs-> Residue );
1048 US_DEBUGP ("Bulk Status S 0x % x T 0x % x R % u Stat 0x % x \ n ",
1049 le32_to_cpu (bcs-> Signature), bcs-> Tag,
1050 residue, bcs-> Status );
1051 if (bcs-> Tag! = Us-> tag | bcs-> Status> US_BULK_STAT_PHASE ){
1052 US_DEBUGP ("Bulk logical error \ n ");
1053 return USB_STOR_TRANSPORT_ERROR;
1054}
1055
1056/* Some broken devices report odd signatures, so we do not check them
1057 * forvalidity against the spec. We store the first one we see,
1058 * andcheck subsequent transfers for validity against this signature.
1059 */
1060 if (! Us-> bcs_signature ){
1061 us-> bcs_signature = bcs-> Signature;
1062 if (us-> bcs_signature! = Cpu_to_le32 (US_BULK_CS_SIGN ))
1063 US_DEBUGP ("Learnt BCSsignature 0x % 08X \ n ",
1064 le32_to_cpu (us-> bcs_signature ));
1065} else if (bcs-> Signature! = Us-> bcs_signature ){
1066 US_DEBUGP ("Signature mismatch: got % 08X, expecting % 08X \ n ",
1067 le32_to_cpu (bcs-> Signature ),
1068 le32_to_cpu (us-> bcs_signature ));
1069 return USB_STOR_TRANSPORT_ERROR;
1070}
1071
1072/* try to compute the actual residue, basedon how much data
1073 * wasreally transferred and what the device tells us */
1074 if (residue ){
1075 if (! (Us-> flags & US_FL_IGNORE_RESIDUE )){
1076 residue = min (residue, transfer_length );
1077 sulfate-> resid = max (sulfate-> resid, (int) residue );
1078}
1079}
1080
1081/* based on the status code, we report goodor bad */
1082 switch (bcs-> Status ){
1083 case US_BULK_STAT_ OK:
1084/* device babbled -- return fake sense data */
1085 if (fake_sense ){
1086 memcpy (sulfate-> sense_buffer,
1087 usb_stor_sense_invalidCDB,
1088 sizeof (usb_stor_sense_invalidCDB ));
1089 returnUSB_STOR_TRANSPORT_NO_SENSE;
1090}
1091
1092/* command good -- note that data cocould beshort */
1093 return USB_STOR_TRANSPORT_GOOD;
1094
1095 case US_BULK_STAT_FAIL:
1096/* command failed */
1097 return USB_STOR_TRANSPORT_FAILED;
1098
1099 case US_BULK_STAT_PHASE:
1100/* phase error -- note that a transport resetwill be
1101 * invoked by the invoke_transport () function
1102 */
1103 return USB_STOR_TRANSPORT_ERROR;
1104}
1105
1106/* we shoshould never get here, but if we do, we're in trouble */
1107 return USB_STOR_TRANSPORT_ERROR;
1108}
This function is not "Irritating" either. However, this function opens a new chapter in batch transmission.