flail/ext/
block.rs

1use super::*;
2
3pub struct ExtBlock(pub(crate) libe2fs_sys::blk64_t);
4
5impl ExtBlock {
6    pub fn num(&self) -> u64 {
7        self.0
8    }
9}
10
11#[derive(Clone)]
12pub struct ExtBlockBitmap(pub(crate) libe2fs_sys::ext2fs_block_bitmap);
13
14impl ExtBitmap for ExtBlockBitmap {
15    fn is_32bit(&self) -> bool {
16        let bitmap = unsafe { *self.0 };
17        bitmap.magic == libe2fs_sys::EXT2_ET_MAGIC_GENERIC_BITMAP.into()
18            || bitmap.magic == libe2fs_sys::EXT2_ET_MAGIC_INODE_BITMAP.into()
19            || bitmap.magic == libe2fs_sys::EXT2_ET_MAGIC_BLOCK_BITMAP.into()
20    }
21
22    fn is_64bit(&self) -> bool {
23        let bitmap = unsafe { *self.0 };
24        bitmap.magic == libe2fs_sys::EXT2_ET_MAGIC_GENERIC_BITMAP64.into()
25            || bitmap.magic == libe2fs_sys::EXT2_ET_MAGIC_INODE_BITMAP64.into()
26            || bitmap.magic == libe2fs_sys::EXT2_ET_MAGIC_BLOCK_BITMAP64.into()
27    }
28}