From 1a3f7ce676088c2fea891490ee2b4e222827ae61 Mon Sep 17 00:00:00 2001 From: MattJackson <1085847+MattJackson@users.noreply.github.com> Date: Tue, 28 Apr 2026 17:56:42 -0700 Subject: [PATCH] remove unused reset() --- src/scsi/linux.rs | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/src/scsi/linux.rs b/src/scsi/linux.rs index aa13e06..eae9861 100644 --- a/src/scsi/linux.rs +++ b/src/scsi/linux.rs @@ -107,47 +107,6 @@ impl SgIoTransport { /// against the LG BU40N (Initio USB-SATA bridge); both failed to /// recover wedged drives and made the wedge worse — see /// `(internal)/postmortems/2026-04-25-bu40n-wedge-recovery.md`. - /// If the drive is genuinely unresponsive, the next workload command - /// fails naturally and the caller surfaces a "physical reconnect - /// required" prompt. Software has no path back from a wedged Initio - /// bridge — only physical replug clears it. - pub fn reset(device: &Path) -> Result<()> { - let c_path = Self::to_c_path(device); - - // open + close — make the kernel cancel any SG_IO commands queued - // against a previous fd that didn't close cleanly. - let probe_fd = unsafe { - libc::open( - c_path.as_ptr() as *const libc::c_char, - libc::O_RDWR | libc::O_NONBLOCK | libc::O_CLOEXEC, - ) - }; - if probe_fd >= 0 { - unsafe { libc::close(probe_fd) }; - } - - // Let the kernel finish that cancellation before we reopen. - std::thread::sleep(std::time::Duration::from_secs(2)); - - // Fresh fd just to send the unlock command, then close. - let fd = unsafe { - libc::open( - c_path.as_ptr() as *const libc::c_char, - libc::O_RDWR | libc::O_NONBLOCK | libc::O_CLOEXEC, - ) - }; - if fd < 0 { - return Self::open_error(device); - } - - // ALLOW MEDIUM REMOVAL — clear any tray lock left by a killed - // process whose Drop never ran. Best-effort; ignore result. - let _ = Self::raw_command(fd, &[0x1E, 0, 0, 0, 0, 0], 3_000); - - unsafe { libc::close(fd) }; - Ok(()) - } - fn open_error(device: &Path) -> Result { let err = std::io::Error::last_os_error(); Err(if err.kind() == std::io::ErrorKind::PermissionDenied {