From 6fa3ab297fbaf39425bc1dbdef9779ecdbe2df02 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Thu, 30 Mar 2023 13:28:42 +0200 Subject: [PATCH] tape: use correct MAM attribute definitions 080Ch: it's binary not ascii, and the length is not specified (hp says 23-n bytes) 0820h and 0821h are also binary and not ascii Signed-off-by: Dominik Csapak --- pbs-tape/src/sg_tape/mam.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pbs-tape/src/sg_tape/mam.rs b/pbs-tape/src/sg_tape/mam.rs index 634b5a29..b1b4d59a 100644 --- a/pbs-tape/src/sg_tape/mam.rs +++ b/pbs-tape/src/sg_tape/mam.rs @@ -133,20 +133,20 @@ static MAM_ATTRIBUTES: &[(u16, u16, MamFormat, &str)] = &[ (0x08_0B, 16, MamFormat::ASCII, "Application Format Version"), ( 0x08_0C, - 50, - MamFormat::ASCII, + 0, // length is not specified for IBM, and HP says 23-n + MamFormat::BINARY, "Volume Coherency Information", ), ( 0x08_20, 36, - MamFormat::ASCII, + MamFormat::BINARY, "Medium Globally Unique Identifier", ), ( 0x08_21, 36, - MamFormat::ASCII, + MamFormat::BINARY, "Media Pool Globally Unique Identifier", ), ( @@ -238,7 +238,7 @@ fn decode_mam_attributes(data: &[u8]) -> Result, Error> { }; if let Some(info) = MAM_ATTRIBUTE_NAMES.get(&head_id) { - if info.1 == head.len { + if info.1 == 0 || info.1 == head.len { let value = match info.2 { MamFormat::ASCII => String::from_utf8_lossy(&data).to_string(), MamFormat::DEC => {