tape: add vendor, product and revision to LtoDriveAndMediaStatus
This commit is contained in:
@ -139,6 +139,9 @@ impl LtoTapeHandle {
|
||||
.ok();
|
||||
|
||||
let mut status = LtoDriveAndMediaStatus {
|
||||
vendor: self.sg_tape.info().vendor.clone(),
|
||||
product: self.sg_tape.info().product.clone(),
|
||||
revision: self.sg_tape.info().revision.clone(),
|
||||
blocksize: drive_status.block_length,
|
||||
compression: drive_status.compression,
|
||||
buffer_mode: drive_status.buffer_mode,
|
||||
|
@ -96,6 +96,7 @@ pub struct LtoTapeStatus {
|
||||
|
||||
pub struct SgTape {
|
||||
file: File,
|
||||
info: InquiryInfo,
|
||||
}
|
||||
|
||||
impl SgTape {
|
||||
@ -112,14 +113,18 @@ impl SgTape {
|
||||
if info.peripheral_type != 1 {
|
||||
bail!("not a tape device (peripheral_type = {})", info.peripheral_type);
|
||||
}
|
||||
Ok(Self { file })
|
||||
Ok(Self { file, info })
|
||||
}
|
||||
|
||||
// fixme: remove - only for testing
|
||||
/// Access to file descriptor - useful for testing
|
||||
pub fn file_mut(&mut self) -> &mut File {
|
||||
&mut self.file
|
||||
}
|
||||
|
||||
pub fn info(&self) -> &InquiryInfo {
|
||||
&self.info
|
||||
}
|
||||
|
||||
pub fn open<P: AsRef<Path>>(path: P) -> Result<SgTape, Error> {
|
||||
// do not wait for media, use O_NONBLOCK
|
||||
let file = OpenOptions::new()
|
||||
|
Reference in New Issue
Block a user