tape: add pmt fsf
This commit is contained in:
parent
b22c618734
commit
2f2e83c890
@ -224,6 +224,37 @@ fn erase(fast: Option<bool>, param: Value) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[api(
|
||||
input: {
|
||||
properties: {
|
||||
drive: {
|
||||
schema: DRIVE_NAME_SCHEMA,
|
||||
optional: true,
|
||||
},
|
||||
device: {
|
||||
schema: LINUX_DRIVE_PATH_SCHEMA,
|
||||
optional: true,
|
||||
},
|
||||
count: {
|
||||
description: "File mark count.",
|
||||
type: i32,
|
||||
minimum: 1
|
||||
},
|
||||
},
|
||||
},
|
||||
)]
|
||||
/// Forward space count files (position after file mark).
|
||||
///
|
||||
/// The tape is positioned on the first block of the next file.
|
||||
fn fsf(count: i32, param: Value) -> Result<(), Error> {
|
||||
|
||||
let mut handle = get_tape_handle(¶m)?;
|
||||
|
||||
handle.forward_space_count_files(count)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
#[api(
|
||||
input: {
|
||||
@ -429,6 +460,7 @@ fn main() -> Result<(), Error> {
|
||||
.insert("eject", std_cmd(&API_METHOD_EJECT))
|
||||
.insert("eod", std_cmd(&API_METHOD_EOD))
|
||||
.insert("erase", std_cmd(&API_METHOD_ERASE))
|
||||
.insert("fsf", std_cmd(&API_METHOD_FSF))
|
||||
.insert("load", std_cmd(&API_METHOD_LOAD))
|
||||
.insert("rewind", std_cmd(&API_METHOD_REWIND))
|
||||
.insert("scan", CliCommand::new(&API_METHOD_SCAN))
|
||||
|
@ -204,13 +204,15 @@ impl LinuxTapeHandle {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn forward_space_count_files(&mut self, count: i32) -> Result<(), Error> {
|
||||
pub fn forward_space_count_files(&mut self, count: i32) -> Result<(), Error> {
|
||||
|
||||
let cmd = mtop { mt_op: MTCmd::MTFSF, mt_count: count, };
|
||||
|
||||
unsafe {
|
||||
mtioctop(self.file.as_raw_fd(), &cmd)
|
||||
}.map_err(|err| format_err!("tape fsf {} failed - {}", count, err))?;
|
||||
}.map_err(|err| {
|
||||
format_err!("forward space {} files failed - {}", count, err)
|
||||
})?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user