error: add is_disc_level_no_key classifier (re-exported)

Distinguishes a WHOLE-DISC key failure (E_NO_DISC_KEY / E_KEYDB_LOAD /
E_AACS_NO_KEYS -- every title fails identically) from a per-title skippable
stub. The engine's multi-title loop uses it to fail-fast on the first no-key
title instead of iterating all N. Additive.
This commit is contained in:
MattJackson
2026-07-28 12:45:58 -07:00
parent 828f5c0192
commit 17694af625
2 changed files with 16 additions and 1 deletions
+15
View File
@@ -929,6 +929,21 @@ pub fn is_halt(e: &std::io::Error) -> bool {
io_error_code(e) == Some(E_HALTED)
}
/// Whether an [`io::Error`](std::io::Error) is a **disc-level** key failure —
/// the disc as a whole cannot be decrypted, so EVERY title will fail the same
/// way. Distinct from a per-title skippable stub
/// ([`is_skippable_title_stub`]): `E_NO_DISC_KEY` (keydb present but no entry
/// for this disc), `E_KEYDB_LOAD` (no keydb at all), and `E_AACS_NO_KEYS` (no
/// usable AACS key material) are all whole-disc conditions. A multi-title rip
/// loop should stop immediately on this (fail-fast) rather than iterate every
/// title re-printing the same error.
pub fn is_disc_level_no_key(e: &std::io::Error) -> bool {
matches!(
io_error_code(e),
Some(E_NO_DISC_KEY | E_KEYDB_LOAD | E_AACS_NO_KEYS)
)
}
impl Error {
/// Borrow the drive-returned SPC-4 sense triple if this error is a
/// [`Error::ScsiError`] carrying sense data. `None` for any other
+1 -1
View File
@@ -155,7 +155,7 @@ pub use session::{
// All fallible APIs return `Result<T, Error>`. `Error` is a typed enum with a
// numeric `code()`; **no English text in the library** — applications map
// codes to localized messages. See `error.rs` for the full taxonomy.
pub use error::{Error, Result, is_halt, is_skippable_title_stub};
pub use error::{Error, Result, is_disc_level_no_key, is_halt, is_skippable_title_stub};
// ─── Cooperative cancellation ───────────────────────────────────────────────
//