[pbs-devel] applied: [PATCH proxmox-backup 2/4] tape: changer: sg_pt: add SCSI_VOLUME_TAG_LEN const

Dietmar Maurer dietmar at proxmox.com
Wed Jul 21 17:02:01 CEST 2021


applied

On 7/21/21 4:04 PM, Dominik Csapak wrote:
> so that we do have less 'magic' constants without description
>
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>   src/tape/changer/sg_pt_changer.rs | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/tape/changer/sg_pt_changer.rs b/src/tape/changer/sg_pt_changer.rs
> index f4154ced..908311b0 100644
> --- a/src/tape/changer/sg_pt_changer.rs
> +++ b/src/tape/changer/sg_pt_changer.rs
> @@ -33,6 +33,7 @@ use crate::{
>   };
>   
>   const SCSI_CHANGER_DEFAULT_TIMEOUT: usize = 60*5; // 5 minutes
> +const SCSI_VOLUME_TAG_LEN: usize = 36;
>   
>   /// Initialize element status (Inventory)
>   pub fn initialize_element_status<F: AsRawFd>(file: &mut F) -> Result<(), Error> {
> @@ -509,7 +510,7 @@ impl SubHeader {
>       ) -> Result<Option<String>, Error> {
>   
>           if (self.flags & 128) != 0 { // has PVolTag
> -            let tmp = reader.read_exact_allocated(36)?;
> +            let tmp = reader.read_exact_allocated(SCSI_VOLUME_TAG_LEN)?;
>               if full {
>                   let volume_tag = scsi_ascii_to_string(&tmp);
>                   return Ok(Some(volume_tag));
> @@ -526,7 +527,7 @@ impl SubHeader {
>       ) -> Result<Option<String>, Error> {
>   
>           if (self.flags & 64) != 0 { // has AVolTag
> -            let _tmp = reader.read_exact_allocated(36)?;
> +            let _tmp = reader.read_exact_allocated(SCSI_VOLUME_TAG_LEN)?;
>           }
>   
>           Ok(None)





More information about the pbs-devel mailing list