Hi folks,
I am designing a virtual SCSI miniport driver. When this driver services
a block device. START_IO routine will receive a lot of
SCSIOP_TEST_UNIT_READY and SCSI_READ command. I know that file system
will read some data block to get some info. But why my miniport driver
receive so many SCSIOP_TEST_UNIT_READY command. When such driver
services a boot disk, it receives about more than 130
SCSIOP_TEST_UNIT_READY commands, even after can read and write data
from/to disk which miniport driver serviced. In my driver, for
SCSIOP_TEST_UNIT_READY command , I just return success with
Srb->SrbStatus = SRB_STATUS_SUCCESS and Srb->ScsiStatus = 0. Is that
correct?
Another issue is about disk capacity. In ‘My computer’, I cannot see
disk capacity and disk usage which my miniport driver serviced. But I
can get them from ‘disk property’. Disk capacity is OK but usage is not
correctly. Why?
Here is the code of READ_CAPACITY
PVOID buffer = Srb->DataBuffer;
ULONG BytePerBlock = disk->sectorSize;// disk sector size
ULONG LogicalBlockAddress = disk->sectors -1; // disk capacity
REVERSE_BYTES(&(((PREAD_CAPACITY_DATA)buffer)->BytesPerBlock),
&BytePerBlock);
REVERSE_BYTES(&(((PREAD_CAPACITY_DATA)buffer)->LogicalBlockAddress),
&LogicalBlockAddress);
Best regards – Wayne