From 74fcb9d505be4d015dac7ba98d4f6a8e4f5643cd Mon Sep 17 00:00:00 2001 From: Ming-Hung Tsai Date: Thu, 25 Feb 2021 18:14:01 +0800 Subject: [PATCH] [cache (rust)] Fix data types --- src/cache/xml.rs | 8 ++++---- tests/common/cache_xml_generator.rs | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/cache/xml.rs b/src/cache/xml.rs index d39b057..2cf2e12 100644 --- a/src/cache/xml.rs +++ b/src/cache/xml.rs @@ -11,22 +11,22 @@ use quick_xml::Writer; #[derive(Clone)] pub struct Superblock { pub uuid: String, - pub block_size: u64, - pub nr_cache_blocks: u64, + pub block_size: u32, + pub nr_cache_blocks: u32, pub policy: String, pub hint_width: u32, } #[derive(Clone)] pub struct Map { - pub cblock: u64, + pub cblock: u32, pub oblock: u64, pub dirty: bool, } #[derive(Clone)] pub struct Hint { - pub cblock: u64, + pub cblock: u32, pub data: Vec, } diff --git a/tests/common/cache_xml_generator.rs b/tests/common/cache_xml_generator.rs index d9e558e..68672e2 100644 --- a/tests/common/cache_xml_generator.rs +++ b/tests/common/cache_xml_generator.rs @@ -24,8 +24,8 @@ pub fn write_xml(path: &Path, g: &mut dyn XmlGen) -> Result<()> { } pub struct CacheGen { - block_size: u64, - nr_cache_blocks: u64, + block_size: u32, + nr_cache_blocks: u32, nr_origin_blocks: u64, percent_resident: u8, percent_dirty: u8, @@ -33,8 +33,8 @@ pub struct CacheGen { impl CacheGen { pub fn new( - block_size: u64, - nr_cache_blocks: u64, + block_size: u32, + nr_cache_blocks: u32, nr_origin_blocks: u64, percent_resident: u8, percent_dirty: u8, @@ -67,7 +67,7 @@ impl XmlGen for CacheGen { v.mappings_b()?; { - let nr_resident = (self.nr_cache_blocks * 100 as u64) / (self.percent_resident as u64); + let nr_resident = (self.nr_cache_blocks * 100 as u32) / (self.percent_resident as u32); let mut used = HashSet::new(); for n in 0..nr_resident { let mut oblock = 0u64;