From 6de330b00ae8f5214aec6c01c837b2fe63642075 Mon Sep 17 00:00:00 2001 From: weishu Date: Thu, 29 Feb 2024 22:40:42 +0800 Subject: [PATCH] ksud: Add some logs --- userspace/ksud/src/module.rs | 15 ++++++--------- userspace/ksud/src/utils.rs | 7 +++++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/userspace/ksud/src/module.rs b/userspace/ksud/src/module.rs index 900c931d..75d16e4a 100644 --- a/userspace/ksud/src/module.rs +++ b/userspace/ksud/src/module.rs @@ -391,16 +391,13 @@ fn _install_module(zip: &str) -> Result<()> { println!("- Legacy image, migrating to new format, please be patient..."); create_module_image(tmp_module_img, sparse_image_size, journal_size)?; let _dontdrop = - mount::AutoMountExt4::try_new(tmp_module_img, module_update_tmp_dir, true)?; - utils::copy_module_files(defs::MODULE_DIR, module_update_tmp_dir)?; + mount::AutoMountExt4::try_new(tmp_module_img, module_update_tmp_dir, true) + .with_context(|| format!("Failed to mount {tmp_module_img}"))?; + utils::copy_module_files(defs::MODULE_DIR, module_update_tmp_dir) + .with_context(|| "Failed to migrate module files".to_string())?; } else { - utils::copy_sparse_file(modules_img, tmp_module_img, true).with_context(|| { - format!( - "Failed to copy {} to {}", - modules_img.display(), - tmp_module_img - ) - })?; + utils::copy_sparse_file(modules_img, tmp_module_img, true) + .with_context(|| "Failed to copy module image".to_string())?; } } diff --git a/userspace/ksud/src/utils.rs b/userspace/ksud/src/utils.rs index dace68ef..51b48b3a 100644 --- a/userspace/ksud/src/utils.rs +++ b/userspace/ksud/src/utils.rs @@ -260,8 +260,11 @@ fn copy_xattrs(src_path: impl AsRef, dest_path: impl AsRef) -> Resul xattr.to_string_lossy(), value.to_string_lossy(), ); - extattr::lsetxattr(dest_path.as_ref(), &xattr, &value, extattr::Flags::empty()) - .with_context(|| format!("Failed to set xattr for {:?}", dest_path.as_ref()))?; + if let Err(e) = + extattr::lsetxattr(dest_path.as_ref(), &xattr, &value, extattr::Flags::empty()) + { + log::warn!("Failed to set xattr: {}", e); + } } Ok(()) }