From 6cf1f83029f57f5dd4c3a6de3e79e481393df5bd Mon Sep 17 00:00:00 2001 From: pgosar Date: Thu, 24 Apr 2025 16:40:30 -0500 Subject: [PATCH 1/2] add ds store to gitignore --- .gitignore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 3f6b1d10..1b9259f6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,6 @@ *.img *.txt -*zig* - /target + +.DS_Store From 4b721e2c42fdd649011f3d6c6ba0705779b7ccd1 Mon Sep 17 00:00:00 2001 From: pgosar Date: Thu, 24 Apr 2025 16:46:10 -0500 Subject: [PATCH 2/2] Fix clippy' --- kernel/src/filesys/ext2/mod.rs | 24 ++++++++++++------------ kernel/src/ipc/error.rs | 2 +- kernel/src/ipc/mount_manager.rs | 2 +- kernel/src/memory/paging.rs | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/kernel/src/filesys/ext2/mod.rs b/kernel/src/filesys/ext2/mod.rs index 3cb010a2..cdc7834b 100644 --- a/kernel/src/filesys/ext2/mod.rs +++ b/kernel/src/filesys/ext2/mod.rs @@ -270,20 +270,20 @@ mod tests { ]; for name in names.iter() { - let path = format!("/{}", name); + let path = format!("/{name}"); fs.create_file(&path, mode).await.unwrap(); let node = fs.get_node(&path).await.unwrap(); assert!(node.is_file()); - let content = format!("Content for {}", name); + let content = format!("Content for {name}"); fs.write_file(&path, content.as_bytes()).await.unwrap(); let read_content = fs.read_file(&path).await.unwrap(); assert_eq!(read_content, content.as_bytes()); } let long_name = "a".repeat(256); - let long_path = format!("/{}", long_name); + let long_path = format!("/{long_name}"); match fs.create_file(&long_path, mode).await { Err(FilesystemError::InvalidPath) | Err(FilesystemError::NodeError(_)) => {} _ => panic!("Expected error for too long filename"), @@ -295,7 +295,7 @@ mod tests { } for name in names.iter() { - let path = format!("/{}", name); + let path = format!("/{name}"); fs.remove(&path).await.unwrap(); } } @@ -310,19 +310,19 @@ mod tests { let depth = 5; for i in 1..=depth { - current_path = format!("{}/dir{}", current_path, i); + current_path = format!("{current_path}/dir{i}"); fs.create_directory(¤t_path, dir_mode).await.unwrap(); - let file_path = format!("{}/file{}.txt", current_path, i); + let file_path = format!("{current_path}/file{i}.txt"); fs.create_file(&file_path, file_mode).await.unwrap(); - let content = format!("Content for level {}", i); + let content = format!("Content for level {i}"); fs.write_file(&file_path, content.as_bytes()).await.unwrap(); } - let deepest_file = format!("{}/file{}.txt", current_path, depth); + let deepest_file = format!("{current_path}/file{depth}.txt"); let content = fs.read_file(&deepest_file).await.unwrap(); - assert_eq!(content, format!("Content for level {}", depth).as_bytes()); + assert_eq!(content, format!("Content for level {depth}").as_bytes()); for i in (1..=3).rev() { let dir_path = if i == 1 { @@ -337,7 +337,7 @@ mod tests { if i < depth { assert!(entries.iter().any(|e| e.name == format!("dir{}", i + 1))); } - assert!(entries.iter().any(|e| e.name == format!("file{}.txt", i))); + assert!(entries.iter().any(|e| e.name == format!("file{i}.txt"))); } for i in (1..=depth).rev() { @@ -346,12 +346,12 @@ mod tests { } else { let mut path = String::from("/dir1"); for j in 2..=i { - path = format!("{}/dir{}", path, j); + path = format!("{path}/dir{j}"); } path }; - let file_path = format!("{}/file{}.txt", dir_path, i); + let file_path = format!("{dir_path}/file{i}.txt"); fs.remove(&file_path).await.unwrap(); if i > 1 { diff --git a/kernel/src/ipc/error.rs b/kernel/src/ipc/error.rs index 69688f00..5b5bede0 100644 --- a/kernel/src/ipc/error.rs +++ b/kernel/src/ipc/error.rs @@ -23,7 +23,7 @@ impl core::fmt::Display for ProtocolError { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { ProtocolError::MessageTooLarge => write!(f, "Message too large"), - ProtocolError::InvalidMessageType(t) => write!(f, "Invalid message type: {}", t), + ProtocolError::InvalidMessageType(t) => write!(f, "Invalid message type: {t}"), ProtocolError::BufferTooSmall => write!(f, "Buffer too small"), ProtocolError::InvalidQid => write!(f, "Invalid Qid size (must be 13 bytes)"), ProtocolError::VersionTooLong => write!(f, "Version string too long"), diff --git a/kernel/src/ipc/mount_manager.rs b/kernel/src/ipc/mount_manager.rs index 17b2c27e..8e68fc9c 100644 --- a/kernel/src/ipc/mount_manager.rs +++ b/kernel/src/ipc/mount_manager.rs @@ -47,7 +47,7 @@ impl Mount { } } Err(e) => { - log::error!("Failed to parse message: {:?}", e); + log::error!("Failed to parse message: {e}"); continue; } }, diff --git a/kernel/src/memory/paging.rs b/kernel/src/memory/paging.rs index 433f4f66..f976a894 100644 --- a/kernel/src/memory/paging.rs +++ b/kernel/src/memory/paging.rs @@ -644,7 +644,7 @@ mod tests { let buf_ptr = page.start_address().as_ptr::(); for i in 1..PAGE_SIZE { let val = *buf_ptr.add(i); - assert_eq!(val, 1, "Byte at offset {} is not 1 (found {})", i, val); + assert_eq!(val, 1, "Byte at offset {i} is not 1 (found {val})"); } }