From 6638c034d247e53209ec3374893c7898b1885d9b Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Sun, 10 Jan 2021 16:20:18 +0100 Subject: [PATCH] tape: remove unused eject_on_unload method --- src/api2/tape/drive.rs | 4 ---- src/tape/changer/mod.rs | 9 +-------- src/tape/changer/mtx.rs | 4 ---- src/tape/drive/virtual_tape.rs | 8 -------- 4 files changed, 1 insertion(+), 24 deletions(-) diff --git a/src/api2/tape/drive.rs b/src/api2/tape/drive.rs index 4d9e9065..410f1607 100644 --- a/src/api2/tape/drive.rs +++ b/src/api2/tape/drive.rs @@ -300,10 +300,6 @@ pub async fn eject_media(drive: String) -> Result<(), Error> { tokio::task::spawn_blocking(move || { if let Some((mut changer, _)) = media_changer(&config, &drive)? { - if !changer.eject_on_unload() { - let mut drive = open_drive(&config, &drive)?; - drive.eject_media()?; - } changer.unload_media(None)?; } else { let mut drive = open_drive(&config, &drive)?; diff --git a/src/tape/changer/mod.rs b/src/tape/changer/mod.rs index 7bcf56ca..04565b18 100644 --- a/src/tape/changer/mod.rs +++ b/src/tape/changer/mod.rs @@ -94,16 +94,9 @@ pub trait MediaChange { self.load_media_from_slot(slot as u64) } - /// Unload media from drive - /// - /// This is a nop on drives without autoloader. + /// Unload media from drive (eject media if necessary) fn unload_media(&mut self, target_slot: Option) -> Result<(), Error>; - /// Returns true if unload_media automatically ejects drive media - fn eject_on_unload(&self) -> bool { - false - } - /// List online media changer IDs (barcodes) /// /// List acessible (online) changer IDs. This does not include diff --git a/src/tape/changer/mtx.rs b/src/tape/changer/mtx.rs index 79e12bb1..8964217d 100644 --- a/src/tape/changer/mtx.rs +++ b/src/tape/changer/mtx.rs @@ -69,8 +69,4 @@ impl MediaChange for MtxMediaChanger { self.unload_to_free_slot(status) } } - - fn eject_on_unload(&self) -> bool { - true - } } diff --git a/src/tape/drive/virtual_tape.rs b/src/tape/drive/virtual_tape.rs index 2c4c121d..750fcd3c 100644 --- a/src/tape/drive/virtual_tape.rs +++ b/src/tape/drive/virtual_tape.rs @@ -454,10 +454,6 @@ impl MediaChange for VirtualTapeHandle { Ok(()) } - fn eject_on_unload(&self) -> bool { - true - } - fn clean_drive(&mut self) -> Result<(), Error> { Ok(()) } @@ -504,10 +500,6 @@ impl MediaChange for VirtualTapeDrive { Ok(()) } - fn eject_on_unload(&self) -> bool { - true - } - fn online_media_changer_ids(&mut self) -> Result, Error> { let handle = self.open()?; handle.online_media_changer_ids()