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

Method require_single_root

crates/blockdev/src/blockdev.rs:410–419  ·  view source on GitHub ↗

Walk the parent chain to find all root (whole disk) devices, and fail if more than one root is found. This is a convenience wrapper around `find_all_roots` for callers that expect exactly one backing device (e.g. non-RAID setups).

(&self)

Source from the content-addressed store, hash-verified

408 /// This is a convenience wrapper around `find_all_roots` for callers
409 /// that expect exactly one backing device (e.g. non-RAID setups).
410 pub fn require_single_root(&self) -> Result<Device> {
411 let mut roots = self.find_all_roots()?;
412 match roots.len() {
413 1 => Ok(roots.remove(0)),
414 n => anyhow::bail!(
415 "Expected a single root device for {}, but found {n}",
416 self.path()
417 ),
418 }
419 }
420
421 /// Walk the parent chain to find all root (whole disk) devices.
422 ///

Callers 3

install_via_bootupdFunction · 0.80
install_with_sysrootFunction · 0.80
setup_composefs_bootFunction · 0.80

Calls 2

find_all_rootsMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected