Coverage Report - org.jscsi.target.connection.stage.fullfeature.ReadOrWriteStage
 
Classes in this File Line Coverage Branch Coverage Complexity
ReadOrWriteStage
0%
0/7
0%
0/4
2
 
 1  
 package org.jscsi.target.connection.stage.fullfeature;
 2  
 
 3  
 
 4  
 import org.jscsi.target.connection.phase.TargetFullFeaturePhase;
 5  
 import org.jscsi.target.scsi.cdb.CommandDescriptorBlock;
 6  
 import org.jscsi.target.scsi.cdb.ReadOrWriteCdb;
 7  
 import org.jscsi.target.scsi.sense.senseDataDescriptor.senseKeySpecific.FieldPointerSenseKeySpecificData;
 8  
 
 9  
 
 10  
 /**
 11  
  * This is an abstract superclass for stages that handle PDUs with command descriptor blocks of the
 12  
  * {@link ReadOrWriteCdb} class.
 13  
  * 
 14  
  * @author Andreas Ergenzinger
 15  
  */
 16  
 public abstract class ReadOrWriteStage extends TargetFullFeatureStage {
 17  
 
 18  
     public ReadOrWriteStage (TargetFullFeaturePhase targetFullFeaturePhase) {
 19  0
         super(targetFullFeaturePhase);
 20  0
     }
 21  
 
 22  
     /**
 23  
      * Checks if the <code>LOGICAL BLOCK ADDRESS</code> and <code>TRANSFER
 24  
      * LENGTH</code> fields in the passed {@link ReadOrWriteCdb} are acceptable. If illegal values are detected, an
 25  
      * instance of {@link FieldPointerSenseKeySpecificData} describing the problem will be added to the
 26  
      * {@link ReadOrWriteCdb}'s queue-
 27  
      * 
 28  
      * @param cdb a read or write command descriptor block to check
 29  
      * @see CommandDescriptorBlock#getIllegalFieldPointers()
 30  
      */
 31  
     protected void checkOverAndUnderflow (final ReadOrWriteCdb cdb) {
 32  
         // check if requested blocks are out of bounds
 33  0
         final int boundsCheck = session.getStorageModule().checkBounds(cdb.getLogicalBlockAddress(), cdb.getTransferLength());
 34  
         // add illegal field pointer, or not
 35  0
         if (boundsCheck == 1)
 36  0
             cdb.addIllegalFieldPointerForLogicalBlockAddress();
 37  0
         else if (boundsCheck == 2) cdb.addIllegalFieldPointerForTransferLength();
 38  0
     }
 39  
 
 40  
 }