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().map_or(true, |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 if path.starts_with("/System") && !path.starts_with("/System/Volumes/Data") {
33 return true;
34 }
35 if path.starts_with("/Library/Developer") {
36 return true;
37 }
38 false
39}
40
41#[cfg(target_os = "linux")]
42fn is_system_path(path: &Path) -> bool {
43 path.starts_with("/boot")
44}
45
46#[cfg(target_os = "windows")]
47fn is_system_path(_path: &Path) -> bool {
48 false
49}