From 62a0e190cb9e44eb0d53010626cce357ebc8a50e Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Wed, 21 Jul 2021 16:04:49 +0200 Subject: [PATCH] tape: changer: sg_pt: add SCSI_VOLUME_TAG_LEN const so that we do have less 'magic' constants without description Signed-off-by: Dominik Csapak --- 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(file: &mut F) -> Result<(), Error> { @@ -509,7 +510,7 @@ impl SubHeader { ) -> Result, 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, 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)