[pbs-devel] [PATCH vma-to-pbs 3/4] replace hard coded values with constants

Filip Schauer f.schauer at proxmox.com
Wed Jul 24 18:18:55 CEST 2024


Signed-off-by: Filip Schauer <f.schauer at proxmox.com>
---
 src/vma.rs     | 2 +-
 src/vma2pbs.rs | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/vma.rs b/src/vma.rs
index 518de8a..63ee3b5 100644
--- a/src/vma.rs
+++ b/src/vma.rs
@@ -22,7 +22,7 @@ const VMA_MAX_CONFIGS: usize = 256;
 
 /// Maximum number of block devices
 /// See VMA Header in pve-qemu.git/vma_spec.txt
-const VMA_MAX_DEVICES: usize = 256;
+pub const VMA_MAX_DEVICES: usize = 256;
 
 /// VMA magic string
 /// See VMA Header in pve-qemu.git/vma_spec.txt
diff --git a/src/vma2pbs.rs b/src/vma2pbs.rs
index 3e9689d..5c0d03f 100644
--- a/src/vma2pbs.rs
+++ b/src/vma2pbs.rs
@@ -175,11 +175,12 @@ where
 fn register_block_devices<T>(
     vma_reader: &VmaReader<T>,
     pbs: *mut ProxmoxBackupHandle,
-) -> Result<[Option<BlockDeviceInfo>; 256], Error>
+) -> Result<[Option<BlockDeviceInfo>; VMA_MAX_DEVICES], Error>
 where
     T: Read,
 {
-    let mut block_device_infos: [Option<BlockDeviceInfo>; 256] = [None; 256];
+    let mut block_device_infos: [Option<BlockDeviceInfo>; VMA_MAX_DEVICES] =
+        [None; VMA_MAX_DEVICES];
     let mut pbs_err: *mut c_char = ptr::null_mut();
 
     for device_id in 0..255 {
-- 
2.39.2





More information about the pbs-devel mailing list