scsi-generic: fix get_stream_blocksize
PATCH 1/1 scsi-generic: fix get_stream_blocksize
The computation of the block size is completely broken; mode page 0 is vendor specific. Use the right SCSI command instead.
Signed-off-by Paolo Bonzini <[email protected]>
--- hw/scsi-generic.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
hw/scsi-generic.c +3 -4
@@ -343,7 +343,7 @@ static int get_blocksize(BlockDriverState *bdrv)if (ret <0 )return -1 ; -return (buf[4 ] <<24 ) | (buf[5 ] <<16 ) | (buf[6 ] <<8 ) | buf[7 ]; +return ldl_be_p (&buf[4 ]); }static int get_stream_blocksize (BlockDriverState *bdrv)
@@ -356,8 +356,7 @@ static int get_stream_blocksize(BlockDriverState *bdrv)memset (cmd,0 ,sizeof (cmd));memset (buf,0 ,sizeof (buf)); - cmd[0 ] =MODE_SENSE ; - cmd[4 ] =sizeof (buf); + cmd[0 ] =READ_BLOCK_LIMITS ;memset (&io_header,0 ,sizeof (io_header)); io_header.interface_id ='S' ;
@@ -374,7 +373,7 @@ static int get_stream_blocksize(BlockDriverState *bdrv)if (ret <0 )return -1 ; -return (buf[9 ] <<16 ) | (buf[10 ] <<8 ) | buf[11 ]; +return ldl_be_p (&buf[0 ]) &0xffffff ; }static void scsi_generic_reset (DeviceState *dev)
Signature · 1 line
1.7.6