Add scan_iso entry point for file-backed ISO scans

Introduce libfreemkv::scan_iso(path, opts) -> (Disc, Box<dyn SectorSource>),
the file-backed counterpart to DiscSession::scan. It is the single place
that opens a FileSectorSource, reads its capacity, and runs Disc::scan_image,
returning the scanned Disc plus a reusable reader over the same image so
consumers stop hand-rolling that triple.

Add an integration test that materialises a minimal synthetic UDF image to a
real file, asserts scan_iso matches the manual open+scan_image composition,
and confirms the returned reader is still usable (capacity + sector read).
Also covers open-failure and scan-failure error propagation.
This commit is contained in:
Matthew Jackson
2026-07-23 23:48:50 -07:00
parent 7ed798e386
commit 6f53767e8b
3 changed files with 213 additions and 3 deletions
+1 -1
View File
@@ -146,7 +146,7 @@ pub use drive::{Drive, DriveStatus, find_drive};
// stop hand-rolling `open → wait_ready → init → probe_disc → identify → scan`.
// Owns the `Drive` by value; forwards consumer-built key material into
// `ScanOptions` (the library derives no certs — see `KeySpec`).
pub use session::{DeviceTarget, DiscSession, KeySpec};
pub use session::{DeviceTarget, DiscSession, KeySpec, scan_iso};
// ─── Errors ─────────────────────────────────────────────────────────────────
//