public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 1/4] tape: use correct MAM attribute definitions
Date: Thu, 30 Mar 2023 13:28:42 +0200	[thread overview]
Message-ID: <20230330112845.2620964-1-d.csapak@proxmox.com> (raw)

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>
---
 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





             reply	other threads:[~2023-03-30 11:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30 11:28 Dominik Csapak [this message]
2023-03-30 11:28 ` [pbs-devel] [PATCH proxmox-backup 2/4] tape: continue without MAM media_usage page Dominik Csapak
2023-04-20 12:19   ` [pbs-devel] applied " Dietmar Maurer
2023-03-30 11:28 ` [pbs-devel] [PATCH proxmox-backup 3/4] tape: implement 6 byte fallback for MODE SENSE/SELECT Dominik Csapak
2023-03-30 13:38   ` Dominik Csapak
2023-03-30 11:28 ` [pbs-devel] [PATCH proxmox-backup 4/4] tape: typo fixes Dominik Csapak
2023-04-20 12:18 ` [pbs-devel] applied [PATCH proxmox-backup 1/4] tape: use correct MAM attribute definitions Dietmar Maurer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230330112845.2620964-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal