From b636b43c475f59961c86dac0539d4a03640de909 Mon Sep 17 00:00:00 2001 From: Johan-Liebert1 Date: Fri, 29 Aug 2025 15:42:26 +0530 Subject: [PATCH] initramfs: Convert to library Create a lib.rs as we'd like to utilize these functions elsewhere in the codebase Signed-off-by: Johan-Liebert1 --- crates/initramfs/src/{mount.rs => lib.rs} | 7 ++++--- crates/initramfs/src/main.rs | 4 +--- 2 files changed, 5 insertions(+), 6 deletions(-) rename crates/initramfs/src/{mount.rs => lib.rs} (98%) diff --git a/crates/initramfs/src/mount.rs b/crates/initramfs/src/lib.rs similarity index 98% rename from crates/initramfs/src/mount.rs rename to crates/initramfs/src/lib.rs index 5dea8c9d5..005917f4b 100644 --- a/crates/initramfs/src/mount.rs +++ b/crates/initramfs/src/lib.rs @@ -102,8 +102,8 @@ pub struct Args { pub target: Option, } -// Helpers -fn mount_at_wrapper( +/// Wrapper around [`composefs::mount::mount_at`] +pub fn mount_at_wrapper( fs_fd: impl AsFd, dirfd: impl AsFd, path: impl path::Arg + Debug + Clone, @@ -242,7 +242,8 @@ fn mount_subdir( } #[context("GPT workaround")] -pub(crate) fn gpt_workaround() -> Result<()> { +/// Workaround for /dev/gpt-auto-root +pub fn gpt_workaround() -> Result<()> { // https://github.com/systemd/systemd/issues/35017 let rootdev = stat("/dev/gpt-auto-root"); diff --git a/crates/initramfs/src/main.rs b/crates/initramfs/src/main.rs index 088c57a5a..ebe266a8e 100644 --- a/crates/initramfs/src/main.rs +++ b/crates/initramfs/src/main.rs @@ -1,12 +1,10 @@ //! Code for bootc that goes into the initramfs. // SPDX-License-Identifier: Apache-2.0 OR MIT -mod mount; - use anyhow::Result; +use bootc_initramfs_setup::{gpt_workaround, setup_root, Args}; use clap::Parser; -use mount::{gpt_workaround, setup_root, Args}; fn main() -> Result<()> { let args = Args::parse();