mirror of
				https://git.proxmox.com/git/proxmox-backup
				synced 2025-11-02 15:18:42 +00:00 
			
		
		
		
	backup: use static assertion in fixed index reader
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
		
							parent
							
								
									34a3845b01
								
							
						
					
					
						commit
						ccdf3ad1ec
					
				@ -30,6 +30,7 @@ pub struct FixedIndexHeader {
 | 
			
		||||
    pub chunk_size: u64,
 | 
			
		||||
    reserved: [u8; 4016], // overall size is one page (4096 bytes)
 | 
			
		||||
}
 | 
			
		||||
proxmox::tools::static_assert_size!(FixedIndexHeader, 4096);
 | 
			
		||||
 | 
			
		||||
// split image into fixed size chunks
 | 
			
		||||
 | 
			
		||||
@ -77,9 +78,6 @@ impl FixedIndexReader {
 | 
			
		||||
 | 
			
		||||
        let header_size = std::mem::size_of::<FixedIndexHeader>();
 | 
			
		||||
 | 
			
		||||
        // todo: use static assertion when available in rust
 | 
			
		||||
        if header_size != 4096 { bail!("got unexpected header size"); }
 | 
			
		||||
 | 
			
		||||
        let mut buffer = vec![0u8; header_size];
 | 
			
		||||
        file.read_exact(&mut buffer)?;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user