1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// SPDX-License-Identifier: AGPL-3.0-or-later
// Copyright (C) 2012-2025 Andrei Maltsev
/// Build a padded 16-byte **SCSI READ(10)** CDB.
///
/// Parameters:
/// - `cdb` : output buffer (will be zeroed; only 10 bytes are used, we keep
/// 16 for alignment)
/// - `lba` : 32-bit Logical Block Address to start reading from
/// - `blocks` : number of logical blocks to transfer (big-endian, 0 =>
/// **65,536** blocks)
/// - `flags` : RDPROTECT[7:5] | DPO[4] | FUA[3] (other bits must be zero)
/// - `control` : CONTROL byte
///
/// Layout (SBC):
/// - byte 0 : OPERATION CODE = 0x28
/// - byte 1 : flags (masked to RDPROTECT/DPO/FUA)
/// - bytes 2..5 : LBA (big-endian, 32-bit)
/// - byte 6 : GROUP NUMBER (low 5 bits) — leave 0 unless you need it
/// - bytes 7..8 : TRANSFER LENGTH (big-endian, 16-bit; **0 => 65,536 blocks**)
/// - byte 9 : CONTROL
/// Build a 16-byte **SCSI READ(16)** CDB.
///
/// Parameters:
/// - `cdb` : output buffer (will be zeroed; full 16 bytes used)
/// - `lba` : 64-bit Logical Block Address
/// - `blocks` : number of logical blocks to transfer (big-endian, 32-bit; **0
/// => 0 blocks**)
/// - `flags` : RDPROTECT[7:5] | DPO[4] | FUA[3] (other bits must be zero)
/// - `control` : CONTROL byte
///
/// Layout (SBC):
/// - byte 0 : OPERATION CODE = 0x88
/// - byte 1 : flags (masked to RDPROTECT/DPO/FUA)
/// - bytes 2..9 : LBA (big-endian, 64-bit)
/// - bytes 10..13 : TRANSFER LENGTH (big-endian, 32-bit; **0 => 0 blocks**)
/// - byte 14 : GROUP NUMBER (low 5 bits) — leave 0 unless you need it
/// - byte 15 : CONTROL