func: int scsi_bus_parse_cdb(SCSIDevice *dev, SCSICommand *cmd, uint8_t void *hba_private) int rc ; rc = scsi_req_parse_cdb ( dev , cmd , buf ); int scsi_req_parse_cdb(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf) int rc ; cmd -> lba = - 1; cmd -> len = scsi_cdb_length ( buf ); int scsi_cdb_length(uint8_t *buf) int cdb_len ; switch ( buf [ 0 ] >> 5 )  cdb_len = 6; cdb_len = 10; cdb_len = 16; cdb_len = 12; cdb_len = - 1; return cdb_len ; switch ( dev -> type )  rc = scsi_req_stream_xfer ( cmd , dev , buf ); static int scsi_req_stream_xfer(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf) switch ( buf [ 0 ] )  cmd -> xfer = 0; cmd -> xfer = buf [ 4 ] | ( buf [ 3 ] << 8 ) | ( buf [ 2 ] << 16 ); if ( buf [ 1 ] & 0x01 )  cmd -> xfer *= dev -> blocksize; cmd -> xfer = buf [ 14 ] | ( buf [ 13 ] << 8 ) | ( buf [ 12 ] << 16 ); if ( buf [ 1 ] & 0x01 )  cmd -> xfer *= dev -> blocksize; cmd -> xfer = 0; cmd -> xfer = buf [ 13 ] | ( buf [ 12 ] << 8 ); switch ( buf [ 1 ] & 0x1f )  cmd -> xfer = 20; cmd -> xfer = 32; cmd -> xfer = buf [ 8 ] | ( buf [ 7 ] << 8 ); return - 1 ; cmd -> xfer = buf [ 4 ] | ( buf [ 3 ] << 8 ); return scsi_req_xfer ( cmd , dev , buf ) ; static int scsi_req_xfer(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf) return 0 ; return 0 ; rc = scsi_req_medium_changer_xfer ( cmd , dev , buf ); static int scsi_req_medium_changer_xfer(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf) switch ( buf [ 0 ] )  cmd -> xfer = 0; cmd -> xfer = buf [ 9 ] | ( buf [ 8 ] << 8 ) | ( buf [ 7 ] << 16 ); return scsi_req_xfer ( cmd , dev , buf ) ; static int scsi_req_xfer(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf) return 0 ; return 0 ; rc = scsi_req_xfer ( cmd , dev , buf ); static int scsi_req_xfer(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf) return 0 ; if ( rc != 0 )  memcpy ( cmd -> buf , buf , cmd -> len ); scsi_cmd_xfer_mode ( cmd ); static void scsi_cmd_xfer_mode(SCSICommand *cmd) if ( ! cmd -> xfer )  cmd -> mode = SCSI_XFER_NONE; switch ( cmd -> buf [ 0 ] )  cmd -> mode = SCSI_XFER_TO_DEV; cmd -> mode = ( cmd -> buf [ 2 ] & 0x8 ) ? SCSI_XFER_FROM_DEV : SCSI_XFER_TO_DEV; cmd -> mode = SCSI_XFER_FROM_DEV; cmd -> lba = scsi_cmd_lba ( cmd ); static uint64_t scsi_cmd_lba(SCSICommand *cmd) uint8_t * buf = cmd -> buf ; switch ( buf [ 0 ] >> 5 )  lba = ldl_be_p ( & buf [ 0 ] ) & 0x1fffff; lba = ldq_be_p ( & buf [ 2 ] ); return lba ; 