wzcheng99 96d80e339e T2 checkpoint 3: iSCSI PDU framing ported from V2
core/frontend/iscsi/pdu.go
  Port of weed/storage/blockvol/iscsi/pdu.go byte-for-byte on
  the wire format. Constants (opcodes, flags, login stages,
  MaxDataSegmentLength, AHS / data-segment padding rules) are
  preserved. SCSI status byte constants that V2 duplicated into
  pdu.go are NOT repeated here — they live in errors.go / scsi.go
  for this port so there's a single source of truth.

  Also renamed the two SCSI Response PDU helpers that collided
  with our SCSI-layer terminology:
    SCSIStatus()   -> SCSIStatusByte()
    SetSCSIStatus  -> SetSCSIStatusByte
  (SCSIStatus[Byte] here is the byte 3 field of an OpSCSIResp
  PDU, not the handler-layer enum in scsi.go.)

core/frontend/iscsi/pdu_test.go (sw-owned)
  Regression coverage for the wire layer:
    - BHS-only roundtrip (opcode, immediate, LUN, ITT, CmdSN, CDB)
    - Data segment roundtrip with 4-byte padding (5-byte payload
      round-trips through 8-byte on-wire length)
    - AHS roundtrip (multiple-of-4 contract)
    - AHS non-multiple-of-4 rejected at WritePDU
    - Truncated BHS -> ErrPDUTruncated
    - Truncated data segment -> ErrPDUTruncated
    - Oversized (>8 MiB) DSL -> rejected
    - EOF on empty reader -> io.EOF (not wrapped)
    - Login stage CSG/NSG + transit flag roundtrip
    - OpcodeName covers all defined opcodes + unknown fallback

Session + target + login wiring still pending — next checkpoint
will compose PDU + SCSI handler into an in-process iSCSI target
for L1 route tests.

Tests green (no regressions):
  core/frontend/iscsi: 26 tests (errors 4 + boundary 1 + scsi 11 +
                       pdu 10)
  All other packages: unchanged.
2026-04-21 17:26:53 -07:00
Languages
Go 84.6%
Rust 7.8%
Shell 2.7%
templ 1.6%
Java 1%
Other 2%