tape: implement binding for libsgutils2

So that we can read cartridge memory without calling "sg_raw". In future,
we may need further low level command to control the tape..
This commit is contained in:
Dietmar Maurer
2020-12-23 09:44:53 +01:00
parent 4799280ccd
commit dbe7e556b0
7 changed files with 218 additions and 23 deletions

View File

@ -48,7 +48,6 @@ use crate::{
mtx_load,
mtx_unload,
linux_tape_device_list,
read_mam_attributes,
open_drive,
media_changer,
update_changer_online_status,
@ -793,8 +792,10 @@ pub fn cartridge_memory(drive: String) -> Result<Vec<MamAttribute>, Error> {
let (config, _digest) = config::drive::config()?;
let drive_config: LinuxTapeDrive = config.lookup("linux", &drive)?;
let mut handle = drive_config.open()
.map_err(|err| format_err!("open drive '{}' ({}) failed - {}", drive, drive_config.path, err))?;
read_mam_attributes(&drive_config.path)
handle.cartridge_memory()
}
#[api(