tape: add vendor, product and revision to LtoDriveAndMediaStatus
This commit is contained in:
parent
80ea23e1b9
commit
15d1435789
1
debian/control
vendored
1
debian/control
vendored
@ -15,6 +15,7 @@ Build-Depends: debhelper (>= 11),
|
||||
librust-crossbeam-channel-0.5+default-dev,
|
||||
librust-endian-trait-0.6+arrays-dev,
|
||||
librust-endian-trait-0.6+default-dev,
|
||||
librust-flate2-1+default-dev,
|
||||
librust-futures-0.3+default-dev,
|
||||
librust-h2-0.3+default-dev,
|
||||
librust-h2-0.3+stream-dev,
|
||||
|
@ -174,6 +174,12 @@ impl TryFrom<u8> for TapeDensity {
|
||||
/// Media related data is optional - only set if there is a medium
|
||||
/// loaded.
|
||||
pub struct LtoDriveAndMediaStatus {
|
||||
/// Vendor
|
||||
pub vendor: String,
|
||||
/// Product
|
||||
pub product: String,
|
||||
/// Revision
|
||||
pub revision: String,
|
||||
/// Block size (0 is variable size)
|
||||
pub blocksize: u32,
|
||||
/// Compression enabled
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user