tape: add pmt asf

This commit is contained in:
Dietmar Maurer 2021-02-01 10:32:21 +01:00
parent e995996290
commit 85ef624440

View File

@ -98,6 +98,39 @@ fn get_tape_handle(param: &Value) -> Result<LinuxTapeHandle, Error> {
bail!("no drive/device specified"); bail!("no drive/device specified");
} }
#[api(
input: {
properties: {
drive: {
schema: DRIVE_NAME_SCHEMA,
optional: true,
},
device: {
schema: LINUX_DRIVE_PATH_SCHEMA,
optional: true,
},
count: {
schema: FILE_MARK_COUNT_SCHEMA,
},
},
},
)]
/// Position the tape at the beginning of the count file.
///
/// Positioning is done by first rewinding the tape and then spacing
/// forward over count file marks.
fn asf(count: i32, param: Value) -> Result<(), Error> {
let mut handle = get_tape_handle(&param)?;
handle.rewind()?;
handle.forward_space_count_files(count)?;
Ok(())
}
#[api( #[api(
input: { input: {
properties: { properties: {
@ -574,6 +607,7 @@ fn main() -> Result<(), Error> {
}; };
let cmd_def = CliCommandMap::new() let cmd_def = CliCommandMap::new()
.insert("asf", std_cmd(&API_METHOD_ASF).arg_param(&["count"]))
.insert("bsf", std_cmd(&API_METHOD_BSF).arg_param(&["count"])) .insert("bsf", std_cmd(&API_METHOD_BSF).arg_param(&["count"]))
.insert("bsfm", std_cmd(&API_METHOD_BSFM).arg_param(&["count"])) .insert("bsfm", std_cmd(&API_METHOD_BSFM).arg_param(&["count"]))
.insert("cartridge-memory", std_cmd(&API_METHOD_CARTRIDGE_MEMORY)) .insert("cartridge-memory", std_cmd(&API_METHOD_CARTRIDGE_MEMORY))