1use {
2 lfs_core::Mount,
3 std::path::Path,
4};
5
6pub fn is_normal(m: &Mount) -> bool {
9 (
10 m.stats().is_some()
11 || m.is_unreachable()
12 )
13 && (
14 m.disk.is_some() || m.info.fs_type == "zfs" || m.is_remote()
17 )
18 && m.disk.as_ref().is_none_or(|d| !d.image) && !m.info.bound && m.info.fs_type != "squashfs" && !is_system_path(&m.info.mount_point)
22}
23
24#[cfg(target_os = "macos")]
25fn is_system_path(path: &Path) -> bool {
26 let Some(path) = path.to_str() else {
27 return false;
28 };
29 if path == "/" {
30 return true;
31 }
32 path.starts_with("/System") && !path.starts_with("/System/Volumes/Data")
33}
34
35#[cfg(target_os = "linux")]
36fn is_system_path(path: &Path) -> bool {
37 path.starts_with("/boot")
38}
39
40#[cfg(target_os = "windows")]
41fn is_system_path(_path: &Path) -> bool {
42 false
43}