feat(ecstore): enforce local disk topology guardrails and expose device ids (#2679)

This commit is contained in:
houseme
2026-04-25 14:02:02 +08:00
committed by GitHub
parent 80413e0f8e
commit 1e9c75a201
12 changed files with 506 additions and 10 deletions
+12
View File
@@ -93,6 +93,18 @@ pub fn same_disk(disk1: &str, disk2: &str) -> std::io::Result<bool> {
Ok(stat1.st_dev == stat2.st_dev)
}
pub fn get_physical_device_ids(disk: &str) -> std::io::Result<Vec<String>> {
let stat = rustix::fs::stat(disk)?;
let major = rustix::fs::major(stat.st_dev);
let minor = rustix::fs::minor(stat.st_dev);
Ok(vec![format!("{major}:{minor}")])
}
pub fn check_cross_device_mounts(_paths: &[String]) -> std::io::Result<()> {
Ok(())
}
#[cfg(not(target_os = "linux"))]
pub fn get_drive_stats(_major: u32, _minor: u32) -> std::io::Result<IOStats> {
Ok(IOStats::default())