MCPcopy Create free account
hub / github.com/bootc-dev/bootc / have_udev

Function have_udev

crates/blockdev/src/blockdev.rs:24–35  ·  view source on GitHub ↗

Check whether the udev database is accessible (cached for the process lifetime). When running inside a container or sandbox without `/run/udev` bind-mounted, tools like `lsblk` that depend on the udev database will return null for fields like `parttype` and `fstype`. We check for `/run/udev/data` (the actual database directory) rather than just `/run/udev` because the parent directory can exist

()

Source from the content-addressed store, hash-verified

22/// than just `/run/udev` because the parent directory can exist as an
23/// empty mount point without the database being populated.
24fn have_udev() -> bool {
25 static HAVE_UDEV: OnceLock<bool> = OnceLock::new();
26 *HAVE_UDEV.get_or_init(|| {
27 let r = Path::new("/run/udev/data").exists();
28 if !r {
29 tracing::debug!(
30 "udev database not available, will use blkid -p for partition metadata"
31 );
32 }
33 r
34 })
35}
36
37/// Probe a device with `blkid -p` and return all discovered properties
38/// as key-value pairs.

Callers 1

backfill_missingMethod · 0.85

Calls 1

existsMethod · 0.80

Tested by

no test coverage detected