Skip to main content

ComposefsCmdline

Enum ComposefsCmdline 

Source
pub enum ComposefsCmdline<ObjectID: FsVerityHashValue> {
    V2 {
        digest: ObjectID,
        insecure: bool,
    },
    V1 {
        digest: ObjectID,
        insecure: bool,
    },
}
Expand description

A composefs kernel argument identifying which EROFS image to mount at boot.

Two variants exist to distinguish EROFS format versions:

  • ComposefsCmdline::V2: V2 EROFS — either composefs=<digest> (legacy shorthand) or composefs.digest=v2-<hash>-<lg>:<digest> (explicit form)
  • ComposefsCmdline::V1: V1 EROFS — composefs.digest=v1-<hash>-<lg>:<digest>

The initramfs checks for composefs.digest= first (accepting both v1 and v2 descriptors), then falls back to the legacy composefs= shorthand. Multiple composefs.digest= entries may appear on the cmdline (different format/algorithm combinations); the initramfs tries each in order, mounting the first image that exists.

NOTE: The equivalent parsing logic in bootc’s crates/initramfs/src/lib.rs must be kept in sync with this file manually, since bootc does not yet depend on composefs-boot directly.

Variants§

§

V2

V2 EROFS image: embedded as composefs=<hex-digest> in the UKI cmdline.

The insecure flag, when true, means the digest is prefixed with ? (e.g. composefs=?<hex>), making fs-verity verification optional.

Fields

§digest: ObjectID

The fs-verity hash of the EROFS image.

§insecure: bool

If true, a ? prefix is added to the digest, making fs-verity verification optional at boot.

§

V1

V1 EROFS image: embedded as composefs.digest=v1-<hash>-<lg>:<hex-digest> in the UKI cmdline.

The value encodes the algorithm, e.g. composefs.digest=v1-sha256-12:<hex> or composefs.digest=v1-sha512-12:<hex>.

The insecure flag, when true, means the value is prefixed with ? (e.g. composefs.digest=?v1-sha512-12:<hex>), making fs-verity verification optional.

Fields

§digest: ObjectID

The fs-verity hash of the EROFS image.

§insecure: bool

If true, a ? prefix is added before the format descriptor in the value, making fs-verity verification optional at boot.

Implementations§

Source§

impl<ObjectID: FsVerityHashValue> ComposefsCmdline<ObjectID>

Source

pub fn digest(&self) -> &ObjectID

Returns a reference to the hex digest, regardless of variant.

Useful for looking up the image in composefs/images/<digest>.

Source

pub fn validate_digest<'a>( &self, acceptable: impl IntoIterator<Item = &'a ObjectID>, ) -> Result<&ObjectID>
where ObjectID: 'a,

Validates that this UKI cmdline’s digest matches one of the acceptable boot image digests.

With dual V1+V2 EROFS, a single composefs image is stored as two boot EROFS serializations with distinct digests; a UKI is sealed carrying exactly one of them. This accepts the UKI if its digest matches ANY of acceptable. Returns the matched (UKI’s own) digest on success.

Source

pub fn is_insecure(&self) -> bool

Returns whether this karg is in insecure mode (fs-verity verification skipped).

Source

pub fn new_v2(digest: ObjectID, insecure: bool) -> Self

Constructs a V2 cmdline value (composefs=<hex>).

Source

pub fn new_v1(digest: ObjectID, insecure: bool) -> Self

Constructs a V1 cmdline value (composefs.digest=v1-<hash>-<lg>:<hex>).

Source

pub fn from_cmdline(cmdline: &str) -> Result<Option<Self>>

Parses a ComposefsCmdline from a kernel command line string.

Scans for composefs.digest= tokens first (→ ComposefsCmdline::V1). Multiple such tokens may appear on the cmdline (different algorithms); the first one whose format descriptor matches the ObjectID algorithm is returned. Then falls back to composefs= (→ ComposefsCmdline::V2). Returns None if no matching token is present.

§Errors

Returns an error if a matching karg is found but the hex digest cannot be parsed for the given ObjectID type.

Source

pub fn to_cmdline_arg(&self) -> String

Renders this value as a kernel command line fragment.

Trait Implementations§

Source§

impl<ObjectID: Clone + FsVerityHashValue> Clone for ComposefsCmdline<ObjectID>

Source§

fn clone(&self) -> ComposefsCmdline<ObjectID>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<ObjectID: Debug + FsVerityHashValue> Debug for ComposefsCmdline<ObjectID>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<ObjectID: Eq + FsVerityHashValue> Eq for ComposefsCmdline<ObjectID>

Source§

impl<ObjectID: PartialEq + FsVerityHashValue> PartialEq for ComposefsCmdline<ObjectID>

Source§

fn eq(&self, other: &ComposefsCmdline<ObjectID>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<ObjectID: PartialEq + FsVerityHashValue> StructuralPartialEq for ComposefsCmdline<ObjectID>

Auto Trait Implementations§

§

impl<ObjectID> Freeze for ComposefsCmdline<ObjectID>
where ObjectID: Freeze,

§

impl<ObjectID> RefUnwindSafe for ComposefsCmdline<ObjectID>
where ObjectID: RefUnwindSafe,

§

impl<ObjectID> Send for ComposefsCmdline<ObjectID>

§

impl<ObjectID> Sync for ComposefsCmdline<ObjectID>

§

impl<ObjectID> Unpin for ComposefsCmdline<ObjectID>

§

impl<ObjectID> UnsafeUnpin for ComposefsCmdline<ObjectID>
where ObjectID: UnsafeUnpin,

§

impl<ObjectID> UnwindSafe for ComposefsCmdline<ObjectID>
where ObjectID: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.