Update to ONDK r29.5

This commit is contained in:
topjohnwu
2026-02-06 16:32:25 -08:00
committed by John Wu
parent e872fafd8b
commit 9ee6a6b3d7
21 changed files with 114 additions and 97 deletions
-1
View File
@@ -1,4 +1,3 @@
#![feature(try_blocks)]
#![allow(clippy::missing_safety_doc)]
use logging::setup_klog;
+4 -3
View File
@@ -17,7 +17,7 @@ unsafe extern "C" {
}
pub(crate) fn switch_root(path: &Utf8CStr) {
let res: LoggedResult<()> = try {
|| -> LoggedResult<()> {
debug!("Switch root to {}", path);
let mut mounts = BTreeSet::new();
let rootfs = Directory::open(cstr!("/"))?;
@@ -48,8 +48,9 @@ pub(crate) fn switch_root(path: &Utf8CStr) {
debug!("Cleaning rootfs");
rootfs.remove_all()?;
};
res.ok();
Ok(())
}()
.ok();
}
pub(crate) fn is_device_mounted(dev: u64, target: Pin<&mut CxxString>) -> bool {
+3 -2
View File
@@ -28,7 +28,7 @@ pub(crate) fn hexpatch_init_for_second_stage(writable: bool) {
// If we cannot directly modify /init, we need to bind mount a replacement on top of it
let src = cstr!("/init");
let dest = cstr!("/data/init");
let _: LoggedResult<()> = try {
let _ = || -> LoggedResult<()> {
{
let mut fd = dest.create(OFlag::O_CREAT | OFlag::O_WRONLY, 0)?;
fd.write_all(init.as_ref())?;
@@ -36,7 +36,8 @@ pub(crate) fn hexpatch_init_for_second_stage(writable: bool) {
let attr = src.follow_link().get_attr()?;
dest.set_attr(&attr)?;
dest.bind_mount_to(src, false)?;
};
Ok(())
}();
}
}