5
0
mirror of git://git.proxmox.com/git/proxmox-backup.git synced 2025-03-07 00:58:32 +03:00

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 <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2023-03-30 13:28:42 +02:00 committed by Dietmar Maurer
parent 42018aeae5
commit 6fa3ab297f

View File

@ -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 => {