| 1 | |
package org.jscsi.target.scsi.cdb; |
| 2 | |
|
| 3 | |
|
| 4 | |
import java.nio.ByteBuffer; |
| 5 | |
|
| 6 | |
import org.jscsi.target.util.BitManip; |
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
public class ReadCapacity16Cdb extends ReadCapacityCdb { |
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
private static final byte SERVICE_ACTION = 0x10; |
| 20 | |
|
| 21 | |
|
| 22 | |
|
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | |
private final byte serviceAction; |
| 27 | |
|
| 28 | |
public ReadCapacity16Cdb (ByteBuffer buffer) { |
| 29 | 0 | super(buffer); |
| 30 | |
|
| 31 | 0 | serviceAction = (byte) (buffer.get(1) & 31); |
| 32 | 0 | if (serviceAction != SERVICE_ACTION) addIllegalFieldPointer(1, 4); |
| 33 | 0 | } |
| 34 | |
|
| 35 | |
@Override |
| 36 | |
protected long deserializeLogicalBlockAddress (ByteBuffer buffer) { |
| 37 | 0 | return buffer.getLong(2); |
| 38 | |
} |
| 39 | |
|
| 40 | |
@Override |
| 41 | |
protected boolean deserializePartialMediumIndicator (ByteBuffer buffer) { |
| 42 | 0 | return BitManip.getBit(buffer.get(14), |
| 43 | |
0); |
| 44 | |
} |
| 45 | |
|
| 46 | |
public byte getServiceAction () { |
| 47 | 0 | return serviceAction; |
| 48 | |
} |
| 49 | |
} |