• AIX STIOCMD ioctl for FC SCSI

    From jdb1one1@gmail.com@21:1/5 to jdb1...@gmail.com on Tue Jul 18 10:36:13 2017
    On Tuesday, July 18, 2017 at 9:34:17 AM UTC-8, jdb1...@gmail.com wrote:
    On Monday, June 23, 2008 at 1:06:54 AM UTC-8, alooki wrote:
    Hi! all

    I have a problem on AIX 5L (5.2-08) using ioctl STIOCMD.

    My problem is below....

    ------------------------------------------------------------------------------------------
    STIOCMD ioctl is doing well in SCSI interface,
    but there is no sese in FC interface.

    Here is sample source code from MTX open source


    struct sc_iocmd ds;

    if ((filenum=openx(DeviceName, O_RDWR, 0, SC_DIAGNOSTIC))<0) {
    error_handling.....
    }

    bzero (&ds, sizeof (struct sc_iocmd));
    bzero (RequestSense, sizeof (RequestSense_T));

    ds.flags = SC_ASYNC;
    ds.timeout_value = 600;
    bcopy (CDB, ds.scsi_cdb, CDB_Length);
    ds.command_length = CDB_Length;
    if (DataBufferLength > 0) {
    ds.buffer = DataBuffer;
    ds.data_length = DataBufferLength;
    }

    switch (Direction) {
    case Input:
    ds.flags = ds.flags | B_READ;
    break;
    case Output:
    ds.flags = ds.flags | B_WRITE;
    break;
    }

    Result = ioctl (DeviceFD->filenum, STIOCMD, &ds);
    <===
    # lsdev -C -c tape
    rmt0 Available 10-60-00-5,0 SCSI 4mm Tape Drive
    rmt1 Available 10-S8-00 Other FC SCSI Tape Drive

    # mtx -f /dev/rmt0 inquiry
    Product Type: Tape Drive
    Vendor ID: 'IBM '
    Product ID: 'DDS Gen5 '
    Revision: 'V314'
    Attached Changer API: No

    # mtx -f /dev/rmt1 inquiry
    mtx: Request Sense: Long Report=yes
    mtx: Request Sense: Valid Residual=no
    mtx: Request Sense: Error Code=0 (Unknown?!)
    mtx: Request Sense: Sense Key=No Sense
    mtx: Request Sense: FileMark=no
    mtx: Request Sense: EOM=no
    mtx: Request Sense: ILI=no
    mtx: Request Sense: Additional Sense Code = 00
    mtx: Request Sense: Additional Sense Qualifier = 00
    mtx: Request Sense: BPV=no
    mtx: Request Sense: Error in CDB=no
    mtx: Request Sense: SKSV=no
    INQUIRY Command Failed

    Is it OS problem? or Program bugs?

    Can you send me hints or docs for that problem. plz...?

    Thanks to all.

    May I ask a fairly dumb question? Does anyone know the actual values of B_READ and B_WRITE in this command. I know it's only 1 byte for the flags parameter so it has to be from 0 to 255 (I know it's unsigned char). I suspect that the answer is 0 and
    1, but I'm not sure of this.

    Any help appreciated as I would like to check some code with B_READ and B_WRITE for the flags parameter. I believe the file they are defined in, please post it or at least just the constants section (which is all I need) - if someone has this file,
    please post it.

    Thank you.

    I believe the constants are in a file called scsi.h under sys.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From jdb1one1@gmail.com@21:1/5 to alooki on Tue Jul 18 10:34:12 2017
    On Monday, June 23, 2008 at 1:06:54 AM UTC-8, alooki wrote:
    Hi! all

    I have a problem on AIX 5L (5.2-08) using ioctl STIOCMD.

    My problem is below....

    ------------------------------------------------------------------------------------------
    STIOCMD ioctl is doing well in SCSI interface,
    but there is no sese in FC interface.

    Here is sample source code from MTX open source


    struct sc_iocmd ds;

    if ((filenum=openx(DeviceName, O_RDWR, 0, SC_DIAGNOSTIC))<0) {
    error_handling.....
    }

    bzero (&ds, sizeof (struct sc_iocmd));
    bzero (RequestSense, sizeof (RequestSense_T));

    ds.flags = SC_ASYNC;
    ds.timeout_value = 600;
    bcopy (CDB, ds.scsi_cdb, CDB_Length);
    ds.command_length = CDB_Length;
    if (DataBufferLength > 0) {
    ds.buffer = DataBuffer;
    ds.data_length = DataBufferLength;
    }

    switch (Direction) {
    case Input:
    ds.flags = ds.flags | B_READ;
    break;
    case Output:
    ds.flags = ds.flags | B_WRITE;
    break;
    }

    Result = ioctl (DeviceFD->filenum, STIOCMD, &ds);
    <===
    # lsdev -C -c tape
    rmt0 Available 10-60-00-5,0 SCSI 4mm Tape Drive
    rmt1 Available 10-S8-00 Other FC SCSI Tape Drive

    # mtx -f /dev/rmt0 inquiry
    Product Type: Tape Drive
    Vendor ID: 'IBM '
    Product ID: 'DDS Gen5 '
    Revision: 'V314'
    Attached Changer API: No

    # mtx -f /dev/rmt1 inquiry
    mtx: Request Sense: Long Report=yes
    mtx: Request Sense: Valid Residual=no
    mtx: Request Sense: Error Code=0 (Unknown?!)
    mtx: Request Sense: Sense Key=No Sense
    mtx: Request Sense: FileMark=no
    mtx: Request Sense: EOM=no
    mtx: Request Sense: ILI=no
    mtx: Request Sense: Additional Sense Code = 00
    mtx: Request Sense: Additional Sense Qualifier = 00
    mtx: Request Sense: BPV=no
    mtx: Request Sense: Error in CDB=no
    mtx: Request Sense: SKSV=no
    INQUIRY Command Failed

    Is it OS problem? or Program bugs?

    Can you send me hints or docs for that problem. plz...?

    Thanks to all.

    May I ask a fairly dumb question? Does anyone know the actual values of B_READ and B_WRITE in this command. I know it's only 1 byte for the flags parameter so it has to be from 0 to 255 (I know it's unsigned char). I suspect that the answer is 0 and 1,
    but I'm not sure of this.

    Any help appreciated as I would like to check some code with B_READ and B_WRITE for the flags parameter. I believe the file they are defined in, please post it or at least just the constants section (which is all I need) - if someone has this file,
    please post it.

    Thank you.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)