Package org.jscsi.target.scsi.cdb

Examples of org.jscsi.target.scsi.cdb.ReadCapacityCdb


        // find out the type of READ CAPACITY command ((10) or (16))
        final BasicHeaderSegment bhs = pdu.getBasicHeaderSegment();
        final SCSICommandParser parser = (SCSICommandParser) bhs.getParser();
        final ScsiOperationCode opCode = ScsiOperationCode.valueOf(parser.getCDB().get(0));
        ReadCapacityCdb cdb;
        if (opCode == ScsiOperationCode.READ_CAPACITY_10)
            cdb = new ReadCapacity10Cdb(parser.getCDB());
        else if (opCode == ScsiOperationCode.READ_CAPACITY_16)
            cdb = new ReadCapacity16Cdb(parser.getCDB());
        else {
            // programmer error, we should not be here, close the connection
            throw new InternetSCSIException("wrong SCSI Operation Code " + opCode + " in ReadCapacityStage");
        }

        /*
         * Everything is fine, carry on. The PMI bit of the command descriptor block is ignored, since there is no way
         * to know if "substantial vendor specific delay in data transfer may be encountered" after the address in the
         * LOGICAL BLOCK ADDRESS field. Therefore we always try to return the whole length of the storage medium.
         */

        // make sure that the LOGICAL BLOCK ADDRESS field is valid and send
        // appropriate response
        if (session.getStorageModule().checkBounds(cdb.getLogicalBlockAddress(), 0) != 0) {
            // invalid, log error, send error PDU, and return
            LOGGER.error("encountered " + cdb.getClass() + " in ReadCapacityStage with " + "LOGICAL BLOCK ADDRESS = " + cdb.getLogicalBlockAddress());

            final FieldPointerSenseKeySpecificData fp = new FieldPointerSenseKeySpecificData(true,// senseKeySpecificDataValid
            true,// commandData (i.e. invalid field in CDB)
            false,// bitPointerValid
            0,// bitPointer, reserved since invalid
View Full Code Here

TOP

Related Classes of org.jscsi.target.scsi.cdb.ReadCapacityCdb

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.