[pbs-devel] [PATCH 10/11] tape: pmt - re-implement fsr/bsr

Dietmar Maurer dietmar at proxmox.com
Wed Apr 7 12:23:07 CEST 2021


---
 src/bin/pmt.rs            | 11 ++++-------
 src/tape/drive/lto/mod.rs |  8 ++++++++
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/bin/pmt.rs b/src/bin/pmt.rs
index 854364c7..7183dfe5 100644
--- a/src/bin/pmt.rs
+++ b/src/bin/pmt.rs
@@ -229,13 +229,11 @@ fn bsfm(count: usize, param: Value) -> Result<(), Error> {
     },
 )]
 /// Backward space records.
-fn bsr(count: i32, param: Value) -> Result<(), Error> {
+fn bsr(count: usize, param: Value) -> Result<(), Error> {
 
     let mut handle = get_tape_handle(&param)?;
 
-    unimplemented!();
-
-    // fixme: handle.mtop(MTCmd::MTBSR, count, "backward space records")?;
+    handle.backward_space_count_records(count)?;
 
     Ok(())
 }
@@ -526,12 +524,11 @@ fn fsfm(count: usize, param: Value) -> Result<(), Error> {
     },
 )]
 /// Forward space records.
-fn fsr(count: i32, param: Value) -> Result<(), Error> {
+fn fsr(count: usize, param: Value) -> Result<(), Error> {
 
     let mut handle = get_tape_handle(&param)?;
 
-    unimplemented!();
-    // fixme: handle.mtop(MTCmd::MTFSR, count, "forward space records")?;
+    handle.forward_space_count_records(count)?;
 
     Ok(())
 }
diff --git a/src/tape/drive/lto/mod.rs b/src/tape/drive/lto/mod.rs
index c9f3bf93..f33049ab 100644
--- a/src/tape/drive/lto/mod.rs
+++ b/src/tape/drive/lto/mod.rs
@@ -195,6 +195,14 @@ impl LtoTapeHandle {
         self.sg_tape.space_filemarks(-isize::try_from(count)?)
     }
 
+    pub fn forward_space_count_records(&mut self, count: usize) -> Result<(), Error> {
+        self.sg_tape.space_blocks(isize::try_from(count)?)
+    }
+
+    pub fn backward_space_count_records(&mut self, count: usize) -> Result<(), Error> {
+        self.sg_tape.space_blocks(-isize::try_from(count)?)
+    }
+
     pub fn erase_media(&mut self, fast: bool) -> Result<(), Error> {
         self.sg_tape.erase_media(fast)
     }
-- 
2.20.1





More information about the pbs-devel mailing list