Lock down Platform trait: pub(crate), only init/set_read_speed/is_ready

Platform trait is no longer publicly exported. External code uses
DriveSession only — cannot call unlock, load_firmware, calibrate directly.

- Platform trait: pub(crate) with 3 methods only
- All handlers are private methods on Mt1959
- DriveStatus moved to mt1959 internal struct
- init() has guard: no re-init if already ready
- set_read_speed() has guard: no-op if not calibrated
- Removed open_unlocked() — open() is the only entry
- Removed Platform and DriveStatus from public exports

Prevents: out-of-sequence SCSI commands, double-init, wrong firmware writes.
This commit is contained in:
MattJackson
2026-04-08 21:41:57 -07:00
parent 0b19154bd3
commit 6456e24bb5
4 changed files with 61 additions and 87 deletions
+4 -4
View File
@@ -14,7 +14,7 @@ use crate::error::{Error, Result};
use crate::scsi::ScsiTransport;
use crate::identity::DriveId;
use crate::profile::{self, DriveProfile, Chipset};
use crate::platform::{Platform, DriveStatus};
use crate::platform::Platform;
use crate::platform::mt1959::Mt1959;
/// A drive session with identification, platform, and SCSI transport.
@@ -116,9 +116,9 @@ impl DriveSession {
self.platform.init(self.scsi.as_mut())
}
/// Check if raw disc access mode is active.
pub fn is_unlocked(&self) -> bool {
self.platform.is_unlocked()
/// Check if drive is initialized and ready for reads.
pub fn is_ready(&self) -> bool {
self.platform.is_ready()
}
/// Called per zone change during content reads.