View Javadoc

1   package org.jscsi.target.scsi.cdb;
2   
3   /**
4    * If the {@link FormatUnitCDB#formatData} bit is set to one, then the DEFECT LIST FORMAT field specifies the format of
5    * the address descriptors in the defect list.
6    * <p>
7    * The DEFECT LIST FORMAT field has a length of 3 bits.
8    * 
9    * @author Andreas Ergenzinger
10   */
11  public enum DefectListFormat {
12      SHORT_BLOCK((byte) 0), LONG_BLOCK((byte) 3), BYTES_FROM_INDEX((byte) 4), PHYSICAL_SECTOR((byte) 5), VENDOR_SPECIFIC((byte) 6);
13      // all other values are RESERVED
14  
15      private final byte value;
16  
17      private DefectListFormat (byte value) {
18          this.value = value;
19      }
20  
21      public byte getValue () {
22          return value;
23      }
24  
25      public static DefectListFormat valueOf (int value) {
26          DefectListFormat[] values = values();
27          for (int i = 0; i < values.length; ++i)
28              if (values[i].getValue() == value) return values[i];
29          return null;
30      }
31  }