[pbs-devel] [PATCH proxmox-backup 1/4] tape: use correct MAM attribute definitions

Dominik Csapak d.csapak at proxmox.com
Thu Mar 30 13:28:42 CEST 2023


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 <d.csapak at proxmox.com>
---
 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<Vec<MamAttribute>, 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 => {
-- 
2.30.2






More information about the pbs-devel mailing list