@@ -25,6 +25,7 @@
pub(crate) mod alloc_helper;
pub(crate) mod data;
+pub(crate) mod devices;
pub(crate) mod errnos;
pub(crate) mod inode;
pub(crate) mod superblock;
new file mode 100644
@@ -0,0 +1,28 @@
+// Copyright 2024 Yiyang Wu
+// SPDX-License-Identifier: MIT or GPL-2.0-or-later
+
+use alloc::vec::Vec;
+
+/// Device specification.
+#[derive(Copy, Clone, Debug)]
+pub(crate) struct DeviceSpec {
+ pub(crate) tags: [u8; 64],
+ pub(crate) blocks: u32,
+ pub(crate) mapped_blocks: u32,
+}
+
+/// Device slot.
+#[derive(Copy, Clone, Debug)]
+#[repr(C)]
+pub(crate) struct DeviceSlot {
+ tags: [u8; 64],
+ blocks: u32,
+ mapped_blocks: u32,
+ reserved: [u8; 56],
+}
+
+/// Device information.
+pub(crate) struct DeviceInfo {
+ pub(crate) mask: u16,
+ pub(crate) specs: Vec<DeviceSpec>,
+}
This patch introduce device data structure in Rust. It can later support chunk based block maps. Signed-off-by: Yiyang Wu <toolmanp@tlmp.cc> --- fs/erofs/rust/erofs_sys.rs | 1 + fs/erofs/rust/erofs_sys/devices.rs | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 fs/erofs/rust/erofs_sys/devices.rs