This parses a bootc kargs.d toml file, returning the resulting vector of kernel arguments. Architecture matching is performed using `sys_arch`.
(contents: &str, sys_arch: &str)
| 244 | /// vector of kernel arguments. Architecture matching is performed using |
| 245 | /// `sys_arch`. |
| 246 | fn parse_kargs_toml(contents: &str, sys_arch: &str) -> Result<Option<CmdlineOwned>> { |
| 247 | let de: Config = toml::from_str(contents)?; |
| 248 | // if arch specified, apply kargs only if the arch matches |
| 249 | // if arch not specified, apply kargs unconditionally |
| 250 | let matched = de |
| 251 | .match_architectures |
| 252 | .map(|arches| arches.iter().any(|s| s == sys_arch)) |
| 253 | .unwrap_or(true); |
| 254 | let r = if matched { |
| 255 | Some(Cmdline::from(de.kargs.join(" "))) |
| 256 | } else { |
| 257 | None |
| 258 | }; |
| 259 | Ok(r) |
| 260 | } |
| 261 | |
| 262 | #[cfg(test)] |
| 263 | mod tests { |