Skip to content

Commit 815810d

Browse files
Johan-Liebert1cgwalters
authored andcommitted
kargs: Update kargs computing function name
Rename the function `kargs_from_composefs_filesystem` to `compute_new_kargs` as it now has nothing to do with composefs Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
1 parent b017a9b commit 815810d

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

crates/lib/src/bootc_composefs/boot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ use rustix::{mount::MountFlags, path::Arg};
9696
use schemars::JsonSchema;
9797
use serde::{Deserialize, Serialize};
9898

99-
use crate::bootc_kargs::kargs_from_composefs_filesystem;
99+
use crate::bootc_kargs::compute_new_kargs;
100100
use crate::composefs_consts::{TYPE1_ENT_PATH, TYPE1_ENT_PATH_STAGED};
101101
use crate::parsers::bls_config::{BLSConfig, BLSConfigType};
102102
use crate::parsers::grub_menuconfig::MenuEntry;
@@ -564,7 +564,7 @@ pub(crate) fn setup_composefs_bls_boot(
564564
None
565565
};
566566

567-
kargs_from_composefs_filesystem(mounted_erofs, current_root, &mut cmdline_refs)?;
567+
compute_new_kargs(mounted_erofs, current_root, &mut cmdline_refs)?;
568568

569569
let (entry_paths, _tmpdir_guard) = match bootloader {
570570
Bootloader::Grub => {

crates/lib/src/bootc_kargs.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,22 @@ fn compute_apply_kargs_diff(
7373
}
7474
}
7575

76-
/// Looks for files in usr/lib/bootc/kargs.d and parses cmdline agruments
77-
pub(crate) fn kargs_from_composefs_filesystem(
76+
/// Computes new kernel arguments by applying the diff between existing and new kargs.d files.
77+
///
78+
/// This function:
79+
/// 1. Loads kernel arguments from `usr/lib/bootc/kargs.d` in the new filesystem
80+
/// 2. Loads kernel arguments from the current root (if present)
81+
/// 3. Computes the difference between them (added/removed arguments)
82+
/// 4. Applies that difference to the provided `new_kargs` cmdline
83+
///
84+
/// This allows bootc to maintain user customizations while applying changes from
85+
/// updated container images.
86+
///
87+
/// # Arguments
88+
/// * `new_fs` - Directory handle to the new filesystem containing kargs.d files
89+
/// * `current_root` - Optional directory handle to current root filesystem
90+
/// * `new_kargs` - Mutable cmdline that will be modified with the computed diff
91+
pub(crate) fn compute_new_kargs(
7892
new_fs: &Dir,
7993
current_root: Option<&Dir>,
8094
new_kargs: &mut Cmdline,

0 commit comments

Comments
 (0)