From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 2/2] tape: mam: set the text localization identifier to utf-8
Date: Thu, 23 May 2024 09:37:09 +0200 [thread overview]
Message-ID: <20240523073709.1696815-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20240523073709.1696815-1-d.csapak@proxmox.com>
while we currently only write ascii into the relevant fields,
make it more future proof and set the encoding to utf-8
that way we can't accidentally write utf-8 while the encoding is set to
something different
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
pbs-tape/src/sg_tape/mam.rs | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/pbs-tape/src/sg_tape/mam.rs b/pbs-tape/src/sg_tape/mam.rs
index bc055a28..3890150f 100644
--- a/pbs-tape/src/sg_tape/mam.rs
+++ b/pbs-tape/src/sg_tape/mam.rs
@@ -122,7 +122,7 @@ enum HostAttributes {
ApplicationVersion = 0x08_02,
UserMediumTextLabel = 0x08_03,
//LastWritten = 0x08_04,
- //TextLocalizationIdentifier = 0x08_05,
+ TextLocalizationIdentifier = 0x08_05,
//Barcode = 0x08_06,
//OwningHostTextualName = 0x08_07,
MediaPool = 0x08_08,
@@ -143,6 +143,7 @@ impl HostAttributes {
Some(pbs_buildcfg::PROXMOX_BACKUP_CRATE_VERSION.as_bytes())
}
HostAttributes::UserMediumTextLabel => None,
+ HostAttributes::TextLocalizationIdentifier => Some(&[0x81]), // utf-8
HostAttributes::MediaPool => None,
}
}
@@ -153,6 +154,7 @@ static ATTRIBUTES_TO_WRITE: &[HostAttributes] = &[
HostAttributes::ApplicationVendor,
HostAttributes::ApplicationName,
HostAttributes::ApplicationVersion,
+ HostAttributes::TextLocalizationIdentifier,
HostAttributes::UserMediumTextLabel,
HostAttributes::MediaPool,
];
@@ -167,7 +169,8 @@ pub(crate) fn create_attribute_list_to_write<'a>(
let value = match attr {
HostAttributes::ApplicationVendor
| HostAttributes::ApplicationName
- | HostAttributes::ApplicationVersion => attr.value(),
+ | HostAttributes::ApplicationVersion
+ | HostAttributes::TextLocalizationIdentifier => attr.value(),
HostAttributes::UserMediumTextLabel => label.map(|label| label.as_bytes()),
HostAttributes::MediaPool => pool.map(|pool| pool.as_bytes()),
};
--
2.39.2
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
prev parent reply other threads:[~2024-05-23 7:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-23 7:37 [pbs-devel] [PATCH proxmox-backup 1/2] tape: mam: make sure attributes to write/clear don't diverge Dominik Csapak
2024-05-23 7:37 ` Dominik Csapak [this message]
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=20240523073709.1696815-2-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal