From 7086caaddf78632e32296315ac7e03594feffa05 Mon Sep 17 00:00:00 2001 From: Alex Lyn Date: Wed, 20 May 2026 17:41:26 +0800 Subject: [PATCH] kata-agent: Remove unused mode field from MkdirDirective As previous unused codes are with attribute of dead_code which actually are never used, we'd better remove them totally. It will remove the mode field from MkdirDirective structure and also remove its relavent test cases. Signed-off-by: Alex Lyn --- src/agent/src/storage/multi_layer_erofs.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/agent/src/storage/multi_layer_erofs.rs b/src/agent/src/storage/multi_layer_erofs.rs index 2195bdfcd7..920141d5c7 100644 --- a/src/agent/src/storage/multi_layer_erofs.rs +++ b/src/agent/src/storage/multi_layer_erofs.rs @@ -59,11 +59,9 @@ pub struct MultiLayerErofsResult { pub temp_mount_points: Vec, } -#[allow(dead_code)] #[derive(Debug)] struct MkdirDirective { raw_path: String, - mode: Option, } #[async_trait::async_trait] @@ -407,7 +405,6 @@ fn parse_mkdir_directive(spec: &str) -> Result { Ok(MkdirDirective { raw_path: raw_path.to_string(), - mode: parts.get(1).map(|s| s.to_string()), }) } @@ -604,21 +601,19 @@ mod tests { // --- parse_mkdir_directive --- #[rstest] - #[case("some/path", true, "some/path", None)] - #[case("some/path:0755", true, "some/path", Some("0755"))] - #[case("path:mode:extra", true, "path", Some("mode:extra"))] - #[case("", false, "", None)] + #[case("some/path", true, "some/path")] + #[case("some/path:0755", true, "some/path")] + #[case("path:mode:extra", true, "path")] + #[case("", false, "")] fn test_parse_mkdir_directive( #[case] spec: &str, #[case] should_pass: bool, #[case] expected_path: &str, - #[case] expected_mode: Option<&str>, ) { let result = parse_mkdir_directive(spec); if should_pass { let d = result.expect("expected Ok"); assert_eq!(d.raw_path, expected_path); - assert_eq!(d.mode.as_deref(), expected_mode); } else { assert!(result.is_err(), "expected Err for spec {:?}", spec); }