tape: pmt - re-implement fsr/bsr

This commit is contained in:
Dietmar Maurer 2021-04-07 11:50:09 +02:00
parent 0892a512bc
commit 7f7459677d
2 changed files with 12 additions and 7 deletions

View File

@ -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(())
}

View File

@ -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)
}