Hello Everybody
I am using the SPTI interface to access the remote disk drive which is
mounted on my server through a FC switch.
In other words its something like this
server–>Fiberchannel Switch –> Disk Drive.
I have written a code to carry out block data read and write on this
remote disk but somehow it always fails.
The interesting points in my problem are as follows:
-
The code works perfectly fine for a local disk drive.
-
When I run the code the following IOCTL commands are succesful.
statusMain = DeviceIoControl(fileHandle,
IOCTL_SCSI_GET_INQUIRY_DATA,
NULL,
0,
bufferMain,
sizeof(bufferMain),
&returnedMain,
FALSE);
Ity always returns back me the right information about what all SCSI
devices are connected to each bus. Their path ID , LUN ID, Target ID and
so on…
But the following piece of code always fails::
ZeroMemory(&sptdwb, sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER));
dataBuffer =
AllocateAlignedBuffer(localThreadParam.sectorSize,localThreadParam.capabilities.AlignmentMask);
FillMemory(dataBuffer,(localThreadParam.sectorSize)/2,‘N’);
FillMemory(dataBuffer +
(localThreadParam.sectorSize)/2,localThreadParam.sectorSize/2,‘T’);
sptdwb.sptd.Length = sizeof(SCSI_PASS_THROUGH_DIRECT);
sptdwb.sptd.PathId = 0;
sptdwb.sptd.TargetId = 0;
sptdwb.sptd.Lun = 0;
sptdwb.sptd.CdbLength = CDB10GENERIC_LENGTH;
sptdwb.sptd.SenseInfoLength = 24;
sptdwb.sptd.DataIn = SCSI_IOCTL_DATA_OUT;
sptdwb.sptd.DataTransferLength = sectorSize;
sptdwb.sptd.TimeOutValue = 2;
sptdwb.sptd.DataBuffer = dataBuffer;
sptdwb.sptd.SenseInfoOffset =
offsetof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER,ucSenseBuf);
//Include this for Direct disc operations.
sptdwb.sptd.Cdb[0] = SCSIOP_WRITE;
sptdwb.sptd.Cdb[7] = (UCHAR)(localThreadParam.sectorSize >> 8);
sptdwb.sptd.Cdb[8] = 0;
length = sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER);
status = DeviceIoControl(localThreadParam.filehandle,
IOCTL_SCSI_PASS_THROUGH_DIRECT,
&sptdwb,
length,
&sptdwb,
length,
&returned,
FALSE);
And the same code works perfectly fine for local Disk Drive.
I am pasting below the output achieved by me when , run the above code.
***** WRITE DATA BUFFER operation *****
Scsi status: 02h
Sense Info – consult SCSI spec for details
70 00 0B 00 00 00 00 0A 00 00 00 00 00 06 00 00 00 00 5B E2 00 00 01 00
The sense data printed above is also of no use to me.
So, my question is do we need to do anything different to access a disk
drive connected through FC switch as compared to local disc drive.
Any, help will be very appreciated. Thanking in anticipation.
Regards
Biren