tape: status - show thape alert flags
This commit is contained in:
parent
5c012b392a
commit
470f1c798a
@ -179,6 +179,9 @@ pub struct LinuxDriveAndMediaStatus {
|
||||
pub density: Option<TapeDensity>,
|
||||
/// Status flags
|
||||
pub status: String,
|
||||
/// Tape Alert Flags
|
||||
#[serde(skip_serializing_if="Option::is_none")]
|
||||
pub alert_flags: Option<String>,
|
||||
/// Current file number
|
||||
#[serde(skip_serializing_if="Option::is_none")]
|
||||
pub file_number: Option<u32>,
|
||||
|
@ -592,6 +592,7 @@ fn status(
|
||||
.column(ColumnConfig::new("blocksize"))
|
||||
.column(ColumnConfig::new("density"))
|
||||
.column(ColumnConfig::new("status"))
|
||||
.column(ColumnConfig::new("alert-flags"))
|
||||
.column(ColumnConfig::new("file-number"))
|
||||
.column(ColumnConfig::new("block-number"))
|
||||
.column(ColumnConfig::new("manufactured").renderer(render_epoch))
|
||||
|
@ -209,10 +209,15 @@ impl LinuxTapeHandle {
|
||||
|
||||
let drive_status = self.get_drive_status()?;
|
||||
|
||||
let alert_flags = self.tape_alert_flags()
|
||||
.map(|flags| format!("{:?}", flags))
|
||||
.ok();
|
||||
|
||||
let mut status = LinuxDriveAndMediaStatus {
|
||||
blocksize: drive_status.blocksize,
|
||||
density: drive_status.density,
|
||||
status: format!("{:?}", drive_status.status),
|
||||
alert_flags,
|
||||
file_number: drive_status.file_number,
|
||||
block_number: drive_status.block_number,
|
||||
manufactured: None,
|
||||
@ -222,13 +227,14 @@ impl LinuxTapeHandle {
|
||||
|
||||
if drive_status.tape_is_ready() {
|
||||
|
||||
let mam = self.cartridge_memory()?;
|
||||
if let Ok(mam) = self.cartridge_memory() {
|
||||
|
||||
let usage = mam_extract_media_usage(&mam)?;
|
||||
let usage = mam_extract_media_usage(&mam)?;
|
||||
|
||||
status.manufactured = Some(usage.manufactured);
|
||||
status.bytes_read = Some(usage.bytes_read);
|
||||
status.bytes_written = Some(usage.bytes_written);
|
||||
status.manufactured = Some(usage.manufactured);
|
||||
status.bytes_read = Some(usage.bytes_read);
|
||||
status.bytes_written = Some(usage.bytes_written);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(status)
|
||||
|
Loading…
Reference in New Issue
Block a user