refactor: group modules by data-flow stage behind a thin main

This commit is contained in:
Willem Vanhulle committed 2026-10-21 12:12:49 +02:00
1 parent f9cc94c633
commit 2191a27b82
38 files changed
+104 -88

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
use std::os::fd::OwnedFd;
use rustix::{
fs::{Mode, OFlags, open},
io::Errno,
process::{chdir, chroot, fchdir},
};
const SYSROOT: &str = "/sysroot";
pub const INITRD_RELEASE: &str = "/etc/initrd-release";
pub struct Sysroot {
directory: OwnedFd,
}
impl Sysroot {
pub fn hold() -> Result<Self, Errno> {
let directory = open(
SYSROOT,
OFlags::DIRECTORY | OFlags::RDONLY | OFlags::CLOEXEC,
Mode::empty(),
)?;
Ok(Self { directory })
}
pub fn enter(&self) -> Result<(), Errno> {
fchdir(&self.directory)?;
chroot(".")?;
chdir("/")
}
}