ksud: Add more logs

This commit is contained in:
weishu
2024-02-29 22:43:48 +08:00
parent 6de330b00a
commit 2a4fa94af0

View File

@@ -55,8 +55,13 @@ impl Drop for AutoMountExt4 {
#[cfg(any(target_os = "linux", target_os = "android"))] #[cfg(any(target_os = "linux", target_os = "android"))]
pub fn mount_ext4(source: impl AsRef<Path>, target: impl AsRef<Path>) -> Result<()> { pub fn mount_ext4(source: impl AsRef<Path>, target: impl AsRef<Path>) -> Result<()> {
let new_loopback = loopdev::LoopControl::open()?.next_free()?; let new_loopback = loopdev::LoopControl::open()?
new_loopback.with().attach(source)?; .next_free()
.with_context(|| "Failed to alloc loop")?;
new_loopback
.with()
.attach(source)
.with_context(|| "Failed to attach loop")?;
let lo = new_loopback.path().ok_or(anyhow!("no loop"))?; let lo = new_loopback.path().ok_or(anyhow!("no loop"))?;
if let Result::Ok(fs) = fsopen("ext4", FsOpenFlags::FSOPEN_CLOEXEC) { if let Result::Ok(fs) = fsopen("ext4", FsOpenFlags::FSOPEN_CLOEXEC) {
let fs = fs.as_fd(); let fs = fs.as_fd();