From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox Backup Server development discussion
<pbs-devel@lists.proxmox.com>,
Dominik Csapak <d.csapak@proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup 1/2] tape: refactor uuid of empty media set into constant
Date: Tue, 29 Nov 2022 13:03:32 +0100 [thread overview]
Message-ID: <905b8db3-60a7-1746-bf66-597096a706b8@proxmox.com> (raw)
In-Reply-To: <20221129105127.1969525-1-d.csapak@proxmox.com>
Am 29/11/2022 um 11:51 schrieb Dominik Csapak:
> so that we have a easily recognizable name for it and can see
> instantly what it does
>
> make the 'let is_empty' unnecessary as it's clear now what the check is
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> src/api2/tape/drive.rs | 8 ++++----
> src/api2/tape/media.rs | 5 ++---
> src/tape/inventory.rs | 16 +++++++++-------
> src/tape/media_pool.rs | 4 ++--
> 4 files changed, 17 insertions(+), 16 deletions(-)
>
> diff --git a/src/api2/tape/drive.rs b/src/api2/tape/drive.rs
> index 107bcfd8..4bb9ade9 100644
> --- a/src/api2/tape/drive.rs
> +++ b/src/api2/tape/drive.rs
> @@ -42,7 +42,7 @@ use crate::{
> },
> file_formats::{MediaLabel, MediaSetLabel},
> lock_media_pool, lock_media_set, lock_unassigned_media_pool, Inventory, MediaCatalog,
> - MediaId, TAPE_STATUS_DIR,
> + MediaId, EMPTY_MEDIA_SET_UUID, TAPE_STATUS_DIR,
> },
> };
>
> @@ -528,7 +528,7 @@ fn write_media_label(
> label.label_text,
> pool
> );
> - let set = MediaSetLabel::with_data(pool, [0u8; 16].into(), 0, label.ctime, None);
> + let set = MediaSetLabel::with_data(pool, EMPTY_MEDIA_SET_UUID.into(), 0, label.ctime, None);
>
> drive.write_media_set_label(&set, None)?;
>
> @@ -575,7 +575,7 @@ fn write_media_label(
> if let Some(ref pool) = pool {
> match info.media_set_label {
> Some(set) => {
> - if set.uuid != [0u8; 16].into() {
> + if set.uuid != EMPTY_MEDIA_SET_UUID.into() {
Did not looked to closely, but why not impl a method on MediaSetLabel instead,
avoiding leaking out of that internal detail in the first place?
prev parent reply other threads:[~2022-11-29 12:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-29 10:51 Dominik Csapak
2022-11-29 10:51 ` [pbs-devel] [PATCH proxmox-backup 2/2] tape: inventory: skip empty tapes Dominik Csapak
2022-11-29 12:03 ` Thomas Lamprecht [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=905b8db3-60a7-1746-bf66-597096a706b8@proxmox.com \
--to=t.lamprecht@proxmox.com \
--cc=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