Files
qdrant/lib/common/memory/build.rs
T
20e58d50e9 check filesystem on start (#6682)
* check filesystem on start and do some simple mmap test to make sure it is persisted

* fmt

* fix fs type read on non-linux

* feature-flag for fs-check supported platforms + fs check with sub-folder

* fmt

* try larger magic file

* minor fixes

* fix compile on windows

* Add FAT, exFAT and APFS file systems

* Update lib/common/memory/src/checkfs.rs

Co-authored-by: Tim Visée <tim+github@visee.me>

---------

Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: Tim Visée <tim+github@visee.me>
2025-07-17 13:10:15 +02:00

35 lines
1.1 KiB
Rust

fn main() {
println!("cargo:rustc-check-cfg=cfg(posix_fadvise_supported)");
// Matches all platforms that have `nix::fcntl::posix_fadvise` function.
// https://github.com/nix-rust/nix/blob/v0.29.0/src/fcntl.rs#L35-L42
if matches!(
std::env::var("CARGO_CFG_TARGET_OS").unwrap().as_str(),
"linux" | "freebsd" | "android" | "fuchsia" | "emscripten" | "wasi"
) || matches!(
std::env::var("CARGO_CFG_TARGET_ENV").unwrap().as_str(),
"uclibc"
) {
println!("cargo:rustc-cfg=posix_fadvise_supported")
}
println!("cargo:rustc-check-cfg=cfg(fs_type_check_supported)");
// Matches all platforms, that have `nix::sys::statfs::statfs` function.
// https://github.com/nix-rust/nix/blob/v0.29.0/src/sys/mod.rs#L131
if matches!(
std::env::var("CARGO_CFG_TARGET_OS").unwrap().as_str(),
"linux"
| "freebsd"
| "android"
| "openbsd"
| "ios"
| "macos"
| "watchos"
| "tvos"
| "visionos"
) {
println!("cargo:rustc-cfg=fs_type_check_supported")
}
}