Browse Source

chore: Upgrade kernel toolchain to 250810 (#1257)

chore: 升级Rust工具链至nightly-2025-08-10

- 更新工作流容器版本至v1.14
- 升级Rust工具链至nightly-2025-08-10
- 更新多个依赖库版本(bitflags、gimli、itertools等)
- 修复代码格式和文档注释
- 优化内存对齐检查使用is_multiple_of()
- 改进错误处理和日志输出
- 移除过时的特性标记和代码

Signed-off-by: longjin <longjin@DragonOS.org>
LoGin 5 days ago
parent
commit
40e92db370
100 changed files with 459 additions and 321 deletions
  1. 8 6
      .github/workflows/makefile.yml
  2. 23 23
      kernel/Cargo.lock
  3. 7 5
      kernel/Cargo.toml
  4. 2 2
      kernel/Makefile
  5. 2 2
      kernel/crates/crc/src/crc64.rs
  6. 0 1
      kernel/crates/klog_types/src/lib.rs
  7. 2 2
      kernel/crates/rust-slabmalloc/src/pages.rs
  8. 1 1
      kernel/crates/rust-slabmalloc/src/sc.rs
  9. 0 1
      kernel/crates/unified-init/src/main.rs
  10. 1 1
      kernel/rust-toolchain.toml
  11. 3 2
      kernel/src/Makefile
  12. 2 2
      kernel/src/arch/loongarch64/asm/boot.rs
  13. 22 2
      kernel/src/arch/loongarch64/init/boot.rs
  14. 2 2
      kernel/src/arch/loongarch64/interrupt/entry.rs
  15. 1 1
      kernel/src/arch/loongarch64/loongarch64-unknown-none.json
  16. 8 5
      kernel/src/arch/riscv64/interrupt/entry.rs
  17. 1 6
      kernel/src/arch/riscv64/pci/pci_host_ecam.rs
  18. 2 2
      kernel/src/arch/riscv64/process/kthread.rs
  19. 2 2
      kernel/src/arch/riscv64/process/mod.rs
  20. 1 1
      kernel/src/arch/riscv64/riscv64gc-unknown-none-elf.json
  21. 2 1
      kernel/src/arch/x86_64/driver/apic/ioapic.rs
  22. 1 1
      kernel/src/arch/x86_64/driver/apic/lapic_vector.rs
  23. 3 0
      kernel/src/arch/x86_64/driver/apic/mod.rs
  24. 8 6
      kernel/src/arch/x86_64/driver/hpet.rs
  25. 3 3
      kernel/src/arch/x86_64/driver/rtc.rs
  26. 1 1
      kernel/src/arch/x86_64/init/multiboot2.rs
  27. 1 0
      kernel/src/arch/x86_64/init/pvh/param.rs
  28. 1 1
      kernel/src/arch/x86_64/interrupt/entry.rs
  29. 1 1
      kernel/src/arch/x86_64/process/kthread.rs
  30. 2 2
      kernel/src/arch/x86_64/process/mod.rs
  31. 1 1
      kernel/src/arch/x86_64/smp/mod.rs
  32. 2 2
      kernel/src/arch/x86_64/vm/mmu/kvm_mmu.rs
  33. 10 4
      kernel/src/arch/x86_64/vm/vmx/mod.rs
  34. 2 2
      kernel/src/arch/x86_64/vm/vmx/vmcs/mod.rs
  35. 30 12
      kernel/src/arch/x86_64/x86_64-unknown-none.json
  36. 1 1
      kernel/src/bpf/map/array_map.rs
  37. 0 1
      kernel/src/debug/panic/mod.rs
  38. 6 6
      kernel/src/debug/tracing/events.rs
  39. 1 1
      kernel/src/debug/tracing/mod.rs
  40. 9 3
      kernel/src/driver/base/block/block_device.rs
  41. 2 2
      kernel/src/driver/base/block/manager.rs
  42. 8 2
      kernel/src/driver/base/char/mod.rs
  43. 2 2
      kernel/src/driver/base/cpu.rs
  44. 3 3
      kernel/src/driver/base/device/mod.rs
  45. 2 2
      kernel/src/driver/base/kobject.rs
  46. 3 3
      kernel/src/driver/base/kset.rs
  47. 1 1
      kernel/src/driver/base/map/mod.rs
  48. 3 3
      kernel/src/driver/base/platform/platform_device.rs
  49. 2 2
      kernel/src/driver/base/subsys.rs
  50. 7 7
      kernel/src/driver/block/virtio_blk.rs
  51. 18 11
      kernel/src/driver/char/virtio_console.rs
  52. 7 7
      kernel/src/driver/disk/ahci/ahcidisk.rs
  53. 10 10
      kernel/src/driver/disk/ahci/hba.rs
  54. 1 1
      kernel/src/driver/firmware/efi/memmap.rs
  55. 2 2
      kernel/src/driver/firmware/efi/mod.rs
  56. 1 0
      kernel/src/driver/firmware/mod.rs
  57. 3 3
      kernel/src/driver/input/ps2_mouse/ps_mouse_device.rs
  58. 2 2
      kernel/src/driver/input/ps2_mouse/ps_mouse_driver.rs
  59. 3 3
      kernel/src/driver/input/serio/i8042/i8042_device.rs
  60. 2 2
      kernel/src/driver/input/serio/i8042/i8042_driver.rs
  61. 3 3
      kernel/src/driver/input/serio/i8042/i8042_ports.rs
  62. 3 3
      kernel/src/driver/net/e1000e/e1000e_driver.rs
  63. 3 3
      kernel/src/driver/net/loopback.rs
  64. 9 9
      kernel/src/driver/net/virtio_net.rs
  65. 2 2
      kernel/src/driver/open_firmware/device_node.rs
  66. 3 3
      kernel/src/driver/pci/device.rs
  67. 15 6
      kernel/src/driver/pci/pci.rs
  68. 2 2
      kernel/src/driver/pci/raw_device.rs
  69. 9 5
      kernel/src/driver/pci/root.rs
  70. 2 2
      kernel/src/driver/pci/test/pt_device.rs
  71. 2 2
      kernel/src/driver/pci/test/pt_driver.rs
  72. 3 3
      kernel/src/driver/rtc/rtc_cmos.rs
  73. 3 3
      kernel/src/driver/rtc/sysfs.rs
  74. 1 1
      kernel/src/driver/scsi/mod.rs
  75. 4 4
      kernel/src/driver/serial/serial8250/mod.rs
  76. 6 0
      kernel/src/driver/serial/serial8250/serial8250_la64.rs
  77. 6 6
      kernel/src/driver/tty/tty_core.rs
  78. 3 3
      kernel/src/driver/tty/tty_device.rs
  79. 5 5
      kernel/src/driver/tty/tty_driver.rs
  80. 5 5
      kernel/src/driver/tty/tty_ldisc/ntty.rs
  81. 2 2
      kernel/src/driver/tty/tty_port.rs
  82. 3 3
      kernel/src/driver/video/fbdev/base/fbcon/framebuffer_console.rs
  83. 5 5
      kernel/src/driver/video/fbdev/base/fbcon/mod.rs
  84. 3 3
      kernel/src/driver/video/fbdev/base/fbmem.rs
  85. 1 1
      kernel/src/driver/video/fbdev/base/mod.rs
  86. 5 5
      kernel/src/driver/video/fbdev/vesafb.rs
  87. 2 1
      kernel/src/driver/virtio/transport_mmio.rs
  88. 2 2
      kernel/src/driver/virtio/transport_pci.rs
  89. 1 0
      kernel/src/exception/handle.rs
  90. 1 0
      kernel/src/exception/irqchip.rs
  91. 6 5
      kernel/src/exception/irqdata.rs
  92. 6 5
      kernel/src/exception/irqdesc.rs
  93. 16 4
      kernel/src/exception/irqdomain.rs
  94. 11 6
      kernel/src/exception/manage.rs
  95. 12 3
      kernel/src/filesystem/devfs/mod.rs
  96. 17 5
      kernel/src/filesystem/fat/fs.rs
  97. 1 1
      kernel/src/filesystem/kernfs/mod.rs
  98. 3 3
      kernel/src/filesystem/mbr.rs
  99. 3 7
      kernel/src/filesystem/page_cache.rs
  100. 13 4
      kernel/src/filesystem/procfs/mod.rs

+ 8 - 6
.github/workflows/makefile.yml

@@ -11,14 +11,14 @@ jobs:
     name: Format check ${{ matrix.arch }}
     runs-on: ubuntu-latest
     continue-on-error: true
-    container: dragonos/dragonos-dev:v1.12
+    container: dragonos/dragonos-dev:v1.14
 
     strategy:
       matrix:
         arch: [x86_64, riscv64, loongarch64]
 
     steps:
-      - run: echo "Running in dragonos/dragonos-dev:v1.12"
+      - run: echo "Running in dragonos/dragonos-dev:v1.14"
       - uses: actions/checkout@v3
 
       - name: Format check
@@ -35,14 +35,14 @@ jobs:
     name: Kernel static test ${{ matrix.arch }}
     runs-on: ubuntu-latest
     continue-on-error: true
-    container: dragonos/dragonos-dev:v1.12
+    container: dragonos/dragonos-dev:v1.14
 
     strategy:
       matrix:
         arch: [x86_64, riscv64, loongarch64]
 
     steps:
-      - run: echo "Running in dragonos/dragonos-dev:v1.12"
+      - run: echo "Running in dragonos/dragonos-dev:v1.14"
 
       - uses: actions/checkout@v3
 
@@ -56,7 +56,7 @@ jobs:
   build:
     name: Build ${{ matrix.arch }}
     runs-on: ubuntu-latest
-    container: dragonos/dragonos-dev:v1.12
+    container: dragonos/dragonos-dev:v1.14
     continue-on-error: true
     strategy:
       matrix:
@@ -73,7 +73,7 @@ jobs:
             checkout_params: {}
 
     steps:
-      - run: echo "Running in dragonos/dragonos-dev:v1.12"
+      - run: echo "Running in dragonos/dragonos-dev:v1.14"
       
       - uses: actions/checkout@v3
         with: ${{ matrix.checkout_params }}
@@ -82,6 +82,8 @@ jobs:
         env:
           ARCH: ${{ matrix.arch }}
           HOME: /root
+          RUSTUP_DIST_SERVER: "https://rsproxy.cn"
+          RUSTUP_UPDATE_ROOT: "https://rsproxy.cn/rustup"
         shell: bash -ileo pipefail {0}
         run: |
           source $HOME/.bashrc

+ 23 - 23
kernel/Cargo.lock

@@ -8,7 +8,7 @@ version = "5.0.0"
 source = "git+https://git.mirrors.dragonos.org.cn/DragonOS-Community/acpi-rs.git?rev=282df2af7b#282df2af7b9edee629af391005c2a6b89e73f88c"
 dependencies = [
  "bit_field",
- "bitflags 2.9.0",
+ "bitflags 2.9.1",
  "log",
 ]
 
@@ -44,7 +44,7 @@ name = "another_ext4"
 version = "0.1.0"
 source = "git+https://git.mirrors.dragonos.org.cn/DragonOS-Community/another_ext4.git?rev=bf782ff294#bf782ff2947b57ba89503824eada5eb3c20a2e2a"
 dependencies = [
- "bitflags 2.9.0",
+ "bitflags 2.9.1",
  "log",
 ]
 
@@ -127,9 +127,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
 
 [[package]]
 name = "bitflags"
-version = "2.9.0"
+version = "2.9.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
+checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
 
 [[package]]
 name = "bitmap"
@@ -464,9 +464,9 @@ dependencies = [
 
 [[package]]
 name = "gimli"
-version = "0.31.1"
+version = "0.32.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
+checksum = "93563d740bc9ef04104f9ed6f86f1e3275c2cdafb95664e26584b9ca807a8ffe"
 
 [[package]]
 name = "glob"
@@ -587,9 +587,9 @@ dependencies = [
 
 [[package]]
 name = "itertools"
-version = "0.9.0"
+version = "0.14.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
+checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
 dependencies = [
  "either",
 ]
@@ -731,7 +731,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "7c9f0d275c70310e2a9d2fc23250c5ac826a73fa828a5f256401f85c5c554283"
 dependencies = [
  "bit_field",
- "bitflags 2.9.0",
+ "bitflags 2.9.1",
 ]
 
 [[package]]
@@ -784,7 +784,7 @@ name = "multiboot2"
 version = "0.22.2"
 source = "git+https://git.mirrors.dragonos.org.cn/DragonOS-Community/multiboot2?rev=05739aab40#05739aab40916370146a078ed5297ed113781aed"
 dependencies = [
- "bitflags 2.9.0",
+ "bitflags 2.9.1",
  "derive_more",
  "log",
  "multiboot2-common",
@@ -941,10 +941,10 @@ dependencies = [
 
 [[package]]
 name = "printf-compat"
-version = "0.1.1"
-source = "git+https://git.mirrors.dragonos.org.cn/DragonOS-Community/printf-compat?rev=5f5c9cc363#5f5c9cc363f047411a0dccb37e0efb452ffb61d9"
+version = "0.2.1"
+source = "git+https://git.mirrors.dragonos.org.cn/DragonOS-Community/printf-compat?rev=626801cb5f#626801cb5f640d7b9eead4d4eb72140eb703ed50"
 dependencies = [
- "bitflags 1.3.2",
+ "bitflags 2.9.1",
  "itertools",
 ]
 
@@ -1053,7 +1053,7 @@ version = "11.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "c6df7ab838ed27997ba19a4664507e6f82b41fe6e20be42929332156e5e85146"
 dependencies = [
- "bitflags 2.9.0",
+ "bitflags 2.9.1",
 ]
 
 [[package]]
@@ -1123,7 +1123,7 @@ version = "0.38.44"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
 dependencies = [
- "bitflags 2.9.0",
+ "bitflags 2.9.1",
  "errno",
  "libc",
  "linux-raw-sys",
@@ -1422,7 +1422,7 @@ version = "0.26.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "07ead9f748a4646479b850add36b527113a80e80a7e0f44d7b0334291850dcc5"
 dependencies = [
- "bitflags 2.9.0",
+ "bitflags 2.9.1",
  "log",
  "ptr_meta",
  "ucs2",
@@ -1448,7 +1448,7 @@ version = "0.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "864ac69eadd877bfb34e7814be1928122ed0057d9f975169a56ee496aa7bdfd7"
 dependencies = [
- "bitflags 2.9.0",
+ "bitflags 2.9.1",
  "ptr_meta",
  "uguid",
 ]
@@ -1489,9 +1489,9 @@ dependencies = [
 
 [[package]]
 name = "unwinding"
-version = "0.2.3"
+version = "0.2.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "637d511437df708cee34bdec7ba2f1548d256b7acf3ff20e0a1c559f9bf3a987"
+checksum = "60612c845ef41699f39dc8c5391f252942c0a88b7d15da672eff0d14101bbd6d"
 dependencies = [
  "gimli",
 ]
@@ -1516,7 +1516,7 @@ name = "virtio-drivers"
 version = "0.7.2"
 source = "git+https://git.mirrors.dragonos.org.cn/DragonOS-Community/virtio-drivers?rev=415ab38ff9#415ab38ff99f3c8e150269c04f65d684ba9d1365"
 dependencies = [
- "bitflags 2.9.0",
+ "bitflags 2.9.1",
  "log",
  "zerocopy 0.7.35",
 ]
@@ -1872,12 +1872,12 @@ dependencies = [
 
 [[package]]
 name = "x86_64"
-version = "0.14.10"
+version = "0.15.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "100555a863c0092238c2e0e814c1096c1e5cf066a309c696a87e907b5f8c5d69"
+checksum = "0f042214de98141e9c8706e8192b73f56494087cc55ebec28ce10f26c5c364ae"
 dependencies = [
  "bit_field",
- "bitflags 1.3.2",
+ "bitflags 2.9.1",
  "rustversion",
  "volatile",
 ]

+ 7 - 5
kernel/Cargo.toml

@@ -64,8 +64,6 @@ smoltcp = { version = "=0.11.0", default-features = false, features = [
 ] }
 syscall_table_macros = { path = "crates/syscall_table_macros" }
 system_error = { path = "crates/system_error" }
-uefi = { version = "=0.26.0", features = ["alloc"] }
-uefi-raw = "=0.5.0"
 unified-init = { path = "crates/unified-init" }
 virtio-drivers = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/virtio-drivers", rev = "415ab38ff9" }
 wait_queue_macros = { path = "crates/wait_queue_macros" }
@@ -76,7 +74,7 @@ kprobe = { path = "crates/kprobe" }
 lru = "0.12.3"
 
 rbpf = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/rbpf", rev = "f31e471a29", default-features = false }
-printf-compat = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/printf-compat", rev = "5f5c9cc363", default-features = false }
+printf-compat = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/printf-compat", rev = "626801cb5f", default-features = false }
 
 static-keys = { version = "=0.7" }
 
@@ -91,7 +89,9 @@ derive_builder = { version = "0.20.2", default-features = false, features = [
 multiboot2 = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/multiboot2", rev = "05739aab40" }
 raw-cpuid = "11.0.1"
 x86 = "=0.52.0"
-x86_64 = "=0.14.10"
+x86_64 = "=0.15.2"
+uefi = { version = "=0.26.0", features = ["alloc"] }
+uefi-raw = "=0.5.0"
 
 # target为riscv64时,使用下面的依赖
 [target.'cfg(target_arch = "riscv64")'.dependencies]
@@ -99,6 +99,8 @@ riscv = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/riscv.gi
     "s-mode",
 ] }
 sbi-rt = { version = "=0.0.3", features = ["legacy"] }
+uefi = { version = "=0.26.0", features = ["alloc"] }
+uefi-raw = "=0.5.0"
 
 # target为loongarch64时,使用下面的依赖
 [target.'cfg(target_arch = "loongarch64")'.dependencies]
@@ -106,7 +108,7 @@ loongArch64 = "=0.2.5"
 
 # 由于unwinding库不支持loongarch64架构,因此需要排除该依赖项
 [target.'cfg(not(target_arch = "loongarch64"))'.dependencies]
-unwinding = { version = "=0.2.3", default-features = false, features = [
+unwinding = { version = "=0.2.8", default-features = false, features = [
     "unwinder",
     "fde-gnu-eh-frame-hdr",
     "panic",

+ 2 - 2
kernel/Makefile

@@ -31,7 +31,7 @@ clean:
 fmt:
 	RUSTFLAGS="$(RUSTFLAGS)" cargo fmt --all $(FMT_CHECK)
 ifeq ($(ARCH), x86_64)
-	RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2024-11-05 clippy --all-features --target x86_64-unknown-none
+	RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2025-08-10 clippy --all-features --target x86_64-unknown-none
 endif
 
 
@@ -41,4 +41,4 @@ check: ECHO
 
 test:
 # 测试内核库
-	RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2024-11-05 test --workspace --exclude dragonos_kernel
+	RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2025-08-10 test --workspace --exclude dragonos_kernel

+ 2 - 2
kernel/crates/crc/src/crc64.rs

@@ -36,7 +36,7 @@ use crate::tables::crc64::{CRC64_ROCKSOFT_TABLE, CRC64_TABLE};
 /// ## 参数
 ///
 /// - `crc`: seed value for computation. 0 or (u64)~0 for a new CRC calculation,
-///             or the previous crc64 value if computing incrementally.
+///   or the previous crc64 value if computing incrementally.
 /// - `buf`: pointer to buffer over which CRC64 is run
 pub fn crc64_be(mut crc: u64, buf: &[u8]) -> u64 {
     for &byte in buf {
@@ -52,7 +52,7 @@ pub fn crc64_be(mut crc: u64, buf: &[u8]) -> u64 {
 /// ## 参数
 ///
 /// - `crc`: seed value for computation. 0 for a new CRC calculation, or the
-///            previous crc64 value if computing incrementally.
+///   previous crc64 value if computing incrementally.
 /// - `buf`: pointer to buffer over which CRC64 is run
 pub fn crc64_rocksoft_generic(mut crc: u64, buf: &[u8]) -> u64 {
     crc = !crc;

+ 0 - 1
kernel/crates/klog_types/src/lib.rs

@@ -1,5 +1,4 @@
 #![no_std]
-#![feature(const_size_of_val)]
 #![allow(clippy::needless_return)]
 
 extern crate alloc;

+ 2 - 2
kernel/crates/rust-slabmalloc/src/pages.rs

@@ -72,7 +72,7 @@ impl Bitfield for [AtomicU64] {
                 }
 
                 let addr: usize = base_addr + offset;
-                let alignment_ok = addr % layout.align() == 0;
+                let alignment_ok = addr.is_multiple_of(layout.align());
                 let block_is_free = bitval & (1 << first_free) == 0;
                 if alignment_ok && block_is_free {
                     return Some((idx, addr));
@@ -209,7 +209,7 @@ pub trait AllocablePage {
             layout
         );
         let page_offset = (ptr.as_ptr() as usize) & (Self::SIZE - 1);
-        assert!(page_offset % layout.size() == 0);
+        assert!(page_offset.is_multiple_of(layout.size()));
         let idx = page_offset / layout.size();
         assert!(
             self.bitfield().is_allocated(idx),

+ 1 - 1
kernel/crates/rust-slabmalloc/src/sc.rs

@@ -189,7 +189,7 @@ impl<'a, P: AllocablePage> SCAllocator<'a, P> {
     ///
     /// # Arguments
     ///  * `sc_layout`: This is not the original layout but adjusted for the
-    ///     SCAllocator size (>= original).
+    ///    SCAllocator size (>= original).
     fn try_allocate_from_pagelist(&mut self, sc_layout: Layout) -> *mut u8 {
         // TODO: Do we really need to check multiple slab pages (due to alignment)
         // If not we can get away with a singly-linked list and have 8 more bytes

+ 0 - 1
kernel/crates/unified-init/src/main.rs

@@ -11,7 +11,6 @@ fn main() {
 
 #[cfg(target_os = "none")]
 #[panic_handler]
-#[no_mangle]
 pub fn panic(_info: &core::panic::PanicInfo) -> ! {
     loop {}
 }

+ 1 - 1
kernel/rust-toolchain.toml

@@ -1,3 +1,3 @@
 [toolchain]
-channel = "nightly-2024-11-05"
+channel = "nightly-2025-08-10"
 components = ["rust-src", "clippy"]

+ 3 - 2
kernel/src/Makefile

@@ -39,9 +39,10 @@ LD_LIST := ""
 
 kernel_subdirs := debug
 
+TOOLCHAIN := +nightly-2025-08-10
 
 kernel_rust:
-	RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2024-11-05 $(CARGO_ZBUILD) build --release --target $(TARGET_JSON)
+	RUSTFLAGS="$(RUSTFLAGS)" cargo $(TOOLCHAIN) $(CARGO_ZBUILD) build --release --target $(TARGET_JSON)
 
 
 all: kernel
@@ -163,4 +164,4 @@ clean:
 
 .PHONY: check
 check:
-	RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2024-11-05 $(CARGO_ZBUILD) check --workspace --message-format=json --target $(TARGET_JSON)
+	RUSTFLAGS="$(RUSTFLAGS)" cargo $(TOOLCHAIN) $(CARGO_ZBUILD) check --workspace --message-format=json --target $(TARGET_JSON)

+ 2 - 2
kernel/src/arch/loongarch64/asm/boot.rs

@@ -9,7 +9,7 @@ const QEMU_DTB_PADDR: usize = 0x100000;
 /// The earliest entry point for the primary CPU.
 ///
 /// We can't use bl to jump to higher address, so we use jirl to jump to higher address.
-#[naked]
+#[unsafe(naked)]
 #[no_mangle]
 #[link_section = ".text.entry"]
 unsafe extern "C" fn _start() -> ! {
@@ -59,7 +59,7 @@ unsafe extern "C" fn _start() -> ! {
 /// The earliest entry point for the primary CPU.
 ///
 /// We can't use bl to jump to higher address, so we use jirl to jump to higher address.
-#[naked]
+#[unsafe(naked)]
 #[no_mangle]
 #[link_section = ".text.entry"]
 pub(crate) unsafe extern "C" fn _start_secondary() -> ! {

+ 22 - 2
kernel/src/arch/loongarch64/init/boot.rs

@@ -1,3 +1,5 @@
+use core::sync::atomic::compiler_fence;
+
 use loongArch64::register::{ecfg, eentry};
 
 use crate::{arch::interrupt::entry::handle_reserved_, init::init::start_kernel, mm::PhysAddr};
@@ -6,17 +8,20 @@ static mut BOOT_HARTID: u32 = 0;
 static mut BOOT_FDT_PADDR: PhysAddr = PhysAddr::new(0);
 
 #[no_mangle]
+#[inline(never)]
 pub unsafe extern "C" fn kernel_main(hartid: usize, fdt_paddr: usize) -> ! {
+    compiler_fence(core::sync::atomic::Ordering::SeqCst);
     clear_bss();
-
+    compiler_fence(core::sync::atomic::Ordering::SeqCst);
     let fdt_paddr = PhysAddr::new(fdt_paddr);
 
     unsafe {
         BOOT_HARTID = hartid as u32;
         BOOT_FDT_PADDR = fdt_paddr;
     }
-    boot_tmp_setup_trap_vector();
+    compiler_fence(core::sync::atomic::Ordering::SeqCst);
 
+    boot_tmp_setup_trap_vector();
     start_kernel();
 }
 
@@ -25,9 +30,15 @@ pub unsafe extern "C" fn kernel_main(hartid: usize, fdt_paddr: usize) -> ! {
 /// 后续需要通过 https://code.dragonos.org.cn/xref/linux-6.6.21/arch/loongarch/kernel/traps.c#1085
 /// 这里的这个函数来重新设置中断、异常处理函数
 fn boot_tmp_setup_trap_vector() {
+    compiler_fence(core::sync::atomic::Ordering::SeqCst);
+
     let ptr = handle_reserved_ as *const () as usize;
+
     ecfg::set_vs(0);
+    compiler_fence(core::sync::atomic::Ordering::SeqCst);
+
     eentry::set_eentry(ptr);
+    compiler_fence(core::sync::atomic::Ordering::SeqCst);
 }
 
 /// Clear the bss section
@@ -36,6 +47,14 @@ fn clear_bss() {
         fn _bss();
         fn _ebss();
     }
+    if _bss as usize == 0
+        || _ebss as usize == 0
+        || _bss as usize >= _ebss as usize
+        || _ebss as usize - _bss as usize == 0
+    {
+        return; // BSS section is empty, nothing to clear
+    }
+
     unsafe {
         let bss_start = _bss as *mut u8;
         let bss_end = _ebss as *mut u8;
@@ -48,6 +67,7 @@ fn clear_bss() {
 
         // Clear any remaining bytes
         let remaining_bytes = bss_size % core::mem::size_of::<u128>();
+
         if remaining_bytes > 0 {
             let remaining_start = bss_start.add(u128_count * core::mem::size_of::<u128>());
             let remaining_slice = core::slice::from_raw_parts_mut(remaining_start, remaining_bytes);

+ 2 - 2
kernel/src/arch/loongarch64/interrupt/entry.rs

@@ -38,9 +38,9 @@ macro_rules! build_handler {
     ($exception:expr, $handler:expr, $prep:ident) => {
         paste::paste! {
             /// handle exception的实现请参考 https://code.dragonos.org.cn/xref/linux-6.6.21/arch/loongarch/kernel/genex.S#69
-            #[naked]
+            #[unsafe(naked)]
             #[no_mangle]
-            #[repr(align(8))]
+            #[rustc_align(8)]
             pub unsafe extern "C" fn [<handle_ $exception _>]() -> ! {
                 core::arch::naked_asm!(concat!(
                     backup_t0t1!(),

+ 1 - 1
kernel/src/arch/loongarch64/loongarch64-unknown-none.json

@@ -3,7 +3,7 @@
     "code-model": "medium",
     "crt-objects-fallback": "false",
     "data-layout": "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128",
-    "features": "+f,+d",
+    "features": "-lsx",
     "linker": "rust-lld",
     "linker-flavor": "gnu-lld",
     "llvm-abiname": "lp64d",

+ 8 - 5
kernel/src/arch/riscv64/interrupt/entry.rs

@@ -7,9 +7,9 @@ use asm_macros::{restore_from_x6_to_x31, save_from_x6_to_x31};
 use kdepends::memoffset::offset_of;
 
 /// Riscv64中断处理入口
-#[naked]
+#[unsafe(naked)]
 #[no_mangle]
-#[repr(align(4))]
+#[rustc_align(4)]
 pub unsafe extern "C" fn handle_exception() -> ! {
     core::arch::naked_asm!(
         concat!("
@@ -30,7 +30,7 @@ pub unsafe extern "C" fn handle_exception() -> ! {
     )
 }
 
-#[naked]
+#[unsafe(naked)]
 #[no_mangle]
 unsafe extern "C" fn _restore_kernel_tpsp() -> ! {
     core::arch::naked_asm!(
@@ -50,7 +50,7 @@ unsafe extern "C" fn _restore_kernel_tpsp() -> ! {
     )
 }
 
-#[naked]
+#[unsafe(naked)]
 #[no_mangle]
 unsafe extern "C" fn _save_context() -> ! {
     core::arch::naked_asm!(
@@ -164,7 +164,7 @@ unsafe extern "C" fn _save_context() -> ! {
     )
 }
 
-#[naked]
+#[unsafe(naked)]
 #[no_mangle]
 pub unsafe extern "C" fn ret_from_exception() -> ! {
     core::arch::naked_asm!(
@@ -188,7 +188,10 @@ pub unsafe extern "C" fn ret_from_exception() -> ! {
             ld a0, {off_status}(sp)
 
             ld a2, {off_epc}(sp)
+            .option push
+            .option arch, +zalrsc
             sc.d x0, a2, {off_epc}(sp)
+            .option pop
 
             csrw {csr_status}, a0
             csrw {csr_epc}, a2

+ 1 - 6
kernel/src/arch/riscv64/pci/pci_host_ecam.rs

@@ -41,12 +41,7 @@ pub(super) fn pci_host_ecam_driver_init(fdt: &Fdt<'_>) -> Result<(), SystemError
 
         debug!(
             "pci_host_ecam_driver_init(): {} paddr: {:#x} size: {:#x} bus-range: {}-{} segement_group_number: {}",
-            node.name,
-            paddr,
-            size,
-            bus_begin,
-            bus_end,
-            segement_group_number
+            node.name, paddr, size, bus_begin, bus_end, segement_group_number
         );
 
         pci_ecam_root_info_manager().add_ecam_root_info(EcamRootInfo::new(

+ 2 - 2
kernel/src/arch/riscv64/process/kthread.rs

@@ -56,11 +56,11 @@ impl KernelThreadMechanism {
 /// 当内核线程开始执行时,会先执行这个函数,这个函数会将伪造的trapframe中的数据弹出,然后跳转到第二阶段
 ///
 /// 跳转之后,指向Box<KernelThreadClosure>的指针将传入到stage2的函数
-// #[naked]
+// #[unsafe(naked)]
 // pub(super) unsafe extern "C" fn kernel_thread_bootstrap_stage1() {
 //     todo!()
 // }
-#[naked]
+#[unsafe(naked)]
 pub(super) unsafe extern "C" fn kernel_thread_bootstrap_stage1() {
     // 这个函数要是naked的,只是因为现在还没有实现,而naked func不能打`unimplemented!()`
     // 所以先写成了普通函数

+ 2 - 2
kernel/src/arch/riscv64/process/mod.rs

@@ -76,7 +76,7 @@ pub unsafe fn arch_switch_to_user(trap_frame: TrapFrame) -> ! {
     ready_to_switch_to_user(trap_frame_vaddr.data(), new_pc.data());
 }
 
-#[naked]
+#[unsafe(naked)]
 unsafe extern "C" fn ready_to_switch_to_user(trap_frame: usize, new_pc: usize) -> ! {
     core::arch::naked_asm!(concat!(
         "
@@ -222,7 +222,7 @@ impl ProcessManager {
 /// 切换上下文
 ///
 /// 参考 https://code.dragonos.org.cn/xref/linux-6.6.21/arch/riscv/kernel/entry.S#233
-#[naked]
+#[unsafe(naked)]
 unsafe extern "C" fn switch_to_inner(prev: *mut ArchPCBInfo, next: *mut ArchPCBInfo) {
     core::arch::naked_asm!(concat!(
         "

+ 1 - 1
kernel/src/arch/riscv64/riscv64gc-unknown-none-elf.json

@@ -6,7 +6,7 @@
   "data-layout": "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128",
   "eh-frame-header": false,
   "emit-debug-gdb-scripts": false,
-  "features": "+m,+a,+f,+d,+c",
+  "features": "+m,+a,+f,+d,+c,+zicsr,+zifencei,+zalrsc,+zaamo",
   "linker": "rust-lld",
   "linker-flavor": "gnu-lld",
   "llvm-abiname": "lp64d",

+ 2 - 1
kernel/src/arch/x86_64/driver/apic/ioapic.rs

@@ -269,6 +269,7 @@ impl IoApic {
         unsafe { (self.read(REG_VER).get_bits(16..24) + 1) as u8 }
     }
 
+    #[allow(dead_code)]
     pub fn pending(&mut self, irq: u8) -> bool {
         let rte_index = Self::vector_rte_index(irq);
         let data = unsafe { self.read(REG_TABLE + 2 * rte_index) };
@@ -361,7 +362,7 @@ impl IoApicChipData {
         }
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerIoApicChipData> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerIoApicChipData> {
         self.inner.lock_irqsave()
     }
 }

+ 1 - 1
kernel/src/arch/x86_64/driver/apic/lapic_vector.rs

@@ -147,7 +147,7 @@ impl ApicChipData {
         }
     }
 
-    pub fn inner(&self) -> SpinLockGuard<InnerApicChipData> {
+    pub fn inner(&self) -> SpinLockGuard<'_, InnerApicChipData> {
         self.inner.lock_irqsave()
     }
 }

+ 3 - 0
kernel/src/arch/x86_64/driver/apic/mod.rs

@@ -55,15 +55,18 @@ pub trait LocalAPIC {
     fn send_eoi(&self);
 
     /// @brief 获取APIC版本号
+    #[allow(dead_code)]
     fn version(&self) -> u8;
 
     /// @brief 判断当前处理器是否支持EOI广播抑制
     fn support_eoi_broadcast_suppression(&self) -> bool;
 
     /// 获取最多支持的LVT寄存器数量
+    #[allow(dead_code)]
     fn max_lvt_entry(&self) -> u8;
 
     /// @brief 获取当前处理器的APIC ID
+    #[allow(dead_code)]
     fn id(&self) -> ApicId;
 
     /// @brief 设置LVT寄存器

+ 8 - 6
kernel/src/arch/x86_64/driver/hpet.rs

@@ -169,16 +169,16 @@ impl Hpet {
         return Ok(());
     }
 
-    fn inner(&self) -> RwLockReadGuard<InnerHpet> {
+    fn inner(&self) -> RwLockReadGuard<'_, InnerHpet> {
         self.inner.read()
     }
 
-    fn inner_mut(&self) -> RwLockWriteGuard<InnerHpet> {
+    fn inner_mut(&self) -> RwLockWriteGuard<'_, InnerHpet> {
         self.inner.write()
     }
 
     #[allow(dead_code)]
-    fn timer(&self, index: u8) -> Option<(RwLockReadGuard<InnerHpet>, &HpetTimerRegisters)> {
+    fn timer(&self, index: u8) -> Option<(RwLockReadGuard<'_, InnerHpet>, &HpetTimerRegisters)> {
         let inner = self.inner();
         if index >= self.info.hpet_number {
             return None;
@@ -194,10 +194,11 @@ impl Hpet {
         return Some((inner, timer_regs));
     }
 
+    #[allow(clippy::mut_from_ref)]
     unsafe fn timer_mut(
         &self,
         index: u8,
-    ) -> Option<(RwLockWriteGuard<InnerHpet>, &mut HpetTimerRegisters)> {
+    ) -> Option<(RwLockWriteGuard<'_, InnerHpet>, &mut HpetTimerRegisters)> {
         let inner = self.inner_mut();
         if index >= self.info.hpet_number {
             return None;
@@ -213,13 +214,14 @@ impl Hpet {
         return Some((inner, timer_regs));
     }
 
-    unsafe fn hpet_regs(&self) -> (RwLockReadGuard<InnerHpet>, &HpetRegisters) {
+    unsafe fn hpet_regs(&self) -> (RwLockReadGuard<'_, InnerHpet>, &HpetRegisters) {
         let inner = self.inner();
         let regs = unsafe { inner.registers_ptr.as_ref() };
         return (inner, regs);
     }
 
-    unsafe fn hpet_regs_mut(&self) -> (RwLockWriteGuard<InnerHpet>, &mut HpetRegisters) {
+    #[allow(clippy::mut_from_ref)]
+    unsafe fn hpet_regs_mut(&self) -> (RwLockWriteGuard<'_, InnerHpet>, &mut HpetRegisters) {
         let mut inner = self.inner_mut();
         let regs = unsafe { inner.registers_ptr.as_mut() };
         return (inner, regs);

+ 3 - 3
kernel/src/arch/x86_64/driver/rtc.rs

@@ -59,7 +59,7 @@ impl CmosRtcDevice {
         Arc::new(r)
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerCmosRtc> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerCmosRtc> {
         self.inner.lock()
     }
 
@@ -218,11 +218,11 @@ impl KObject for CmosRtcDevice {
         // Do nothing
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.locked_kobjstate.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.locked_kobjstate.write()
     }
 

+ 1 - 1
kernel/src/arch/x86_64/init/multiboot2.rs

@@ -131,7 +131,7 @@ impl BootCallbacks for Mb2Callback {
             }
         };
 
-        scinfo.lfb_size = (width * height * ((scinfo.lfb_depth as u32 + 7) / 8)) as usize;
+        scinfo.lfb_size = (width * height * (scinfo.lfb_depth as u32).div_ceil(8)) as usize;
 
         scinfo.lfb_virt_base = Some(vesafb_early_map(scinfo.lfb_base, scinfo.lfb_size)?);
 

+ 1 - 0
kernel/src/arch/x86_64/init/pvh/param.rs

@@ -142,6 +142,7 @@ impl HvmStartInfo {
 
 #[repr(C)]
 #[derive(Debug, Copy, Clone, Default)]
+#[allow(dead_code)]
 pub struct HvmModlistEntry {
     pub paddr: u64,
     pub size: u64,

+ 1 - 1
kernel/src/arch/x86_64/interrupt/entry.rs

@@ -42,7 +42,7 @@ macro_rules! interrupt_handler {
     ($name:expr) => {
         paste::paste! {
 
-            #[naked]
+            #[unsafe(naked)]
             #[no_mangle]
             unsafe extern "C" fn [<irq_handler $name>]() {
                 core::arch::naked_asm!(

+ 1 - 1
kernel/src/arch/x86_64/process/kthread.rs

@@ -57,7 +57,7 @@ impl KernelThreadMechanism {
 /// 当内核线程开始执行时,会先执行这个函数,这个函数会将伪造的trapframe中的数据弹出,然后跳转到第二阶段
 ///
 /// 跳转之后,指向Box<KernelThreadClosure>的指针将传入到stage2的函数
-#[naked]
+#[unsafe(naked)]
 pub(super) unsafe extern "sysv64" fn kernel_thread_bootstrap_stage1() {
     core::arch::naked_asm!(
         concat!(

+ 2 - 2
kernel/src/arch/x86_64/process/mod.rs

@@ -423,7 +423,7 @@ impl ProcessManager {
 }
 
 /// 保存上下文,然后切换进程,接着jmp到`switch_finish_hook`钩子函数
-#[naked]
+#[unsafe(naked)]
 unsafe extern "sysv64" fn switch_to_inner(prev: *mut ArchPCBInfo, next: *mut ArchPCBInfo) {
     core::arch::naked_asm!(
         // As a quick reminder for those who are unfamiliar with the System V ABI (extern "C"):
@@ -501,7 +501,7 @@ unsafe extern "sysv64" fn switch_to_inner(prev: *mut ArchPCBInfo, next: *mut Arc
     );
 }
 
-#[naked]
+#[unsafe(naked)]
 unsafe extern "sysv64" fn switch_back() -> ! {
     core::arch::naked_asm!("ret");
 }

+ 1 - 1
kernel/src/arch/x86_64/smp/mod.rs

@@ -62,7 +62,7 @@ unsafe extern "C" fn smp_ap_start() -> ! {
     smp_init_switch_stack(&v);
 }
 
-#[naked]
+#[unsafe(naked)]
 unsafe extern "sysv64" fn smp_init_switch_stack(st: &ApStartStackInfo) -> ! {
     core::arch::naked_asm!(concat!("
         mov rsp, [rdi + {off_rsp}]

+ 2 - 2
kernel/src/arch/x86_64/vm/mmu/kvm_mmu.rs

@@ -128,7 +128,7 @@ impl LockedKvmMmu {
         })
     }
 
-    pub fn lock(&self) -> SpinLockGuard<KvmMmu> {
+    pub fn lock(&self) -> SpinLockGuard<'_, KvmMmu> {
         self.inner.lock()
     }
 }
@@ -513,7 +513,7 @@ impl VirtCpuArch {
     }
 
     #[inline]
-    pub fn mmu(&self) -> SpinLockGuard<KvmMmu> {
+    pub fn mmu(&self) -> SpinLockGuard<'_, KvmMmu> {
         self.mmu.as_ref().unwrap().lock()
     }
 

+ 10 - 4
kernel/src/arch/x86_64/vm/vmx/mod.rs

@@ -1464,14 +1464,18 @@ impl Vmx {
         if !cpu_based_2nd_exec_control.contains(SecondaryControls::ENABLE_EPT)
             && !vmx_cap.ept.is_empty()
         {
-            warn!("EPT CAP should not exist if not support. 1-setting enable EPT VM-execution control");
+            warn!(
+                "EPT CAP should not exist if not support. 1-setting enable EPT VM-execution control"
+            );
             return Err(SystemError::EIO);
         }
 
         if !cpu_based_2nd_exec_control.contains(SecondaryControls::ENABLE_VPID)
             && !vmx_cap.vpid.is_empty()
         {
-            warn!("VPID CAP should not exist if not support. 1-setting enable VPID VM-execution control");
+            warn!(
+                "VPID CAP should not exist if not support. 1-setting enable VPID VM-execution control"
+            );
             return Err(SystemError::EIO);
         }
 
@@ -2738,7 +2742,9 @@ impl Vmx {
             var.type_ = 0x3;
             var.avl = 0;
             if save.base & 0xf != 0 {
-                warn!("segment base is not paragraph aligned when entering protected mode (seg={seg:?})");
+                warn!(
+                    "segment base is not paragraph aligned when entering protected mode (seg={seg:?})"
+                );
             }
         }
 
@@ -3284,7 +3290,7 @@ impl KvmVmx {
 impl VmxVCpuPriv {
     pub const PML_ENTITY_NUM: usize = 512;
 
-    pub fn loaded_vmcs(&self) -> SpinLockGuard<LoadedVmcs> {
+    pub fn loaded_vmcs(&self) -> SpinLockGuard<'_, LoadedVmcs> {
         self.loaded_vmcs.lock()
     }
 

+ 2 - 2
kernel/src/arch/x86_64/vm/vmx/vmcs/mod.rs

@@ -112,7 +112,7 @@ impl LockedVMControlStructure {
         })
     }
 
-    pub fn lock(&self) -> SpinLockGuard<Box<VMControlStructure>> {
+    pub fn lock(&self) -> SpinLockGuard<'_, Box<VMControlStructure>> {
         self.inner.lock()
     }
 
@@ -348,7 +348,7 @@ impl LockedLoadedVmcs {
         })
     }
 
-    pub fn lock(&self) -> SpinLockGuard<LoadedVmcs> {
+    pub fn lock(&self) -> SpinLockGuard<'_, LoadedVmcs> {
         self.inner.lock()
     }
 }

+ 30 - 12
kernel/src/arch/x86_64/x86_64-unknown-none.json

@@ -1,15 +1,33 @@
 {
-  "llvm-target": "x86_64-unknown-none",
-  "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
   "arch": "x86_64",
-  "target-endian": "little",
-  "target-pointer-width": "64",
-  "target-c-int-width": "32",
-  "os": "none",
-  "linker": "rust-lld",
-  "linker-flavor": "ld.lld",
-  "executables": true,
-  "features": "-mmx,-sse,+soft-float",
+  "code-model": "kernel",
+  "cpu": "x86-64",
+  "crt-objects-fallback": "false",
+  "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
   "disable-redzone": true,
-  "panic-strategy": "abort"
-}
+  "features": "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2,+soft-float",
+  "linker": "rust-lld",
+  "linker-flavor": "gnu-lld",
+  "llvm-target": "x86_64-unknown-none-elf",
+  "max-atomic-width": 64,
+  "metadata": {
+    "description": "Freestanding/bare-metal x86_64 softfloat",
+    "host_tools": false,
+    "std": false,
+    "tier": 2
+  },
+  "panic-strategy": "abort",
+  "plt-by-default": false,
+  "position-independent-executables": true,
+  "relro-level": "full",
+  "rustc-abi": "x86-softfloat",
+  "stack-probes": {
+    "kind": "inline"
+  },
+  "static-position-independent-executables": true,
+  "supported-sanitizers": [
+    "kcfi",
+    "kernel-address"
+  ],
+  "target-pointer-width": "64"
+}

+ 1 - 1
kernel/src/bpf/map/array_map.rs

@@ -43,7 +43,7 @@ impl Debug for ArrayMapData {
 
 impl ArrayMapData {
     pub fn new(elem_size: u32, max_entries: u32) -> Self {
-        debug_assert!(elem_size % 8 == 0);
+        debug_assert!(elem_size.is_multiple_of(8));
         let total_size = elem_size * max_entries;
         let data = vec![0; total_size as usize];
         ArrayMapData { elem_size, data }

+ 0 - 1
kernel/src/debug/panic/mod.rs

@@ -38,7 +38,6 @@ impl Drop for PanicGuard {
 ///
 #[cfg(target_os = "none")]
 #[panic_handler]
-#[no_mangle]
 pub fn panic(info: &PanicInfo) -> ! {
     PANIC_COUNTER.fetch_add(1, core::sync::atomic::Ordering::Relaxed);
     error!(

+ 6 - 6
kernel/src/debug/tracing/events.rs

@@ -26,10 +26,10 @@ impl KernFSCallback for EnableCallBack {
         let pri_data = data.private_data().as_ref().unwrap();
         let tracepoint_info = pri_data.debugfs_tracepoint().unwrap();
         let enable_value = tracepoint_info.enable_file().read();
-        if offset >= enable_value.as_bytes().len() {
+        if offset >= enable_value.len() {
             return Ok(0); // Offset is beyond the length of the string
         }
-        let len = buf.len().min(enable_value.as_bytes().len() - offset);
+        let len = buf.len().min(enable_value.len() - offset);
         buf[..len].copy_from_slice(&enable_value.as_bytes()[offset..offset + len]);
         Ok(len)
     }
@@ -71,10 +71,10 @@ impl KernFSCallback for FormatCallBack {
         let pri_data = data.private_data().as_ref().unwrap();
         let tracepoint = pri_data.debugfs_tracepoint().unwrap();
         let format_str = tracepoint.format_file().read();
-        if offset >= format_str.as_bytes().len() {
+        if offset >= format_str.len() {
             return Ok(0); // Offset is beyond the length of the string
         }
-        let len = buf.len().min(format_str.as_bytes().len() - offset);
+        let len = buf.len().min(format_str.len() - offset);
         buf[..len].copy_from_slice(&format_str.as_bytes()[offset..offset + len]);
         Ok(len)
     }
@@ -110,10 +110,10 @@ impl KernFSCallback for IDCallBack {
         let tracepoint = pri_data.debugfs_tracepoint().unwrap();
         let id_str = tracepoint.id_file().read();
 
-        if offset >= id_str.as_bytes().len() {
+        if offset >= id_str.len() {
             return Ok(0); // Offset is beyond the length of the string
         }
-        let len = buf.len().min(id_str.as_bytes().len() - offset);
+        let len = buf.len().min(id_str.len() - offset);
         buf[..len].copy_from_slice(&id_str.as_bytes()[offset..offset + len]);
         Ok(len)
     }

+ 1 - 1
kernel/src/debug/tracing/mod.rs

@@ -37,7 +37,7 @@ pub fn trace_cmdline_push(pid: u32) {
         .next()
         .unwrap_or("unknown")
         .split('/')
-        .last()
+        .next_back()
         .unwrap_or("unknown");
     TRACE_CMDLINE_CACHE.lock().insert(pid, pname.to_string());
 }

+ 9 - 3
kernel/src/driver/base/block/block_device.rs

@@ -197,7 +197,7 @@ impl BlockRange {
     /// 判断是不是多个整块连在一起
     pub fn is_multi(&self) -> bool {
         return self.len() >= (1usize << self.blk_size_log2)
-            && (self.len() % (1usize << self.blk_size_log2) == 0);
+            && self.len().is_multiple_of(1usize << self.blk_size_log2);
     }
     /// 获取 BlockRange 在块设备内部的起始位置 (单位是字节)
     pub fn origin_begin(&self) -> usize {
@@ -530,8 +530,14 @@ impl BlockDeviceOps {
             );
         }
         if minorct > DeviceNumber::MINOR_MASK + 1 - baseminor {
-            error!("DEV {} minor range requested ({}-{}) is out of range of maximum range ({}-{}) for a single major\n",
-                name, baseminor, baseminor + minorct - 1, 0, DeviceNumber::MINOR_MASK);
+            error!(
+                "DEV {} minor range requested ({}-{}) is out of range of maximum range ({}-{}) for a single major\n",
+                name,
+                baseminor,
+                baseminor + minorct - 1,
+                0,
+                DeviceNumber::MINOR_MASK
+            );
         }
         let blockdev = DeviceStruct::new(DeviceNumber::new(major, baseminor), minorct, name);
         if major == Major::UNNAMED_MAJOR {

+ 2 - 2
kernel/src/driver/base/block/manager.rs

@@ -59,7 +59,7 @@ impl BlockDevManager {
         }
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerBlockDevManager> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerBlockDevManager> {
         self.inner.lock()
     }
 
@@ -275,7 +275,7 @@ impl BlockDevMeta {
         }
     }
 
-    pub(crate) fn inner(&self) -> SpinLockGuard<InnerBlockDevMeta> {
+    pub(crate) fn inner(&self) -> SpinLockGuard<'_, InnerBlockDevMeta> {
         self.inner.lock()
     }
 }

+ 8 - 2
kernel/src/driver/base/char/mod.rs

@@ -137,8 +137,14 @@ impl CharDevOps {
             );
         }
         if minorct > DeviceNumber::MINOR_MASK + 1 - baseminor {
-            error!("DEV {} minor range requested ({}-{}) is out of range of maximum range ({}-{}) for a single major\n",
-                name, baseminor, baseminor + minorct - 1, 0, DeviceNumber::MINOR_MASK);
+            error!(
+                "DEV {} minor range requested ({}-{}) is out of range of maximum range ({}-{}) for a single major\n",
+                name,
+                baseminor,
+                baseminor + minorct - 1,
+                0,
+                DeviceNumber::MINOR_MASK
+            );
         }
         let chardev = DeviceStruct::new(DeviceNumber::new(major, baseminor), minorct, name);
         if major == Major::UNNAMED_MAJOR {

+ 2 - 2
kernel/src/driver/base/cpu.rs

@@ -246,11 +246,11 @@ impl KObject for CpuSubSystemFakeRootDevice {
         self.inner.write().name = name;
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 

+ 3 - 3
kernel/src/driver/base/device/mod.rs

@@ -1121,7 +1121,7 @@ impl ClassDir {
         });
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerClassDir> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerClassDir> {
         return self.inner.lock();
     }
 }
@@ -1171,11 +1171,11 @@ impl KObject for ClassDir {
         self.inner().name = Some(name);
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.locked_kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.locked_kobj_state.write()
     }
 

+ 2 - 2
kernel/src/driver/base/kobject.rs

@@ -51,9 +51,9 @@ pub trait KObject: Any + Send + Sync + Debug + CastFromSync {
 
     fn set_name(&self, name: String);
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState>;
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState>;
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState>;
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState>;
 
     fn set_kobj_state(&self, state: KObjectState);
 }

+ 3 - 3
kernel/src/driver/base/kset.rs

@@ -141,7 +141,7 @@ impl KSet {
         return self.self_ref.upgrade().unwrap();
     }
 
-    pub fn kobjects(&self) -> RwLockReadGuard<Vec<Weak<dyn KObject>>> {
+    pub fn kobjects(&self) -> RwLockReadGuard<'_, Vec<Weak<dyn KObject>>> {
         return self.kobjects.read();
     }
 }
@@ -167,11 +167,11 @@ impl KObject for KSet {
         self.parent_data.write().parent = parent;
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 

+ 1 - 1
kernel/src/driver/base/map/mod.rs

@@ -128,7 +128,7 @@ impl Default for LockedDevsMap {
 
 impl LockedDevsMap {
     #[inline(always)]
-    pub fn lock(&self) -> SpinLockGuard<DevsMap> {
+    pub fn lock(&self) -> SpinLockGuard<'_, DevsMap> {
         self.0.lock()
     }
 }

+ 3 - 3
kernel/src/driver/base/platform/platform_device.rs

@@ -187,7 +187,7 @@ impl PlatformBusDevice {
         return state;
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerPlatformBusDevice> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerPlatformBusDevice> {
         self.inner.lock()
     }
 }
@@ -243,11 +243,11 @@ impl KObject for PlatformBusDevice {
         self.inner().kobject_common.kset.clone()
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 

+ 2 - 2
kernel/src/driver/base/subsys.rs

@@ -117,11 +117,11 @@ impl SubSysPrivate {
         *self.class.lock() = class;
     }
 
-    pub fn devices(&self) -> RwLockReadGuard<Vec<Arc<dyn Device>>> {
+    pub fn devices(&self) -> RwLockReadGuard<'_, Vec<Arc<dyn Device>>> {
         return self.devices.read();
     }
 
-    pub fn drivers(&self) -> RwLockReadGuard<Vec<Arc<dyn Driver>>> {
+    pub fn drivers(&self) -> RwLockReadGuard<'_, Vec<Arc<dyn Driver>>> {
         return self.drivers.read();
     }
 

+ 7 - 7
kernel/src/driver/block/virtio_blk.rs

@@ -126,7 +126,7 @@ impl VirtIOBlkManager {
         }
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerVirtIOBlkManager> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerVirtIOBlkManager> {
         self.inner.lock()
     }
 
@@ -223,7 +223,7 @@ impl VirtIOBlkDevice {
         Some(dev)
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerVirtIOBlkDevice> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerVirtIOBlkDevice> {
         self.inner.lock()
     }
 }
@@ -557,11 +557,11 @@ impl KObject for VirtIOBlkDevice {
         // do nothing
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.locked_kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.locked_kobj_state.write()
     }
 
@@ -616,7 +616,7 @@ impl VirtIOBlkDriver {
         return Arc::new(result);
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerVirtIOBlkDriver> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerVirtIOBlkDriver> {
         return self.inner.lock();
     }
 }
@@ -748,11 +748,11 @@ impl KObject for VirtIOBlkDriver {
         // do nothing
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 

+ 18 - 11
kernel/src/driver/char/virtio_console.rs

@@ -158,7 +158,7 @@ impl VirtIOConsoleDevice {
         Some(dev)
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerVirtIOConsoleDevice> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerVirtIOConsoleDevice> {
         self.inner.lock_irqsave()
     }
 }
@@ -225,11 +225,11 @@ impl KObject for VirtIOConsoleDevice {
         // do nothing
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.locked_kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.locked_kobj_state.write()
     }
 
@@ -401,7 +401,7 @@ impl VirtIOConsoleDriver {
         Arc::new(result)
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerVirtIOConsoleDriver> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerVirtIOConsoleDriver> {
         self.inner.lock()
     }
 
@@ -572,14 +572,18 @@ impl Driver for VirtIOConsoleDriver {
             "VirtIOConsoleDriver::add_device() failed: device is not a VirtIOConsoleDevice",
         );
         if virtio_con_dev.dev_name.initialized() {
-            panic!("VirtIOConsoleDriver::add_device() failed: dev_name has already initialized for device: '{:?}'",
-            virtio_con_dev.dev_id(),
-        );
+            panic!(
+                "VirtIOConsoleDriver::add_device() failed: dev_name has already initialized for device: '{:?}'",
+                virtio_con_dev.dev_id(),
+            );
         }
         let mut inner = self.inner();
         let dev_name = inner.alloc_id();
         if dev_name.is_none() {
-            panic!("Failed to allocate ID for VirtIO console device: '{:?}', virtio console device limit exceeded.", virtio_con_dev.dev_id())
+            panic!(
+                "Failed to allocate ID for VirtIO console device: '{:?}', virtio console device limit exceeded.",
+                virtio_con_dev.dev_id()
+            )
         }
 
         let dev_name = dev_name.unwrap();
@@ -599,7 +603,10 @@ impl Driver for VirtIOConsoleDriver {
         if devices_fast_guard[index].is_none() {
             devices_fast_guard[index] = Some(virtio_con_dev.clone());
         } else {
-            panic!("VirtIOConsoleDriver::add_device() failed: device slot already occupied at index: {}", index);
+            panic!(
+                "VirtIOConsoleDriver::add_device() failed: device slot already occupied at index: {}",
+                index
+            );
         }
         // avoid deadlock in `init_tty_device`
         drop(devices_fast_guard);
@@ -704,11 +711,11 @@ impl KObject for VirtIOConsoleDriver {
         // do nothing
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 

+ 7 - 7
kernel/src/driver/disk/ahci/ahcidisk.rs

@@ -53,7 +53,7 @@ pub struct LockedAhciDisk {
 }
 
 impl LockedAhciDisk {
-    pub fn inner(&self) -> SpinLockGuard<AhciDisk> {
+    pub fn inner(&self) -> SpinLockGuard<'_, AhciDisk> {
         self.inner.lock()
     }
 }
@@ -122,8 +122,8 @@ impl AhciDisk {
             None
         };
 
-        if kbuf.is_some() {
-            buf_ptr = kbuf.as_mut().unwrap().as_mut_ptr() as usize;
+        if let Some(buf) = &mut kbuf {
+            buf_ptr = buf.as_mut_ptr() as usize;
         }
 
         #[allow(unused_unsafe)]
@@ -286,8 +286,8 @@ impl AhciDisk {
             None
         };
 
-        if kbuf.is_some() {
-            buf_ptr = kbuf.as_mut().unwrap().as_mut_ptr() as usize;
+        if let Some(buf) = &mut kbuf {
+            buf_ptr = buf.as_mut_ptr() as usize;
         }
 
         #[allow(unused_unsafe)]
@@ -431,11 +431,11 @@ impl KObject for LockedAhciDisk {
         todo!()
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         todo!()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         todo!()
     }
 

+ 10 - 10
kernel/src/driver/disk/ahci/hba.rs

@@ -42,7 +42,7 @@ pub enum HbaPortType {
 }
 
 /// 声明了 HBA 的所有属性
-#[repr(packed)]
+#[repr(C, packed)]
 #[allow(dead_code)]
 pub struct HbaPort {
     pub clb: u64,         // 0x00, command list base address, 1K-byte aligned
@@ -65,7 +65,7 @@ pub struct HbaPort {
 }
 
 /// 全称 HBA Memory Register,是HBA的寄存器在内存中的映射
-#[repr(packed)]
+#[repr(C, packed)]
 #[allow(dead_code)]
 pub struct HbaMem {
     pub cap: u32,             // 0x00, Host capability
@@ -86,7 +86,7 @@ pub struct HbaMem {
 
 /// HBA Command Table 里面的 PRDT 项
 /// 作用: 记录了内存中读/写数据的位置,以及长度。你可以把他类比成一个指针?
-#[repr(packed)]
+#[repr(C, packed)]
 pub struct HbaPrdtEntry {
     pub dba: u64, // Data base address
     _rsv0: u32,   // Reserved
@@ -95,7 +95,7 @@ pub struct HbaPrdtEntry {
 
 /// HAB Command Table
 /// 每个 Port 一个 Table,主机和设备的交互都靠这个数据结构
-#[repr(packed)]
+#[repr(C, packed)]
 #[allow(dead_code)]
 pub struct HbaCmdTable {
     // 0x00
@@ -111,7 +111,7 @@ pub struct HbaCmdTable {
 /// HBA Command Header
 /// 作用: 你可以把他类比成 Command Table 的指针。
 /// 猜测: 这里多了一层 Header,而不是直接在 HbaMem 结构体指向 CmdTable,可能是为了兼容和可移植性?
-#[repr(packed)]
+#[repr(C, packed)]
 pub struct HbaCmdHeader {
     // DW0
     pub cfl: u8,
@@ -286,7 +286,7 @@ pub enum FisType {
     DevBits = 0xA1,
 }
 
-#[repr(packed)]
+#[repr(C, packed)]
 #[allow(dead_code)]
 pub struct FisRegH2D {
     // DWORD 0
@@ -321,7 +321,7 @@ pub struct FisRegH2D {
     pub rsv1: [u8; 4], // Reserved
 }
 
-#[repr(packed)]
+#[repr(C, packed)]
 #[allow(dead_code)]
 pub struct FisRegD2H {
     // DWORD 0
@@ -353,7 +353,7 @@ pub struct FisRegD2H {
     pub rsv4: [u8; 4], // Reserved
 }
 
-#[repr(packed)]
+#[repr(C, packed)]
 #[allow(dead_code)]
 pub struct FisData {
     // DWORD 0
@@ -367,7 +367,7 @@ pub struct FisData {
     pub data: [u8; 252], // Payload
 }
 
-#[repr(packed)]
+#[repr(C, packed)]
 #[allow(dead_code)]
 pub struct FisPioSetup {
     // DWORD 0
@@ -401,7 +401,7 @@ pub struct FisPioSetup {
     pub rsv4: [u8; 2], // Reserved
 }
 
-#[repr(packed)]
+#[repr(C, packed)]
 #[allow(dead_code)]
 pub struct FisDmaSetup {
     // DWORD 0

+ 1 - 1
kernel/src/driver/firmware/efi/memmap.rs

@@ -50,7 +50,7 @@ impl EFIMemoryMapInfo {
     }
 
     /// 迭代所有的内存描述符
-    pub fn iter(&self) -> EFIMemoryDescIter {
+    pub fn iter(&self) -> EFIMemoryDescIter<'_> {
         EFIMemoryDescIter::new(self)
     }
 }

+ 2 - 2
kernel/src/driver/firmware/efi/mod.rs

@@ -105,11 +105,11 @@ impl EFIManager {
         return Ok(());
     }
 
-    fn inner_read(&self) -> RwLockReadGuard<InnerEFIManager> {
+    fn inner_read(&self) -> RwLockReadGuard<'_, InnerEFIManager> {
         self.inner.read()
     }
 
-    fn inner_write(&self) -> RwLockWriteGuard<InnerEFIManager> {
+    fn inner_write(&self) -> RwLockWriteGuard<'_, InnerEFIManager> {
         self.inner.write()
     }
 

+ 1 - 0
kernel/src/driver/firmware/mod.rs

@@ -1 +1,2 @@
+#[cfg(any(target_arch = "x86_64", target_arch = "riscv64"))]
 pub mod efi;

+ 3 - 3
kernel/src/driver/input/ps2_mouse/ps_mouse_device.rs

@@ -407,7 +407,7 @@ impl Ps2MouseDevice {
         Err(SystemError::ETIMEDOUT)
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerPs2MouseDevice> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerPs2MouseDevice> {
         self.inner.lock_irqsave()
     }
 }
@@ -572,11 +572,11 @@ impl KObject for Ps2MouseDevice {
 
     fn set_name(&self, _name: alloc::string::String) {}
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 

+ 2 - 2
kernel/src/driver/input/ps2_mouse/ps_mouse_driver.rs

@@ -199,11 +199,11 @@ impl KObject for Ps2MouseDriver {
 
     fn set_name(&self, _name: alloc::string::String) {}
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 

+ 3 - 3
kernel/src/driver/input/serio/i8042/i8042_device.rs

@@ -43,7 +43,7 @@ impl I8042PlatformDevice {
         };
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerI8042PlatformDevice> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerI8042PlatformDevice> {
         self.inner.lock()
     }
 }
@@ -162,11 +162,11 @@ impl KObject for I8042PlatformDevice {
         // do nothing
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 

+ 2 - 2
kernel/src/driver/input/serio/i8042/i8042_driver.rs

@@ -176,11 +176,11 @@ impl KObject for I8042Driver {
         // do nothing
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 

+ 3 - 3
kernel/src/driver/input/serio/i8042/i8042_ports.rs

@@ -48,7 +48,7 @@ impl I8042AuxPort {
         };
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerI8042AuxPort> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerI8042AuxPort> {
         self.inner.lock()
     }
 }
@@ -159,11 +159,11 @@ impl KObject for I8042AuxPort {
         // do nothing
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 

+ 3 - 3
kernel/src/driver/net/e1000e/e1000e_driver.rs

@@ -218,7 +218,7 @@ impl E1000EInterface {
         return result;
     }
 
-    pub fn inner(&self) -> SpinLockGuard<InnerE1000EInterface> {
+    pub fn inner(&self) -> SpinLockGuard<'_, InnerE1000EInterface> {
         return self.inner.lock();
     }
 }
@@ -417,11 +417,11 @@ impl KObject for E1000EInterface {
         // do nothing
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.locked_kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.locked_kobj_state.write()
     }
 

+ 3 - 3
kernel/src/driver/net/loopback.rs

@@ -305,7 +305,7 @@ impl LoopbackInterface {
         })
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerLoopbackInterface> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerLoopbackInterface> {
         return self.inner.lock();
     }
 }
@@ -361,11 +361,11 @@ impl KObject for LoopbackInterface {
         // do nothing
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.locked_kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.locked_kobj_state.write()
     }
 

+ 9 - 9
kernel/src/driver/net/virtio_net.rs

@@ -132,7 +132,7 @@ impl VirtIONetDevice {
         return Some(dev);
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerVirtIONetDevice> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerVirtIONetDevice> {
         return self.inner.lock();
     }
 }
@@ -182,11 +182,11 @@ impl KObject for VirtIONetDevice {
         // do nothing
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.locked_kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.locked_kobj_state.write()
     }
 
@@ -431,7 +431,7 @@ impl VirtioInterface {
         return result;
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerVirtIOInterface> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerVirtIOInterface> {
         return self.inner.lock();
     }
 
@@ -766,11 +766,11 @@ impl KObject for VirtioInterface {
         // do nothing
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.locked_kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.locked_kobj_state.write()
     }
 
@@ -825,7 +825,7 @@ impl VirtIONetDriver {
         return Arc::new(result);
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerVirtIODriver> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerVirtIODriver> {
         return self.inner.lock();
     }
 }
@@ -975,11 +975,11 @@ impl KObject for VirtIONetDriver {
         // do nothing
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 

+ 2 - 2
kernel/src/driver/open_firmware/device_node.rs

@@ -144,11 +144,11 @@ impl KObject for DeviceNode {
 
     fn set_name(&self, _name: String) {}
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         todo!()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         todo!()
     }
 

+ 3 - 3
kernel/src/driver/pci/device.rs

@@ -117,7 +117,7 @@ impl PciBusDevice {
         return Arc::new(bus_device);
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerPciBusDevice> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerPciBusDevice> {
         self.inner.lock()
     }
 }
@@ -159,11 +159,11 @@ impl KObject for PciBusDevice {
 
     fn kobj_state(
         &self,
-    ) -> crate::libs::rwlock::RwLockReadGuard<crate::driver::base::kobject::KObjectState> {
+    ) -> crate::libs::rwlock::RwLockReadGuard<'_, crate::driver::base::kobject::KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 

+ 15 - 6
kernel/src/driver/pci/pci.rs

@@ -80,12 +80,12 @@ impl PciDeviceLinkedList {
     }
     /// @brief 获取可读的linkedlist(读锁守卫)
     /// @return RwLockReadGuard<LinkedList<Box<dyn PciDeviceStructure>>>  读锁守卫
-    pub fn read(&self) -> RwLockReadGuard<LinkedList<Arc<dyn PciDeviceStructure>>> {
+    pub fn read(&self) -> RwLockReadGuard<'_, LinkedList<Arc<dyn PciDeviceStructure>>> {
         self.list.read()
     }
     /// @brief 获取可写的linkedlist(写锁守卫)
     /// @return RwLockWriteGuard<LinkedList<Box<dyn PciDeviceStructure>>>  写锁守卫
-    pub fn write(&self) -> RwLockWriteGuard<LinkedList<Arc<dyn PciDeviceStructure>>> {
+    pub fn write(&self) -> RwLockWriteGuard<'_, LinkedList<Arc<dyn PciDeviceStructure>>> {
         self.list.write()
     }
     /// @brief 获取链表中PCI结构体数目
@@ -116,8 +116,8 @@ impl PciDeviceLinkedList {
 pub fn get_pci_device_structures_mut_by_vendor_id(
     list: &PciDeviceLinkedList,
     vendor_id: u16,
-) -> Vec<Arc<(dyn PciDeviceStructure)>> {
-    let mut result: Vec<Arc<(dyn PciDeviceStructure)>> = Vec::new();
+) -> Vec<Arc<dyn PciDeviceStructure>> {
+    let mut result: Vec<Arc<dyn PciDeviceStructure>> = Vec::new();
     for box_pci_device_structure in list.write().iter() {
         if box_pci_device_structure.common_header().vendor_id == vendor_id {
             result.push(box_pci_device_structure.clone());
@@ -173,7 +173,7 @@ pub fn get_pci_device_structure<'a>(
     list: &'a mut RwLockReadGuard<'_, LinkedList<Box<dyn PciDeviceStructure>>>,
     class_code: u8,
     subclass: u8,
-) -> Vec<&'a Box<(dyn PciDeviceStructure)>> {
+) -> Vec<&'a Box<dyn PciDeviceStructure>> {
     let mut result = Vec::new();
     for box_pci_device_structure in list.iter() {
         let common_header = (*box_pci_device_structure).common_header();
@@ -1077,7 +1077,16 @@ pub fn pci_init() {
                 );
             }
             HeaderType::PciPciBridge if common_header.status & 0x10 != 0 => {
-                info!("Found pci-to-pci bridge device with class code ={} subclass={} status={:#x} cap_pointer={:#x}", common_header.class_code, common_header.subclass, common_header.status, box_pci_device.as_pci_to_pci_bridge_device().unwrap().capability_pointer);
+                info!(
+                    "Found pci-to-pci bridge device with class code ={} subclass={} status={:#x} cap_pointer={:#x}",
+                    common_header.class_code,
+                    common_header.subclass,
+                    common_header.status,
+                    box_pci_device
+                        .as_pci_to_pci_bridge_device()
+                        .unwrap()
+                        .capability_pointer
+                );
             }
             HeaderType::PciPciBridge => {
                 info!(

+ 2 - 2
kernel/src/driver/pci/raw_device.rs

@@ -217,11 +217,11 @@ impl KObject for PciGeneralDevice {
         self.inner.write().name = Some(name);
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 

+ 9 - 5
kernel/src/driver/pci/root.rs

@@ -47,10 +47,14 @@ impl core::fmt::Display for PciRoot {
     fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
         if let Some(ecam_root_info) = &self.ecam_root_info {
             write!(
-                    f,
-                    "PCI Eacm Root with segment:{}, bus begin at {}, bus end at {}, physical address at {:?},mapped at {:?}",
-                    ecam_root_info.segment_group_number, ecam_root_info.bus_begin, ecam_root_info.bus_end, ecam_root_info.physical_address_base, self.mmio_guard
-                )
+                f,
+                "PCI Eacm Root with segment:{}, bus begin at {}, bus end at {}, physical address at {:?},mapped at {:?}",
+                ecam_root_info.segment_group_number,
+                ecam_root_info.bus_begin,
+                ecam_root_info.bus_end,
+                ecam_root_info.physical_address_base,
+                self.mmio_guard
+            )
         } else {
             write!(f, "PCI Root cam is {:?}", self.cam,)
         }
@@ -211,7 +215,7 @@ impl PciRoot {
     pub fn external_capabilities(
         &self,
         bus_device_function: BusDeviceFunction,
-    ) -> ExternalCapabilityIterator {
+    ) -> ExternalCapabilityIterator<'_> {
         ExternalCapabilityIterator {
             root: self,
             bus_device_function,

+ 2 - 2
kernel/src/driver/pci/test/pt_device.rs

@@ -211,11 +211,11 @@ impl KObject for TestDevice {
         // do nothing
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 

+ 2 - 2
kernel/src/driver/pci/test/pt_driver.rs

@@ -157,11 +157,11 @@ impl KObject for TestDriver {
         // do nothing
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 

+ 3 - 3
kernel/src/driver/rtc/rtc_cmos.rs

@@ -56,7 +56,7 @@ impl CmosPlatformDriver {
         })
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerCmosPlatformDriver> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerCmosPlatformDriver> {
         self.inner.lock()
     }
 }
@@ -191,11 +191,11 @@ impl KObject for CmosPlatformDriver {
         // do nothing
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.locked_kobjstate.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.locked_kobjstate.write()
     }
 

+ 3 - 3
kernel/src/driver/rtc/sysfs.rs

@@ -80,7 +80,7 @@ impl RtcGeneralDevice {
         })
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerRtcGeneralDevice> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerRtcGeneralDevice> {
         self.inner.lock()
     }
 
@@ -229,11 +229,11 @@ impl KObject for RtcGeneralDevice {
         // do nothing
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 

+ 1 - 1
kernel/src/driver/scsi/mod.rs

@@ -45,7 +45,7 @@ impl ScsiManager {
         }
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerScsiManager> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerScsiManager> {
         self.inner.lock()
     }
 

+ 4 - 4
kernel/src/driver/serial/serial8250/mod.rs

@@ -349,11 +349,11 @@ impl KObject for Serial8250ISADevices {
 
     fn set_name(&self, _name: String) {}
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 
@@ -548,11 +548,11 @@ impl KObject for Serial8250ISADriver {
 
     fn set_name(&self, _name: String) {}
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 

+ 6 - 0
kernel/src/driver/serial/serial8250/serial8250_la64.rs

@@ -1,3 +1,5 @@
+use core::sync::atomic::compiler_fence;
+
 use system_error::SystemError;
 
 use crate::{
@@ -51,10 +53,14 @@ impl Serial8250LA64Port {
 
 #[inline(never)]
 pub(super) fn early_la64_seria8250_init() -> Result<(), SystemError> {
+    compiler_fence(core::sync::atomic::Ordering::SeqCst);
     let port = Serial8250LA64Port::new(UART_PADDR_COM1);
+    compiler_fence(core::sync::atomic::Ordering::SeqCst);
+
     unsafe {
         UART_PORT_COM1 = Some(SpinLock::new(port));
     }
+    compiler_fence(core::sync::atomic::Ordering::SeqCst);
     send_to_default_serial8250_la64_port(b"[DragonOS] loongarch64 debug uart port initialized!\n");
     Ok(())
 }

+ 6 - 6
kernel/src/driver/tty/tty_core.rs

@@ -361,7 +361,7 @@ impl TtyCoreData {
     }
 
     #[inline]
-    pub fn flow_irqsave(&self) -> SpinLockGuard<TtyFlowState> {
+    pub fn flow_irqsave(&self) -> SpinLockGuard<'_, TtyFlowState> {
         self.flow.lock_irqsave()
     }
 
@@ -400,7 +400,7 @@ impl TtyCoreData {
     }
 
     #[inline]
-    pub fn termios_write(&self) -> RwLockWriteGuard<Termios> {
+    pub fn termios_write(&self) -> RwLockWriteGuard<'_, Termios> {
         self.termios.write_irqsave()
     }
 
@@ -443,22 +443,22 @@ impl TtyCoreData {
     }
 
     #[inline]
-    pub fn contorl_info_irqsave(&self) -> SpinLockGuard<TtyControlInfo> {
+    pub fn contorl_info_irqsave(&self) -> SpinLockGuard<'_, TtyControlInfo> {
         self.ctrl.lock_irqsave()
     }
 
     #[inline]
-    pub fn window_size_upgradeable(&self) -> RwLockUpgradableGuard<WindowSize> {
+    pub fn window_size_upgradeable(&self) -> RwLockUpgradableGuard<'_, WindowSize> {
         self.window_size.upgradeable_read()
     }
 
     #[inline]
-    pub fn window_size(&self) -> RwLockReadGuard<WindowSize> {
+    pub fn window_size(&self) -> RwLockReadGuard<'_, WindowSize> {
         self.window_size.read()
     }
 
     #[inline]
-    pub fn window_size_write(&self) -> RwLockWriteGuard<WindowSize> {
+    pub fn window_size_write(&self) -> RwLockWriteGuard<'_, WindowSize> {
         self.window_size.write()
     }
 

+ 3 - 3
kernel/src/driver/tty/tty_device.rs

@@ -141,7 +141,7 @@ impl TtyDevice {
         Arc::new(dev)
     }
 
-    pub fn inner_write(&self) -> RwLockWriteGuard<InnerTtyDevice> {
+    pub fn inner_write(&self) -> RwLockWriteGuard<'_, InnerTtyDevice> {
         self.inner.write()
     }
 
@@ -581,13 +581,13 @@ impl KObject for TtyDevice {
 
     fn kobj_state(
         &self,
-    ) -> crate::libs::rwlock::RwLockReadGuard<crate::driver::base::kobject::KObjectState> {
+    ) -> crate::libs::rwlock::RwLockReadGuard<'_, crate::driver::base::kobject::KObjectState> {
         self.kobj_state.read()
     }
 
     fn kobj_state_mut(
         &self,
-    ) -> crate::libs::rwlock::RwLockWriteGuard<crate::driver::base::kobject::KObjectState> {
+    ) -> crate::libs::rwlock::RwLockWriteGuard<'_, crate::driver::base::kobject::KObjectState> {
         self.kobj_state.write()
     }
 

+ 5 - 5
kernel/src/driver/tty/tty_driver.rs

@@ -245,7 +245,7 @@ impl TtyDriver {
     }
 
     #[inline]
-    pub fn ttys(&self) -> SpinLockGuard<HashMap<usize, Arc<TtyCore>>> {
+    pub fn ttys(&self) -> SpinLockGuard<'_, HashMap<usize, Arc<TtyCore>>> {
         self.ttys.lock()
     }
 
@@ -355,8 +355,8 @@ impl TtyDriver {
     pub fn open_tty(&self, index: Option<usize>) -> Result<Arc<TtyCore>, SystemError> {
         let mut tty: Option<Arc<TtyCore>> = None;
 
-        if index.is_some() {
-            if let Some(t) = self.lookup_tty(index.unwrap()) {
+        if let Some(idx) = index {
+            if let Some(t) = self.lookup_tty(idx) {
                 if t.core().port().is_none() {
                     warn!("{} port is None", t.core().name());
                 } else if t.core().port().unwrap().state() == TtyPortState::KOPENED {
@@ -431,13 +431,13 @@ impl KObject for TtyDriver {
 
     fn kobj_state(
         &self,
-    ) -> crate::libs::rwlock::RwLockReadGuard<crate::driver::base::kobject::KObjectState> {
+    ) -> crate::libs::rwlock::RwLockReadGuard<'_, crate::driver::base::kobject::KObjectState> {
         todo!()
     }
 
     fn kobj_state_mut(
         &self,
-    ) -> crate::libs::rwlock::RwLockWriteGuard<crate::driver::base::kobject::KObjectState> {
+    ) -> crate::libs::rwlock::RwLockWriteGuard<'_, crate::driver::base::kobject::KObjectState> {
         todo!()
     }
 

+ 5 - 5
kernel/src/driver/tty/tty_ldisc/ntty.rs

@@ -42,12 +42,12 @@ pub struct NTtyLinediscipline {
 
 impl NTtyLinediscipline {
     #[inline]
-    pub fn disc_data(&self) -> SpinLockGuard<NTtyData> {
+    pub fn disc_data(&self) -> SpinLockGuard<'_, NTtyData> {
         self.data.lock_irqsave()
     }
 
     #[inline]
-    pub fn disc_data_try_lock(&self) -> Result<SpinLockGuard<NTtyData>, SystemError> {
+    pub fn disc_data_try_lock(&self) -> Result<SpinLockGuard<'_, NTtyData>, SystemError> {
         self.data.try_lock_irqsave()
     }
 
@@ -188,7 +188,7 @@ impl NTtyData {
 
             let mut room = NTTY_BUFSIZE - (self.read_head - tail);
             if termios.input_mode.contains(InputMode::PARMRK) {
-                room = (room + 2) / 3;
+                room = room.div_ceil(3);
             }
 
             room -= 1;
@@ -305,8 +305,8 @@ impl NTtyData {
         let mut f_offset = 0;
         let mut c_offset = 0;
         while count != 0 {
-            if flags.is_some() {
-                flag = flags.as_ref().unwrap()[f_offset];
+            if let Some(flags_slice) = flags.as_ref() {
+                flag = flags_slice[f_offset];
                 f_offset += 1;
             }
 

+ 2 - 2
kernel/src/driver/tty/tty_port.rs

@@ -65,7 +65,7 @@ pub enum TtyPortState {
 }
 
 pub trait TtyPort: Sync + Send + Debug {
-    fn port_data(&self) -> SpinLockGuard<TtyPortData>;
+    fn port_data(&self) -> SpinLockGuard<'_, TtyPortData>;
 
     /// 获取Port的状态
     fn state(&self) -> TtyPortState {
@@ -110,7 +110,7 @@ impl DefaultTtyPort {
 }
 
 impl TtyPort for DefaultTtyPort {
-    fn port_data(&self) -> SpinLockGuard<TtyPortData> {
+    fn port_data(&self) -> SpinLockGuard<'_, TtyPortData> {
         self.port_data.lock_irqsave()
     }
 }

+ 3 - 3
kernel/src/driver/video/fbdev/base/fbcon/framebuffer_console.rs

@@ -619,7 +619,7 @@ impl FrameBufferConsole for BlittingFbConsole {
         bg: u32,
     ) -> Result<(), SystemError> {
         // 向上取整
-        let width = (vc_data.font.width + 7) / 8;
+        let width = vc_data.font.width.div_ceil(8);
         let cellsize = width * vc_data.font.height;
         let fb_info = self.fb();
         // 一次能输出的最大字数,避免帧缓冲区溢出
@@ -653,7 +653,7 @@ impl FrameBufferConsole for BlittingFbConsole {
         Ok(())
     }
 
-    fn fbcon_data(&self) -> SpinLockGuard<super::FrameBufferConsoleData> {
+    fn fbcon_data(&self) -> SpinLockGuard<'_, super::FrameBufferConsoleData> {
         self.fbcon_data.lock()
     }
 
@@ -668,7 +668,7 @@ impl FrameBufferConsole for BlittingFbConsole {
         };
 
         // 向上取整
-        let w = (vc_data.font.width + 7) / 8;
+        let w = vc_data.font.width.div_ceil(8);
         let y = fbcon_data.display.real_y(vc_data.state.y as u32);
 
         let c = vc_data.screen_buf[vc_data.pos];

+ 5 - 5
kernel/src/driver/video/fbdev/base/fbcon/mod.rs

@@ -117,7 +117,7 @@ impl FbConsoleDevice {
         });
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerFbConsoleDevice> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerFbConsoleDevice> {
         self.inner.lock()
     }
 }
@@ -168,11 +168,11 @@ impl KObject for FbConsoleDevice {
         warn!("fbcon name can not be changed");
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 
@@ -364,7 +364,7 @@ pub struct FrameBufferConsoleData {
 }
 
 pub trait FrameBufferConsole {
-    fn fbcon_data(&self) -> SpinLockGuard<FrameBufferConsoleData>;
+    fn fbcon_data(&self) -> SpinLockGuard<'_, FrameBufferConsoleData>;
 
     /// ## 将位块移动到目标位置
     /// 坐标均以字体为单位而不是pixel
@@ -477,7 +477,7 @@ impl FbConAttr {
     pub fn update_attr(&self, dst: &mut [u8], src: &[u8], vc_data: &VirtualConsoleData) {
         let mut offset = if vc_data.font.height < 10 { 1 } else { 2 } as usize;
 
-        let width = (vc_data.font.width + 7) / 8;
+        let width = vc_data.font.width.div_ceil(8);
         let cellsize = (vc_data.font.height * width) as usize;
 
         // 大于offset的部分就是下划线

+ 3 - 3
kernel/src/driver/video/fbdev/base/fbmem.rs

@@ -254,7 +254,7 @@ impl FbDevice {
         DeviceNumber::new(Major::FB_MAJOR, inner_guard.fb_id.data())
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerFbDevice> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerFbDevice> {
         self.inner.lock()
     }
 }
@@ -318,11 +318,11 @@ impl KObject for FbDevice {
         // do nothing
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 

+ 1 - 1
kernel/src/driver/video/fbdev/base/mod.rs

@@ -126,7 +126,7 @@ pub trait FrameBuffer: FrameBufferInfo + FrameBufferOps + Device {
         let mut fgx = fg;
         let mut bgx = bg;
         let ppw = 32 / bpp;
-        let spitch = (image.width + 7) / 8;
+        let spitch = image.width.div_ceil(8);
         let mut color_tab: [u32; 16] = [0; 16];
 
         let tab: &[u32] = match bpp {

+ 5 - 5
kernel/src/driver/video/fbdev/vesafb.rs

@@ -101,7 +101,7 @@ impl VesaFb {
         };
     }
 
-    fn inner(&self) -> SpinLockGuard<InnerVesaFb> {
+    fn inner(&self) -> SpinLockGuard<'_, InnerVesaFb> {
         self.inner.lock()
     }
 }
@@ -259,11 +259,11 @@ impl KObject for VesaFb {
         // do nothing
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 
@@ -847,11 +847,11 @@ impl KObject for VesaFbDriver {
         // do nothing
     }
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 

+ 2 - 1
kernel/src/driver/virtio/transport_mmio.rs

@@ -55,7 +55,8 @@ impl VirtIOMmioTransport {
 
         match unsafe { MmioTransport::new(header) } {
             Ok(mmio_transport) => {
-                info!( "Detected virtio MMIO device with vendor id {:#X}, device type {:?}, version {:?}, hw irq: {}",
+                info!(
+                    "Detected virtio MMIO device with vendor id {:#X}, device type {:?}, version {:?}, hw irq: {}",
                     mmio_transport.vendor_id(),
                     mmio_transport.device_type(),
                     mmio_transport.version(),

+ 2 - 2
kernel/src/driver/virtio/transport_pci.rs

@@ -112,7 +112,7 @@ impl PciTransport {
     ///
     /// - `device` - The PCI device structure for the VirtIO device.
     /// - `irq_handler` - An optional handler for the device's interrupt. If `None`, a default
-    ///     handler `DefaultVirtioIrqHandler` will be used.
+    ///   handler `DefaultVirtioIrqHandler` will be used.
     /// - `irq_number_offset` - Currently, this parameter is just simple make a offset to the irq number, cause it's not be allowed to have the same irq number within different device
     #[allow(clippy::extra_unused_type_parameters)]
     pub fn new<H: Hal>(
@@ -533,7 +533,7 @@ fn get_bar_region<T>(
         .virtual_address()
         .ok_or(VirtioPciError::BarGetVaddrFailed)?)
         + struct_info.offset as usize;
-    if vaddr.data() % align_of::<T>() != 0 {
+    if !vaddr.data().is_multiple_of(align_of::<T>()) {
         return Err(VirtioPciError::Misaligned {
             vaddr,
             alignment: align_of::<T>(),

+ 1 - 0
kernel/src/exception/handle.rs

@@ -358,6 +358,7 @@ fn warn_no_thread(irq: IrqNumber, action_inner: &mut SpinLockGuard<'_, InnerIrqA
 /// `action->percpu_dev_id`是一个指向per-cpu变量的指针,这些变量
 /// 包含调用此处理程序的cpu的真实设备id
 #[derive(Debug)]
+#[allow(dead_code)]
 pub struct PerCpuDevIdIrqHandler;
 
 impl IrqFlowHandler for PerCpuDevIdIrqHandler {

+ 1 - 0
kernel/src/exception/irqchip.rs

@@ -527,6 +527,7 @@ impl IrqManager {
         return Ok(());
     }
 
+    #[allow(dead_code)]
     pub fn irq_percpu_disable(
         &self,
         desc: &Arc<IrqDesc>,

+ 6 - 5
kernel/src/exception/irqdata.rs

@@ -118,19 +118,20 @@ impl IrqData {
         self.inner.lock_irqsave().domain.clone()
     }
 
-    pub fn inner(&self) -> SpinLockGuard<InnerIrqData> {
+    pub fn inner(&self) -> SpinLockGuard<'_, InnerIrqData> {
         self.inner.lock_irqsave()
     }
 
-    pub fn chip_info_read(&self) -> RwLockReadGuard<InnerIrqChipInfo> {
+    #[allow(dead_code)]
+    pub fn chip_info_read(&self) -> RwLockReadGuard<'_, InnerIrqChipInfo> {
         self.chip_info.read()
     }
 
-    pub fn chip_info_read_irqsave(&self) -> RwLockReadGuard<InnerIrqChipInfo> {
+    pub fn chip_info_read_irqsave(&self) -> RwLockReadGuard<'_, InnerIrqChipInfo> {
         self.chip_info.read_irqsave()
     }
 
-    pub fn chip_info_write_irqsave(&self) -> RwLockWriteGuard<InnerIrqChipInfo> {
+    pub fn chip_info_write_irqsave(&self) -> RwLockWriteGuard<'_, InnerIrqChipInfo> {
         self.chip_info.write_irqsave()
     }
 
@@ -311,7 +312,7 @@ impl IrqCommonData {
         self.inner.lock_irqsave().effective_affinity = affinity;
     }
 
-    pub fn inner(&self) -> SpinLockGuard<InnerIrqCommonData> {
+    pub fn inner(&self) -> SpinLockGuard<'_, InnerIrqCommonData> {
         self.inner.lock_irqsave()
     }
 }

+ 6 - 5
kernel/src/exception/irqdesc.rs

@@ -176,7 +176,7 @@ impl IrqDesc {
         *guard
     }
 
-    pub fn inner(&self) -> SpinLockGuard<InnerIrqDesc> {
+    pub fn inner(&self) -> SpinLockGuard<'_, InnerIrqDesc> {
         self.inner.lock_irqsave()
     }
 
@@ -185,7 +185,7 @@ impl IrqDesc {
     }
 
     /// 对中断请求过程加锁
-    pub fn request_mutex_lock(&self) -> MutexGuard<()> {
+    pub fn request_mutex_lock(&self) -> MutexGuard<'_, ()> {
         self.request_mutex.lock()
     }
 
@@ -599,11 +599,11 @@ impl KObject for IrqDesc {
 
     fn set_name(&self, _name: String) {}
 
-    fn kobj_state(&self) -> RwLockReadGuard<KObjectState> {
+    fn kobj_state(&self) -> RwLockReadGuard<'_, KObjectState> {
         self.kobj_state.read()
     }
 
-    fn kobj_state_mut(&self) -> RwLockWriteGuard<KObjectState> {
+    fn kobj_state_mut(&self) -> RwLockWriteGuard<'_, KObjectState> {
         self.kobj_state.write()
     }
 
@@ -675,7 +675,7 @@ impl IrqAction {
         return Arc::new(action);
     }
 
-    pub fn inner(&self) -> SpinLockGuard<InnerIrqAction> {
+    pub fn inner(&self) -> SpinLockGuard<'_, InnerIrqAction> {
         self.inner.lock_irqsave()
     }
 
@@ -717,6 +717,7 @@ impl InnerIrqAction {
         &mut self.dev_id
     }
 
+    #[allow(dead_code)]
     pub fn per_cpu_dev_id(&self) -> Option<&Arc<DeviceId>> {
         self.per_cpu_dev_id.as_ref().map(|v| v.get())
     }

+ 16 - 4
kernel/src/exception/irqdomain.rs

@@ -158,7 +158,13 @@ impl IrqDomainManager {
     ) {
         for i in 0..count {
             if let Err(e) = self.domain_associate(domain, first_irq + i, first_hwirq + i) {
-                warn!("domain associate failed: {:?}, domain '{:?}' didn't like hwirq {} to virq {} mapping.", e, domain.name(), (first_hwirq + i).data(), (first_irq + i).data());
+                warn!(
+                    "domain associate failed: {:?}, domain '{:?}' didn't like hwirq {} to virq {} mapping.",
+                    e,
+                    domain.name(),
+                    (first_hwirq + i).data(),
+                    (first_irq + i).data()
+                );
             }
         }
     }
@@ -204,7 +210,13 @@ impl IrqDomainManager {
         if let Err(e) = r {
             if e != SystemError::ENOSYS {
                 if e != SystemError::EPERM {
-                    info!("domain associate failed: {:?}, domain '{:?}' didn't like hwirq {} to virq {} mapping.", e, domain.name(), hwirq.data(), irq.data());
+                    info!(
+                        "domain associate failed: {:?}, domain '{:?}' didn't like hwirq {} to virq {} mapping.",
+                        e,
+                        domain.name(),
+                        hwirq.data(),
+                        irq.data()
+                    );
                 }
                 let mut irq_data_guard = irq_data.inner();
                 irq_data_guard.set_domain(None);
@@ -532,12 +544,12 @@ impl IrqDomain {
     }
 
     #[allow(dead_code)]
-    fn revmap_read_irqsave(&self) -> RwLockReadGuard<IrqDomainRevMap> {
+    fn revmap_read_irqsave(&self) -> RwLockReadGuard<'_, IrqDomainRevMap> {
         self.revmap.read_irqsave()
     }
 
     #[allow(dead_code)]
-    fn revmap_write_irqsave(&self) -> RwLockWriteGuard<IrqDomainRevMap> {
+    fn revmap_write_irqsave(&self) -> RwLockWriteGuard<'_, IrqDomainRevMap> {
         self.revmap.write_irqsave()
     }
 

+ 11 - 6
kernel/src/exception/manage.rs

@@ -76,8 +76,8 @@ impl IrqManager {
     ///
     /// - irq: 虚拟中断号
     /// - handler: 当中断发生时将被调用的函数,是
-    ///     线程化中断的初级处理程序。如果handler为`None`并且thread_fn不为`None`,
-    ///    将安装默认的初级处理程序
+    ///   线程化中断的初级处理程序。如果handler为`None`并且thread_fn不为`None`,
+    ///   将安装默认的初级处理程序
     /// - thread_fn: 在中断处理程序线程中调用的函数. 如果为`None`,则不会创建irq线程
     /// - flags: 中断处理标志
     ///     - IRQF_SHARED: 中断是共享的
@@ -224,12 +224,14 @@ impl IrqManager {
             .flags()
             .contains(IrqHandleFlags::IRQF_PROBE_SHARED)
         {
-            error!("Flags mismatch for irq {} (name: {}, flags: {:?}). old action name: {}, old flags: {:?}", 
+            error!(
+                "Flags mismatch for irq {} (name: {}, flags: {:?}). old action name: {}, old flags: {:?}",
                 desc.irq_data().irq().data(),
                 action_guard.name(),
                 action_guard.flags(),
                 old_action_guard.name(),
-                old_action_guard.flags());
+                old_action_guard.flags()
+            );
         }
         self.handle_unlock_error(
             SystemError::EBUSY,
@@ -470,7 +472,7 @@ impl IrqManager {
             #[inline(never)]
             fn __tmp_log(irq: &IrqNumber, name: &str) {
                 error!(
-                "Requesting irq {} without a handler, and ONESHOT flags not set for irqaction: {}",
+                    "Requesting irq {} without a handler, and ONESHOT flags not set for irqaction: {}",
                     irq.data(),
                     name,
                 );
@@ -638,7 +640,10 @@ impl IrqManager {
                     new_trigger_type: IrqLineStatus,
                     irq: &IrqNumber,
                 ) {
-                    warn!("Irq {} uses trigger type: {old_trigger_type:?}, but requested trigger type: {new_trigger_type:?}.", irq.data());
+                    warn!(
+                        "Irq {} uses trigger type: {old_trigger_type:?}, but requested trigger type: {new_trigger_type:?}.",
+                        irq.data()
+                    );
                 }
 
                 ___tmp_log_irq_line_status_change(old_trigger_type, new_trigger_type, &irq);

+ 12 - 3
kernel/src/filesystem/devfs/mod.rs

@@ -530,9 +530,18 @@ impl IndexNode for LockedDevFSInode {
                     .collect();
 
                 match key.len() {
-                    0=>{return Err(SystemError::ENOENT);}
-                    1=>{return Ok(key.remove(0));}
-                    _ => panic!("Devfs get_entry_name: key.len()={key_len}>1, current inode_id={inode_id:?}, to find={to_find:?}", key_len=key.len(), inode_id = inode.metadata.inode_id, to_find=ino)
+                    0 => {
+                        return Err(SystemError::ENOENT);
+                    }
+                    1 => {
+                        return Ok(key.remove(0));
+                    }
+                    _ => panic!(
+                        "Devfs get_entry_name: key.len()={key_len}>1, current inode_id={inode_id:?}, to find={to_find:?}",
+                        key_len = key.len(),
+                        inode_id = inode.metadata.inode_id,
+                        to_find = ino
+                    ),
                 }
             }
         }

+ 17 - 5
kernel/src/filesystem/fat/fs.rs

@@ -580,7 +580,10 @@ impl FATFileSystem {
                 match entry {
                     _n if (0x0ffffff7..=0x0fffffff).contains(&current_cluster) => {
                         // 当前簇号不是一个能被获得的簇(可能是文件系统出错了)
-                        error!("FAT32 get fat entry: current cluster number [{}] is not an allocatable cluster number.", current_cluster);
+                        error!(
+                            "FAT32 get fat entry: current cluster number [{}] is not an allocatable cluster number.",
+                            current_cluster
+                        );
                         FATEntry::Bad
                     }
                     0 => FATEntry::Unused,
@@ -890,7 +893,7 @@ impl FATFileSystem {
     /// @brief 获取一个簇迭代器对象
     ///
     /// @param start_cluster 整个FAT链的起始簇号
-    fn cluster_iter(&self, start_cluster: Cluster) -> ClusterIter {
+    fn cluster_iter(&self, start_cluster: Cluster) -> ClusterIter<'_> {
         return ClusterIter {
             current_cluster: Some(start_cluster),
             fs: self,
@@ -1882,9 +1885,18 @@ impl IndexNode for LockedFATInode {
                     .collect();
 
                 match key.len() {
-                    0=>{return Err(SystemError::ENOENT);}
-                    1=>{return Ok(key.remove(0));}
-                    _ => panic!("FatFS get_entry_name: key.len()={key_len}>1, current inode_id={inode_id:?}, to find={to_find:?}", key_len=key.len(), inode_id = guard.metadata.inode_id, to_find=ino)
+                    0 => {
+                        return Err(SystemError::ENOENT);
+                    }
+                    1 => {
+                        return Ok(key.remove(0));
+                    }
+                    _ => panic!(
+                        "FatFS get_entry_name: key.len()={key_len}>1, current inode_id={inode_id:?}, to find={to_find:?}",
+                        key_len = key.len(),
+                        inode_id = guard.metadata.inode_id,
+                        to_find = ino
+                    ),
                 }
             }
         }

+ 1 - 1
kernel/src/filesystem/kernfs/mod.rs

@@ -656,7 +656,7 @@ impl KernFSInode {
         return self.inner.read().parent.upgrade();
     }
 
-    pub fn private_data_mut(&self) -> SpinLockGuard<Option<KernInodePrivateData>> {
+    pub fn private_data_mut(&self) -> SpinLockGuard<'_, Option<KernInodePrivateData>> {
         return self.private_data.lock();
     }
 

+ 3 - 3
kernel/src/filesystem/mbr.rs

@@ -12,7 +12,7 @@ use crate::{
 };
 
 /// @brief MBR硬盘分区表项的结构
-#[repr(packed)]
+#[repr(C, packed)]
 #[derive(Debug, Clone, Copy, Default)]
 pub struct MbrDiskPartitionTableEntry {
     pub flags: u8,                     // 引导标志符,标记此分区为活动分区
@@ -51,7 +51,7 @@ impl MbrDiskPartitionTableEntry {
 }
 
 /// @brief MBR磁盘分区表结构体
-#[repr(packed)]
+#[repr(C, packed)]
 #[derive(Debug, Clone, Copy)]
 pub struct MbrDiskPartionTable {
     pub _reserved: [u8; 446],
@@ -148,7 +148,7 @@ impl MbrDiskPartionTable {
     }
 
     /// # partitions_raw - 获取磁盘的分区信息,不包含磁盘设备信息
-    pub fn partitions_raw(&self) -> MbrPartitionIter {
+    pub fn partitions_raw(&self) -> MbrPartitionIter<'_> {
         MbrPartitionIter::new(self)
     }
 

+ 3 - 7
kernel/src/filesystem/page_cache.rs

@@ -63,7 +63,7 @@ impl InnerPageCache {
     }
 
     fn create_pages(&mut self, start_page_index: usize, buf: &[u8]) -> Result<(), SystemError> {
-        assert!(buf.len() % MMArch::PAGE_SIZE == 0);
+        assert!(buf.len().is_multiple_of(MMArch::PAGE_SIZE));
 
         let page_num = buf.len() / MMArch::PAGE_SIZE;
 
@@ -194,11 +194,7 @@ impl InnerPageCache {
             let copy_len = core::cmp::min((page_index + count) * MMArch::PAGE_SIZE, offset + len)
                 - copy_offset;
 
-            let page_buf_offset = if page_index * MMArch::PAGE_SIZE < copy_offset {
-                copy_offset - page_index * MMArch::PAGE_SIZE
-            } else {
-                0
-            };
+            let page_buf_offset = copy_offset.saturating_sub(page_index * MMArch::PAGE_SIZE);
 
             let buf_offset = copy_offset.saturating_sub(offset);
 
@@ -374,7 +370,7 @@ impl PageCache {
         Ok(())
     }
 
-    pub fn lock_irqsave(&self) -> SpinLockGuard<InnerPageCache> {
+    pub fn lock_irqsave(&self) -> SpinLockGuard<'_, InnerPageCache> {
         if self.inner.is_locked() {
             log::error!("page cache already locked");
         }

+ 13 - 4
kernel/src/filesystem/procfs/mod.rs

@@ -405,7 +405,7 @@ impl ProcFSInode {
 
     fn open_self(&self, _pdata: &mut ProcfsFilePrivateData) -> Result<i64, SystemError> {
         let pid = ProcessManager::current_pid().data();
-        return Ok(pid.to_string().as_bytes().len() as _);
+        return Ok(pid.to_string().len() as _);
     }
 
     // 读取exe文件
@@ -1102,10 +1102,19 @@ impl IndexNode for LockedProcFSInode {
                     .collect();
 
                 match key.len() {
-                        0=>{return Err(SystemError::ENOENT);}
-                        1=>{return Ok(key.remove(0));}
-                        _ => panic!("Procfs get_entry_name: key.len()={key_len}>1, current inode_id={inode_id:?}, to find={to_find:?}", key_len=key.len(), inode_id = inode.metadata.inode_id, to_find=ino)
+                    0 => {
+                        return Err(SystemError::ENOENT);
                     }
+                    1 => {
+                        return Ok(key.remove(0));
+                    }
+                    _ => panic!(
+                        "Procfs get_entry_name: key.len()={key_len}>1, current inode_id={inode_id:?}, to find={to_find:?}",
+                        key_len = key.len(),
+                        inode_id = inode.metadata.inode_id,
+                        to_find = ino
+                    ),
+                }
             }
         }
     }

Some files were not shown because too many files changed in this diff