Skip to main content

BootOps

Trait BootOps 

Source
pub trait BootOps<ObjectID: FsVerityHashValue> {
    // Required methods
    fn transform_for_boot(
        &mut self,
        repo: &Repository<ObjectID>,
    ) -> Result<Vec<BootEntry<ObjectID>>>;
    fn transform_for_boot_from_dir(&mut self, rootfs: impl AsFd) -> Result<()>;
}
Expand description

Trait for transforming filesystem images for boot scenarios.

This trait provides functionality to prepare composefs filesystem images for booting by extracting boot resources and applying necessary transformations like SELinux labeling.

Required Methods§

Source

fn transform_for_boot( &mut self, repo: &Repository<ObjectID>, ) -> Result<Vec<BootEntry<ObjectID>>>

Transforms a filesystem image for boot by extracting boot entries and applying SELinux labels.

This method extracts boot resources from the filesystem, empties required top-level directories (/boot, /sysroot), and applies SELinux security contexts.

§Arguments
  • repo - The composefs repository containing filesystem objects
§Returns

A vector of boot entries extracted from the filesystem (Type 1 BLS entries, Type 2 UKIs, etc.)

Source

fn transform_for_boot_from_dir(&mut self, rootfs: impl AsFd) -> Result<()>

Apply boot filesystem transformations using an on-disk directory for file content.

This applies the same filesystem transformations as BootOps::transform_for_boot (emptying /boot and /sysroot, SELinux relabeling) but reads SELinux policy files directly from the on-disk filesystem via a directory fd rather than from the composefs repository.

This does not extract boot entries (Type 1 BLS entries, UKIs, etc.) since those are only needed for writing to the boot partition, not for computing the composefs digest.

§Arguments
  • rootfs - A directory fd pointing to the root of the on-disk filesystem

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<ObjectID: FsVerityHashValue> BootOps<ObjectID> for FileSystem<ObjectID>

Source§

fn transform_for_boot( &mut self, repo: &Repository<ObjectID>, ) -> Result<Vec<BootEntry<ObjectID>>>

Source§

fn transform_for_boot_from_dir(&mut self, rootfs: impl AsFd) -> Result<()>

Implementors§