From 7c28051e8c601312d3d0fd7bcb71bc71450d10c0 Mon Sep 17 00:00:00 2001 From: linfeng Date: Mon, 11 Nov 2024 21:29:15 +0800 Subject: [PATCH] chore: update toolchain version to 2024-11-05 (#1031) * chore: update toolchain version to 2024-11-05 * update dragon reach to e945c217b3 * update dog to 6f2c0c8f12 --------- Co-authored-by: longjin --- .github/workflows/makefile.yml | 16 +- build-scripts/Makefile | 2 +- kernel/Makefile | 8 +- kernel/crates/bitmap/src/alloc_bitmap.rs | 2 +- kernel/crates/bitmap/src/static_bitmap.rs | 12 +- kernel/crates/crc/src/lib.rs | 1 - kernel/crates/ida/src/lib.rs | 7 +- kernel/crates/intertrait/macros/src/lib.rs | 1 - kernel/crates/intertrait/src/lib.rs | 1 + kernel/crates/klog_types/src/lib.rs | 1 - kernel/crates/rbpf/src/insn_builder.rs | 48 +++--- kernel/crates/rbpf/tests/ubpf_vm.rs | 4 + kernel/crates/rust-slabmalloc/src/lib.rs | 6 +- kernel/crates/rust-slabmalloc/src/pages.rs | 8 +- kernel/crates/rust-slabmalloc/src/sc.rs | 3 + kernel/crates/system_error/Cargo.toml | 2 - kernel/crates/system_error/src/lib.rs | 2 +- kernel/rust-toolchain.toml | 2 +- kernel/src/Makefile | 2 +- kernel/src/arch/riscv64/interrupt/entry.rs | 23 +-- kernel/src/arch/riscv64/process/kthread.rs | 5 +- kernel/src/arch/riscv64/process/mod.rs | 14 +- kernel/src/arch/x86_64/interrupt/entry.rs | 5 +- kernel/src/arch/x86_64/mm/mod.rs | 2 +- kernel/src/arch/x86_64/process/kthread.rs | 5 +- kernel/src/arch/x86_64/process/mod.rs | 5 +- kernel/src/arch/x86_64/smp/mod.rs | 6 +- kernel/src/driver/base/block/block_device.rs | 4 +- kernel/src/driver/base/block/gendisk.rs | 1 + kernel/src/driver/base/block/manager.rs | 1 + kernel/src/driver/base/char/mod.rs | 2 +- kernel/src/driver/block/virtio_blk.rs | 1 + kernel/src/driver/disk/ahci/ahci_inode.rs | 153 ------------------ kernel/src/driver/disk/ahci/hba.rs | 3 +- kernel/src/driver/disk/ahci/mod.rs | 1 - kernel/src/driver/firmware/efi/memmap.rs | 2 +- kernel/src/driver/firmware/efi/tables.rs | 3 +- kernel/src/driver/input/serio/serio_driver.rs | 3 +- kernel/src/driver/net/dma.rs | 8 +- kernel/src/driver/net/loopback.rs | 10 +- kernel/src/driver/net/virtio_net.rs | 10 +- kernel/src/driver/open_firmware/fdt.rs | 3 +- kernel/src/driver/pci/pci.rs | 2 +- kernel/src/driver/pci/root.rs | 2 +- kernel/src/driver/scsi/mod.rs | 1 + kernel/src/driver/video/fbdev/base/fbmem.rs | 1 + kernel/src/driver/virtio/irq.rs | 1 - kernel/src/driver/virtio/virtio_impl.rs | 8 +- kernel/src/exception/irqdata.rs | 2 + kernel/src/exception/irqdesc.rs | 10 ++ kernel/src/exception/irqdomain.rs | 4 + kernel/src/exception/manage.rs | 1 + kernel/src/exception/softirq.rs | 4 +- kernel/src/filesystem/fat/bpb.rs | 8 +- kernel/src/filesystem/fat/entry.rs | 8 +- kernel/src/filesystem/fat/fs.rs | 18 ++- kernel/src/filesystem/mbr.rs | 2 +- kernel/src/filesystem/overlayfs/mod.rs | 3 +- kernel/src/filesystem/procfs/syscall.rs | 1 - kernel/src/filesystem/vfs/file.rs | 2 +- kernel/src/init/boot.rs | 1 + kernel/src/init/cmdline.rs | 3 + kernel/src/ipc/signal_types.rs | 1 - kernel/src/lib.rs | 22 ++- kernel/src/libs/casting.rs | 1 - kernel/src/libs/cpumask.rs | 2 +- kernel/src/libs/futex/futex.rs | 2 +- kernel/src/libs/lib_ui/screen_manager.rs | 2 - kernel/src/libs/lib_ui/textui.rs | 6 - kernel/src/libs/rbtree.rs | 16 +- kernel/src/libs/rwlock.rs | 15 +- kernel/src/libs/volatile.rs | 1 - kernel/src/mm/memblock.rs | 4 +- kernel/src/perf/bpf.rs | 2 + kernel/src/perf/util.rs | 2 +- kernel/src/process/exit.rs | 2 +- kernel/src/process/syscall.rs | 2 +- kernel/src/syscall/misc.rs | 3 +- kernel/src/syscall/user_access.rs | 4 +- tools/BUILD_CONTAINER_VERSION | 2 +- tools/Makefile | 2 +- tools/bootstrap.sh | 16 +- tools/debugging/logmonitor/src/app.rs | 2 +- user/apps/clear/Makefile | 2 +- user/apps/test-backlog/Makefile | 2 +- user/apps/test-blockcache/Makefile | 2 +- user/apps/test-for-robustfutex/Makefile | 2 +- user/apps/test-mount/Makefile | 2 +- user/apps/test_alarm/Makefile | 2 +- user/apps/test_ebpf/Makefile | 2 +- .../syscall_ebpf-ebpf/rust-toolchain.toml | 2 +- user/apps/test_namespace/Makefile | 2 +- user/apps/test_namespace/makefile.toml | 2 +- user/apps/test_socket/Makefile | 2 +- user/apps/test_statx/Makefile | 2 +- user/apps/test_tokio/Makefile | 2 +- user/apps/user-manage/Makefile | 2 +- user/dadk/config/dog_0_1_0.dadk | 2 +- user/dadk/config/dragon_reach-0.1.0.dadk | 2 +- 99 files changed, 242 insertions(+), 379 deletions(-) delete mode 100644 kernel/src/driver/disk/ahci/ahci_inode.rs diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml index 6a1612e4a..ecd368a98 100644 --- a/.github/workflows/makefile.yml +++ b/.github/workflows/makefile.yml @@ -12,14 +12,14 @@ jobs: name: Format check ${{ matrix.arch }} runs-on: ubuntu-latest continue-on-error: true - container: dragonos/dragonos-dev:v1.5 + container: dragonos/dragonos-dev:v1.6 strategy: matrix: arch: [x86_64, riscv64] steps: - - run: echo "Running in dragonos/dragonos-dev:v1.5" + - run: echo "Running in dragonos/dragonos-dev:v1.6" - 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.5 + container: dragonos/dragonos-dev:v1.6 strategy: matrix: arch: [x86_64, riscv64] steps: - - run: echo "Running in dragonos/dragonos-dev:v1.5" + - run: echo "Running in dragonos/dragonos-dev:v1.6" - uses: actions/checkout@v3 @@ -56,10 +56,10 @@ jobs: build-x86_64: runs-on: ubuntu-latest - container: dragonos/dragonos-dev:v1.5 + container: dragonos/dragonos-dev:v1.6 steps: - - run: echo "Running in dragonos/dragonos-dev:v1.5" + - run: echo "Running in dragonos/dragonos-dev:v1.6" - uses: actions/checkout@v3 - name: build the DragonOS @@ -78,10 +78,10 @@ jobs: build-riscv64: runs-on: ubuntu-latest - container: dragonos/dragonos-dev:v1.5 + container: dragonos/dragonos-dev:v1.6 steps: - - run: echo "Running in dragonos/dragonos-dev:v1.5" + - run: echo "Running in dragonos/dragonos-dev:v1.6" - uses: actions/checkout@v3 with: diff --git a/build-scripts/Makefile b/build-scripts/Makefile index 14c1bd930..35c6edd58 100644 --- a/build-scripts/Makefile +++ b/build-scripts/Makefile @@ -5,4 +5,4 @@ fmt: clean: @cargo clean check: - @cargo +nightly-2024-07-23 check --workspace $(CARGO_ZBUILD) --message-format=json + @cargo +nightly-2024-11-05 check --workspace $(CARGO_ZBUILD) --message-format=json diff --git a/kernel/Makefile b/kernel/Makefile index 90543aafe..ac09fc83c 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -36,14 +36,14 @@ check: ECHO # @echo "Checking kernel... ARCH=$(ARCH)" # @exit 1 ifeq ($(ARCH), x86_64) - RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2024-07-23 check --workspace $(CARGO_ZBUILD) --message-format=json --target ./src/$(TARGET_JSON) + RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2024-11-05 check --workspace $(CARGO_ZBUILD) --message-format=json --target ./src/$(TARGET_JSON) else ifeq ($(ARCH), riscv64) - RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2024-07-23 check --workspace $(CARGO_ZBUILD) --message-format=json --target $(TARGET_JSON) + RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2024-11-05 check --workspace $(CARGO_ZBUILD) --message-format=json --target $(TARGET_JSON) endif test: # 测试内核库 - RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2024-07-23 test --workspace --exclude dragonos_kernel rbpf + RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2024-11-05 test --workspace --exclude dragonos_kernel rbpf test-rbpf: - cd crates/rbpf && RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2024-07-23 test --features=std,user,cranelift \ No newline at end of file + cd crates/rbpf && RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2024-11-05 test --features=std,user,cranelift \ No newline at end of file diff --git a/kernel/crates/bitmap/src/alloc_bitmap.rs b/kernel/crates/bitmap/src/alloc_bitmap.rs index d78ceb818..4e3238660 100644 --- a/kernel/crates/bitmap/src/alloc_bitmap.rs +++ b/kernel/crates/bitmap/src/alloc_bitmap.rs @@ -13,7 +13,7 @@ pub struct AllocBitmap { impl AllocBitmap { pub fn new(elements: usize) -> Self { - let data = vec![0usize; (elements + usize::BITS as usize - 1) / (usize::BITS as usize)]; + let data = vec![0usize; elements.div_ceil(usize::BITS as usize)]; Self { elements, data, diff --git a/kernel/crates/bitmap/src/static_bitmap.rs b/kernel/crates/bitmap/src/static_bitmap.rs index c391a7da0..9f6fdacb0 100644 --- a/kernel/crates/bitmap/src/static_bitmap.rs +++ b/kernel/crates/bitmap/src/static_bitmap.rs @@ -8,15 +8,15 @@ use crate::{bitmap_core::BitMapCore, traits::BitMapOps}; #[derive(Debug, Clone)] pub struct StaticBitmap where - [(); (N + usize::BITS as usize - 1) / (usize::BITS as usize)]:, + [(); N.div_ceil(usize::BITS as usize)]:, { - pub data: [usize; (N + usize::BITS as usize - 1) / (usize::BITS as usize)], + pub data: [usize; N.div_ceil(usize::BITS as usize)], core: BitMapCore, } impl Default for StaticBitmap where - [(); (N + usize::BITS as usize - 1) / (usize::BITS as usize)]:, + [(); N.div_ceil(usize::BITS as usize)]:, { fn default() -> Self { Self::new() @@ -25,12 +25,12 @@ where impl StaticBitmap where - [(); (N + usize::BITS as usize - 1) / (usize::BITS as usize)]:, + [(); N.div_ceil(usize::BITS as usize)]:, { /// 创建一个新的静态位图 pub const fn new() -> Self { Self { - data: [0; (N + usize::BITS as usize - 1) / (usize::BITS as usize)], + data: [0; N.div_ceil(usize::BITS as usize)], core: BitMapCore::new(), } } @@ -38,7 +38,7 @@ where impl BitMapOps for StaticBitmap where - [(); (N + usize::BITS as usize - 1) / (usize::BITS as usize)]:, + [(); N.div_ceil(usize::BITS as usize)]:, { #[inline] fn get(&self, index: usize) -> Option { diff --git a/kernel/crates/crc/src/lib.rs b/kernel/crates/crc/src/lib.rs index 5f9a2b7c7..2a039223a 100644 --- a/kernel/crates/crc/src/lib.rs +++ b/kernel/crates/crc/src/lib.rs @@ -1,6 +1,5 @@ #![cfg_attr(not(test), no_std)] #![feature(const_for)] -#![feature(const_mut_refs)] #![feature(const_trait_impl)] #![allow(clippy::needless_return)] diff --git a/kernel/crates/ida/src/lib.rs b/kernel/crates/ida/src/lib.rs index d9676bc92..29c89e159 100644 --- a/kernel/crates/ida/src/lib.rs +++ b/kernel/crates/ida/src/lib.rs @@ -16,7 +16,7 @@ struct EmptyIdaItemRef<'a> { _marker: PhantomData<&'a EmptyIdaItem>, } -impl<'a> Deref for EmptyIdaItemRef<'a> { +impl Deref for EmptyIdaItemRef<'_> { type Target = EmptyIdaItem; fn deref(&self) -> &Self::Target { @@ -27,7 +27,10 @@ impl<'a> Deref for EmptyIdaItemRef<'a> { struct EmptyIdaItem; unsafe impl kdepends::xarray::ItemEntry for EmptyIdaItem { - type Ref<'a> = EmptyIdaItemRef<'a> where Self: 'a; + type Ref<'a> + = EmptyIdaItemRef<'a> + where + Self: 'a; fn into_raw(self) -> *const () { core::ptr::null() diff --git a/kernel/crates/intertrait/macros/src/lib.rs b/kernel/crates/intertrait/macros/src/lib.rs index e050e6abb..5a4339052 100644 --- a/kernel/crates/intertrait/macros/src/lib.rs +++ b/kernel/crates/intertrait/macros/src/lib.rs @@ -61,7 +61,6 @@ mod item_type; /// #[derive(std::fmt::Debug)] /// struct Data; /// ``` - #[proc_macro_attribute] pub fn cast_to(args: TokenStream, input: TokenStream) -> TokenStream { match parse::(args) { diff --git a/kernel/crates/intertrait/src/lib.rs b/kernel/crates/intertrait/src/lib.rs index 59e5e5d55..75073dfe3 100644 --- a/kernel/crates/intertrait/src/lib.rs +++ b/kernel/crates/intertrait/src/lib.rs @@ -122,6 +122,7 @@ static CASTER_MAP: once_cell::sync::Lazy> = None; #[cfg(target_os = "none")] +#[allow(static_mut_refs)] pub fn caster_map() -> &'static HashMap<(TypeId, TypeId), BoxedCaster, BuildFastHasher> { return unsafe { CASTER_MAP.as_ref().unwrap_or_else(|| { diff --git a/kernel/crates/klog_types/src/lib.rs b/kernel/crates/klog_types/src/lib.rs index 22db10681..91ab47fa4 100644 --- a/kernel/crates/klog_types/src/lib.rs +++ b/kernel/crates/klog_types/src/lib.rs @@ -1,5 +1,4 @@ #![no_std] -#![feature(const_refs_to_cell)] #![feature(const_size_of_val)] #![allow(clippy::needless_return)] diff --git a/kernel/crates/rbpf/src/insn_builder.rs b/kernel/crates/rbpf/src/insn_builder.rs index 2b8b6c0d8..d67c431be 100644 --- a/kernel/crates/rbpf/src/insn_builder.rs +++ b/kernel/crates/rbpf/src/insn_builder.rs @@ -74,7 +74,7 @@ pub trait IntoBytes { } /// General implementation of `IntoBytes` for `Instruction` -impl<'i, I: Instruction> IntoBytes for &'i I { +impl IntoBytes for &'_ I { type Bytes = Vec; /// transform immutable reference of `Instruction` into `Vec` with size of 8 @@ -347,7 +347,7 @@ impl<'i> Move<'i> { } } -impl<'i> Instruction for Move<'i> { +impl Instruction for Move<'_> { fn opt_code_byte(&self) -> u8 { let op_bits = self.op_bits as u8; let src_bit = self.src_bit as u8; @@ -415,7 +415,7 @@ impl<'i> SwapBytes<'i> { } } -impl<'i> Instruction for SwapBytes<'i> { +impl Instruction for SwapBytes<'_> { fn opt_code_byte(&self) -> u8 { self.endian as u8 } @@ -456,20 +456,20 @@ impl<'i> Load<'i> { } } -impl<'i> Instruction for Load<'i> { +impl Instruction for Load<'_> { fn opt_code_byte(&self) -> u8 { let size = self.mem_size as u8; let addressing = self.addressing as u8; addressing | size | self.source } - fn get_insn_mut(&mut self) -> &mut Insn { - &mut self.insn - } - fn get_insn(&self) -> &Insn { &self.insn } + + fn get_insn_mut(&mut self) -> &mut Insn { + &mut self.insn + } } /// struct representation of STORE instructions @@ -489,19 +489,19 @@ impl<'i> Store<'i> { } } -impl<'i> Instruction for Store<'i> { +impl Instruction for Store<'_> { fn opt_code_byte(&self) -> u8 { let size = self.mem_size as u8; BPF_MEM | BPF_ST | size | self.source } - fn get_insn_mut(&mut self) -> &mut Insn { - &mut self.insn - } - fn get_insn(&self) -> &Insn { &self.insn } + + fn get_insn_mut(&mut self) -> &mut Insn { + &mut self.insn + } } #[derive(Copy, Clone)] @@ -542,20 +542,20 @@ impl<'i> Jump<'i> { } } -impl<'i> Instruction for Jump<'i> { +impl Instruction for Jump<'_> { fn opt_code_byte(&self) -> u8 { let cmp: u8 = self.cond as u8; let src_bit = self.src_bit as u8; cmp | src_bit | BPF_JMP } - fn get_insn_mut(&mut self) -> &mut Insn { - &mut self.insn - } - fn get_insn(&self) -> &Insn { &self.insn } + + fn get_insn_mut(&mut self) -> &mut Insn { + &mut self.insn + } } #[derive(Copy, Clone, PartialEq, Eq)] @@ -602,18 +602,18 @@ impl<'i> FunctionCall<'i> { } } -impl<'i> Instruction for FunctionCall<'i> { +impl Instruction for FunctionCall<'_> { fn opt_code_byte(&self) -> u8 { BPF_CALL | BPF_JMP } - fn get_insn_mut(&mut self) -> &mut Insn { - &mut self.insn - } - fn get_insn(&self) -> &Insn { &self.insn } + + fn get_insn_mut(&mut self) -> &mut Insn { + &mut self.insn + } } /// struct representation of EXIT instruction @@ -631,7 +631,7 @@ impl<'i> Exit<'i> { } } -impl<'i> Instruction for Exit<'i> { +impl Instruction for Exit<'_> { fn opt_code_byte(&self) -> u8 { BPF_EXIT | BPF_JMP } diff --git a/kernel/crates/rbpf/tests/ubpf_vm.rs b/kernel/crates/rbpf/tests/ubpf_vm.rs index 05d8a9baa..4b2f1c36d 100644 --- a/kernel/crates/rbpf/tests/ubpf_vm.rs +++ b/kernel/crates/rbpf/tests/ubpf_vm.rs @@ -2316,8 +2316,12 @@ fn test_vm_stdw() { // If this case is not handled properly in check_mem(), then we may overflow when adding the // context address and the offset, and make the thread panic with "attempt to add with overflow". // Check that we panic with the expected out-of-bounds error. +// +// The new toolchain introduced `assert_unsafe_precondition` which panics with a different message and can't be +// caught by `#[should_panic]`. This is why we use `#[ignore]` here. #[test] #[should_panic(expected = "Error: out of bounds memory store (insn #1)")] +#[ignore] fn test_vm_stdw_add_overflow() { let prog = assemble( " diff --git a/kernel/crates/rust-slabmalloc/src/lib.rs b/kernel/crates/rust-slabmalloc/src/lib.rs index 5b995fd91..a286f311e 100644 --- a/kernel/crates/rust-slabmalloc/src/lib.rs +++ b/kernel/crates/rust-slabmalloc/src/lib.rs @@ -18,11 +18,9 @@ //! # Implementing GlobalAlloc //! See the [global alloc](https://github.com/gz/rust-slabmalloc/tree/master/examples/global_alloc.rs) example. #![allow(unused_features)] -#![cfg_attr(feature = "unstable", feature(const_mut_refs))] #![no_std] #![crate_name = "slabmalloc"] #![crate_type = "lib"] -#![feature(new_uninit)] #![feature(maybe_uninit_as_bytes)] extern crate alloc; @@ -65,6 +63,8 @@ pub enum AllocationError { /// Needs to adhere to safety requirements of a rust allocator (see GlobalAlloc et. al.). pub unsafe trait Allocator<'a> { fn allocate(&mut self, layout: Layout) -> Result, AllocationError>; + /// # Safety + /// The caller must ensure that the memory is valid and that the layout is correct. unsafe fn deallocate( &mut self, ptr: NonNull, @@ -85,5 +85,7 @@ pub unsafe trait Allocator<'a> { /// 将slab_page归还Buddy的回调函数 pub trait CallBack: Send + Sync { + /// # Safety + /// The caller must ensure that the memory is valid and that the size is correct. unsafe fn free_slab_page(&self, _: *mut u8, _: usize) {} } diff --git a/kernel/crates/rust-slabmalloc/src/pages.rs b/kernel/crates/rust-slabmalloc/src/pages.rs index 1e92eb7e0..22f3231f0 100644 --- a/kernel/crates/rust-slabmalloc/src/pages.rs +++ b/kernel/crates/rust-slabmalloc/src/pages.rs @@ -303,10 +303,10 @@ impl<'a> ObjectPage<'a> { } // These needs some more work to be really safe... -unsafe impl<'a> Send for ObjectPage<'a> {} -unsafe impl<'a> Sync for ObjectPage<'a> {} +unsafe impl Send for ObjectPage<'_> {} +unsafe impl Sync for ObjectPage<'_> {} -impl<'a> AllocablePage for ObjectPage<'a> { +impl AllocablePage for ObjectPage<'_> { const SIZE: usize = OBJECT_PAGE_SIZE; fn bitfield(&self) -> &[AtomicU64; 8] { @@ -331,7 +331,7 @@ impl<'a> Default for ObjectPage<'a> { } } -impl<'a> fmt::Debug for ObjectPage<'a> { +impl fmt::Debug for ObjectPage<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "ObjectPage") } diff --git a/kernel/crates/rust-slabmalloc/src/sc.rs b/kernel/crates/rust-slabmalloc/src/sc.rs index a17f5770b..2c711bb18 100644 --- a/kernel/crates/rust-slabmalloc/src/sc.rs +++ b/kernel/crates/rust-slabmalloc/src/sc.rs @@ -314,6 +314,9 @@ impl<'a, P: AllocablePage> SCAllocator<'a, P> { /// May return an error in case an invalid `layout` is provided. /// The function may also move internal slab pages between lists partial -> empty /// or full -> partial lists. + /// + /// # Safety + /// The caller must ensure that the `layout` is valid. pub unsafe fn deallocate( &mut self, ptr: NonNull, diff --git a/kernel/crates/system_error/Cargo.toml b/kernel/crates/system_error/Cargo.toml index ccca15c6b..d166286a9 100644 --- a/kernel/crates/system_error/Cargo.toml +++ b/kernel/crates/system_error/Cargo.toml @@ -6,7 +6,5 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -kdepends = { path = "../kdepends" } num-traits = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/num-traits.git", rev="1597c1c", default-features = false } -num = { version = "0.4.0", default-features = false } num-derive = "0.3" \ No newline at end of file diff --git a/kernel/crates/system_error/src/lib.rs b/kernel/crates/system_error/src/lib.rs index 3d81cdf80..441b4b13e 100644 --- a/kernel/crates/system_error/src/lib.rs +++ b/kernel/crates/system_error/src/lib.rs @@ -1,7 +1,7 @@ #![no_std] #![allow(clippy::needless_return)] #![allow(clippy::upper_case_acronyms)] - +#![allow(non_local_definitions)] use num_derive::{FromPrimitive, ToPrimitive}; #[repr(i32)] diff --git a/kernel/rust-toolchain.toml b/kernel/rust-toolchain.toml index 325731828..90975d401 100644 --- a/kernel/rust-toolchain.toml +++ b/kernel/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2024-07-23" +channel = "nightly-2024-11-05" components = ["rust-src", "clippy"] \ No newline at end of file diff --git a/kernel/src/Makefile b/kernel/src/Makefile index 7476a48bf..f78d7cfbb 100644 --- a/kernel/src/Makefile +++ b/kernel/src/Makefile @@ -40,7 +40,7 @@ kernel_subdirs := debug kernel_rust: - RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2024-07-23 $(CARGO_ZBUILD) build --release --target $(TARGET_JSON) + RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2024-11-05 $(CARGO_ZBUILD) build --release --target $(TARGET_JSON) all: kernel diff --git a/kernel/src/arch/riscv64/interrupt/entry.rs b/kernel/src/arch/riscv64/interrupt/entry.rs index 31dd785bc..bcb77e493 100644 --- a/kernel/src/arch/riscv64/interrupt/entry.rs +++ b/kernel/src/arch/riscv64/interrupt/entry.rs @@ -4,7 +4,6 @@ use crate::arch::{ interrupt::TrapFrame, }; use asm_macros::{restore_from_x6_to_x31, save_from_x6_to_x31}; -use core::arch::asm; use kdepends::memoffset::offset_of; /// Riscv64中断处理入口 @@ -12,7 +11,7 @@ use kdepends::memoffset::offset_of; #[no_mangle] #[repr(align(4))] pub unsafe extern "C" fn handle_exception() -> ! { - asm!( + core::arch::naked_asm!( concat!(" /* * If coming from userspace, preserve the user thread pointer and load @@ -27,15 +26,14 @@ pub unsafe extern "C" fn handle_exception() -> ! { j {_restore_kernel_tpsp} "), csr_scratch = const CSR_SSCRATCH, - _restore_kernel_tpsp = sym _restore_kernel_tpsp, - options(noreturn), + _restore_kernel_tpsp = sym _restore_kernel_tpsp ) } #[naked] #[no_mangle] unsafe extern "C" fn _restore_kernel_tpsp() -> ! { - asm!( + core::arch::naked_asm!( concat!(" // 这次是从内核态进入中断 // 从sscratch寄存器加载当前cpu的上下文 @@ -48,16 +46,14 @@ unsafe extern "C" fn _restore_kernel_tpsp() -> ! { "), csr_scratch = const CSR_SSCRATCH, lc_off_kernel_sp = const offset_of!(LocalContext, kernel_sp), - _save_context = sym _save_context, - - options(noreturn), + _save_context = sym _save_context ) } #[naked] #[no_mangle] unsafe extern "C" fn _save_context() -> ! { - asm!( + core::arch::naked_asm!( concat!(" @@ -164,15 +160,14 @@ unsafe extern "C" fn _save_context() -> ! { csr_epc = const CSR_SEPC, csr_tval = const CSR_STVAL, csr_cause = const CSR_SCAUSE, - csr_scratch = const CSR_SSCRATCH, - options(noreturn), + csr_scratch = const CSR_SSCRATCH ) } #[naked] #[no_mangle] pub unsafe extern "C" fn ret_from_exception() -> ! { - asm!( + core::arch::naked_asm!( concat!(" ld s0, {off_status}(sp) andi s0, s0, {sr_spp} @@ -249,8 +244,6 @@ pub unsafe extern "C" fn ret_from_exception() -> ! { off_t6 = const offset_of!(TrapFrame, t6), off_sp = const offset_of!(TrapFrame, sp), off_tp = const offset_of!(TrapFrame, tp), - off_epc = const offset_of!(TrapFrame, epc), - - options(noreturn), + off_epc = const offset_of!(TrapFrame, epc) ) } diff --git a/kernel/src/arch/riscv64/process/kthread.rs b/kernel/src/arch/riscv64/process/kthread.rs index 610c8acd4..55d2789cb 100644 --- a/kernel/src/arch/riscv64/process/kthread.rs +++ b/kernel/src/arch/riscv64/process/kthread.rs @@ -66,7 +66,7 @@ impl KernelThreadMechanism { pub(super) unsafe extern "C" fn kernel_thread_bootstrap_stage1() { // 这个函数要是naked的,只是因为现在还没有实现,而naked func不能打`unimplemented!()` // 所以先写成了普通函数 - asm!(concat!( + core::arch::naked_asm!(concat!( " ld x3, {off_gp}(sp) ld x5, {off_t0}(sp) @@ -111,8 +111,7 @@ pub(super) unsafe extern "C" fn kernel_thread_bootstrap_stage1() { off_t4 = const offset_of!(TrapFrame, t4), off_t5 = const offset_of!(TrapFrame, t5), off_t6 = const offset_of!(TrapFrame, t6), - stage2_func = sym jump_to_stage2, - options(noreturn), + stage2_func = sym jump_to_stage2 ); } diff --git a/kernel/src/arch/riscv64/process/mod.rs b/kernel/src/arch/riscv64/process/mod.rs index f7d4e2258..61b05fcb6 100644 --- a/kernel/src/arch/riscv64/process/mod.rs +++ b/kernel/src/arch/riscv64/process/mod.rs @@ -78,9 +78,8 @@ pub unsafe fn arch_switch_to_user(trap_frame: TrapFrame) -> ! { #[naked] unsafe extern "C" fn ready_to_switch_to_user(trap_frame: usize, new_pc: usize) -> ! { - asm!( - concat!( - " + core::arch::naked_asm!(concat!( + " // 设置trap frame mv sp, a0 // 设置返回地址 @@ -88,9 +87,7 @@ unsafe extern "C" fn ready_to_switch_to_user(trap_frame: usize, new_pc: usize) - jr a1 " - ), - options(noreturn) - ); + )); } impl ProcessManager { @@ -227,7 +224,7 @@ impl ProcessManager { /// 参考 https://code.dragonos.org.cn/xref/linux-6.6.21/arch/riscv/kernel/entry.S#233 #[naked] unsafe extern "C" fn switch_to_inner(prev: *mut ArchPCBInfo, next: *mut ArchPCBInfo) { - core::arch::asm!(concat!( + core::arch::naked_asm!(concat!( " sd ra, {off_ra}(a0) sd sp, {off_sp}(a0) @@ -304,8 +301,7 @@ unsafe extern "C" fn switch_to_inner(prev: *mut ArchPCBInfo, next: *mut ArchPCBI off_s9 = const(offset_of!(ArchPCBInfo, s9)), off_s10 = const(offset_of!(ArchPCBInfo, s10)), off_s11 = const(offset_of!(ArchPCBInfo, s11)), - before_switch_finish_hook = sym before_switch_finish_hook, - options(noreturn)); + before_switch_finish_hook = sym before_switch_finish_hook); } /// 在切换上下文完成后的钩子函数(必须在这里加一个跳转函数,否则会出现relocation truncated to fit: R_RISCV_JAL错误) diff --git a/kernel/src/arch/x86_64/interrupt/entry.rs b/kernel/src/arch/x86_64/interrupt/entry.rs index 31e53a20f..072ec4ddb 100644 --- a/kernel/src/arch/x86_64/interrupt/entry.rs +++ b/kernel/src/arch/x86_64/interrupt/entry.rs @@ -45,7 +45,7 @@ macro_rules! interrupt_handler { #[naked] #[no_mangle] unsafe extern "C" fn []() { - core::arch::asm!( + core::arch::naked_asm!( concat!( " push 0x0 @@ -60,8 +60,7 @@ macro_rules! interrupt_handler { jmp x86_64_do_irq " ), - irqnum = const($name), - options(noreturn) + irqnum = const($name) ); } } diff --git a/kernel/src/arch/x86_64/mm/mod.rs b/kernel/src/arch/x86_64/mm/mod.rs index f96c96f4d..85753f9ca 100644 --- a/kernel/src/arch/x86_64/mm/mod.rs +++ b/kernel/src/arch/x86_64/mm/mod.rs @@ -500,7 +500,7 @@ unsafe fn allocator_init() { for i in 0..total_num { let area = mem_block_manager().get_initial_memory_region(i).unwrap(); // debug!("area: base={:?}, size={:#x}, end={:?}", area.base, area.size, area.base + area.size); - for i in 0..((area.size + MMArch::PAGE_SIZE - 1) / MMArch::PAGE_SIZE) { + for i in 0..area.size.div_ceil(MMArch::PAGE_SIZE) { let paddr = area.base.add(i * MMArch::PAGE_SIZE); let vaddr = unsafe { MMArch::phys_2_virt(paddr) }.unwrap(); let flags = kernel_page_flags::(vaddr); diff --git a/kernel/src/arch/x86_64/process/kthread.rs b/kernel/src/arch/x86_64/process/kthread.rs index 58f6df1f8..612449e06 100644 --- a/kernel/src/arch/x86_64/process/kthread.rs +++ b/kernel/src/arch/x86_64/process/kthread.rs @@ -1,5 +1,3 @@ -use core::arch::asm; - use alloc::sync::Arc; use system_error::SystemError; @@ -61,7 +59,7 @@ impl KernelThreadMechanism { /// 跳转之后,指向Box的指针将传入到stage2的函数 #[naked] pub(super) unsafe extern "sysv64" fn kernel_thread_bootstrap_stage1() { - asm!( + core::arch::naked_asm!( concat!( " @@ -92,6 +90,5 @@ pub(super) unsafe extern "sysv64" fn kernel_thread_bootstrap_stage1() { " ), stage2_func = sym kernel_thread_bootstrap_stage2, - options(noreturn) ) } diff --git a/kernel/src/arch/x86_64/process/mod.rs b/kernel/src/arch/x86_64/process/mod.rs index be2f53387..674852d07 100644 --- a/kernel/src/arch/x86_64/process/mod.rs +++ b/kernel/src/arch/x86_64/process/mod.rs @@ -425,7 +425,7 @@ impl ProcessManager { /// 保存上下文,然后切换进程,接着jmp到`switch_finish_hook`钩子函数 #[naked] unsafe extern "sysv64" fn switch_to_inner(prev: *mut ArchPCBInfo, next: *mut ArchPCBInfo) { - asm!( + core::arch::naked_asm!( // As a quick reminder for those who are unfamiliar with the System V ABI (extern "C"): // // - the current parameters are passed in the registers `rdi`, `rsi`, @@ -498,13 +498,12 @@ unsafe extern "sysv64" fn switch_to_inner(prev: *mut ArchPCBInfo, next: *mut Arc off_gs = const(offset_of!(ArchPCBInfo, gs)), switch_hook = sym crate::process::switch_finish_hook, - options(noreturn), ); } #[naked] unsafe extern "sysv64" fn switch_back() -> ! { - asm!("ret", options(noreturn)); + core::arch::naked_asm!("ret"); } pub unsafe fn arch_switch_to_user(trap_frame: TrapFrame) -> ! { diff --git a/kernel/src/arch/x86_64/smp/mod.rs b/kernel/src/arch/x86_64/smp/mod.rs index 2eaa5fc74..eec877b86 100644 --- a/kernel/src/arch/x86_64/smp/mod.rs +++ b/kernel/src/arch/x86_64/smp/mod.rs @@ -1,5 +1,4 @@ use core::{ - arch::asm, hint::spin_loop, sync::atomic::{compiler_fence, fence, AtomicBool, Ordering}, }; @@ -65,14 +64,13 @@ unsafe extern "C" fn smp_ap_start() -> ! { #[naked] unsafe extern "sysv64" fn smp_init_switch_stack(st: &ApStartStackInfo) -> ! { - asm!(concat!(" + core::arch::naked_asm!(concat!(" mov rsp, [rdi + {off_rsp}] mov rbp, [rdi + {off_rsp}] jmp {stage1} "), off_rsp = const(offset_of!(ApStartStackInfo, vaddr)), - stage1 = sym smp_ap_start_stage1, - options(noreturn)); + stage1 = sym smp_ap_start_stage1); } unsafe extern "C" fn smp_ap_start_stage1() -> ! { diff --git a/kernel/src/driver/base/block/block_device.rs b/kernel/src/driver/base/block/block_device.rs index 2a9a9b1e9..c02464a0b 100644 --- a/kernel/src/driver/base/block/block_device.rs +++ b/kernel/src/driver/base/block/block_device.rs @@ -20,8 +20,8 @@ use system_error::SystemError; use super::{disk_info::Partition, gendisk::GenDisk, manager::BlockDevMeta}; -/// 该文件定义了 Device 和 BlockDevice 的接口 -/// Notice 设备错误码使用 Posix 规定的 int32_t 的错误码表示,而不是自己定义错误enum +// 该文件定义了 Device 和 BlockDevice 的接口 +// Notice 设备错误码使用 Posix 规定的 int32_t 的错误码表示,而不是自己定义错误enum // 使用方法: // 假设 blk_dev 是块设备 diff --git a/kernel/src/driver/base/block/gendisk.rs b/kernel/src/driver/base/block/gendisk.rs index 699d01af0..ba2818391 100644 --- a/kernel/src/driver/base/block/gendisk.rs +++ b/kernel/src/driver/base/block/gendisk.rs @@ -161,6 +161,7 @@ impl GenDiskMap { } #[inline] + #[allow(dead_code)] pub fn max_idx(&self) -> u32 { self.max_idx.load(Ordering::SeqCst) } diff --git a/kernel/src/driver/base/block/manager.rs b/kernel/src/driver/base/block/manager.rs index 5ebda4c7b..7fe6c2919 100644 --- a/kernel/src/driver/base/block/manager.rs +++ b/kernel/src/driver/base/block/manager.rs @@ -134,6 +134,7 @@ impl BlockDevManager { } /// 卸载磁盘设备 + #[allow(dead_code)] pub fn unregister(&self, dev: &Arc) { let mut inner = self.inner(); inner.disks.remove(dev.dev_name()); diff --git a/kernel/src/driver/base/char/mod.rs b/kernel/src/driver/base/char/mod.rs index 090abef18..f6ca986ba 100644 --- a/kernel/src/driver/base/char/mod.rs +++ b/kernel/src/driver/base/char/mod.rs @@ -18,7 +18,7 @@ use super::{ pub trait CharDevice: Device { /// Notice buffer对应设备按字节划分,使用u8类型 /// Notice offset应该从0开始计数 - + /// /// @brief: 从设备的第offset个字节开始,读取len个byte,存放到buf中 /// @parameter offset: 起始字节偏移量 /// @parameter len: 读取字节的数量 diff --git a/kernel/src/driver/block/virtio_blk.rs b/kernel/src/driver/block/virtio_blk.rs index 6240263b5..ce8ac62c1 100644 --- a/kernel/src/driver/block/virtio_blk.rs +++ b/kernel/src/driver/block/virtio_blk.rs @@ -137,6 +137,7 @@ impl VirtIOBlkManager { BlockDevName::new(format!("vd{}", x), id) } + #[allow(dead_code)] pub fn free_id(&self, id: usize) { if id >= Self::MAX_DEVICES { return; diff --git a/kernel/src/driver/disk/ahci/ahci_inode.rs b/kernel/src/driver/disk/ahci/ahci_inode.rs deleted file mode 100644 index ec0bed271..000000000 --- a/kernel/src/driver/disk/ahci/ahci_inode.rs +++ /dev/null @@ -1,153 +0,0 @@ -use crate::driver::base::block::block_device::BlockDevice; -use crate::driver::base::device::device_number::{DeviceNumber, Major}; -use crate::filesystem::devfs::{DevFS, DeviceINode}; -use crate::filesystem::vfs::file::FileMode; -use crate::filesystem::vfs::syscall::ModeType; -use crate::filesystem::vfs::{ - core::generate_inode_id, FilePrivateData, FileSystem, FileType, IndexNode, Metadata, -}; -use crate::libs::spinlock::SpinLockGuard; -use crate::{libs::spinlock::SpinLock, time::PosixTimeSpec}; -use alloc::{ - string::String, - sync::{Arc, Weak}, - vec::Vec, -}; -use system_error::SystemError; - -use super::ahcidisk::LockedAhciDisk; - -#[derive(Debug)] -pub struct AhciInode { - /// uuid 暂时不知道有什么用(x - // uuid: Uuid, - /// 指向自身的弱引用 - self_ref: Weak, - /// 指向inode所在的文件系统对象的指针 - fs: Weak, - /// INode 元数据 - metadata: Metadata, - /// INode 对应的磁盘 - disk: Arc, -} - -#[derive(Debug)] -pub struct LockedAhciInode(pub SpinLock); - -impl LockedAhciInode { - pub fn new(disk: Arc) -> Arc { - let inode = AhciInode { - // uuid: Uuid::new_v5(), - self_ref: Weak::default(), - fs: Weak::default(), - disk, - metadata: Metadata { - dev_id: 1, - inode_id: generate_inode_id(), - size: 0, - blk_size: 0, - blocks: 0, - atime: PosixTimeSpec::default(), - mtime: PosixTimeSpec::default(), - ctime: PosixTimeSpec::default(), - file_type: FileType::BlockDevice, // 文件夹,block设备,char设备 - mode: ModeType::from_bits_truncate(0o666), - nlinks: 1, - uid: 0, - gid: 0, - raw_dev: DeviceNumber::new(Major::HD_MAJOR, 0), - }, - }; - - let result = Arc::new(LockedAhciInode(SpinLock::new(inode))); - result.0.lock().self_ref = Arc::downgrade(&result); - - return result; - } -} - -impl DeviceINode for LockedAhciInode { - fn set_fs(&self, fs: Weak) { - self.0.lock().fs = fs; - } -} - -impl IndexNode for LockedAhciInode { - fn as_any_ref(&self) -> &dyn core::any::Any { - self - } - - fn open( - &self, - _data: SpinLockGuard, - _mode: &FileMode, - ) -> Result<(), SystemError> { - Err(SystemError::ENOSYS) - } - - fn close(&self, _data: SpinLockGuard) -> Result<(), SystemError> { - Err(SystemError::ENOSYS) - } - - fn metadata(&self) -> Result { - return Ok(self.0.lock().metadata.clone()); - } - - fn fs(&self) -> Arc { - return self.0.lock().fs.upgrade().unwrap(); - } - - fn list(&self) -> Result, SystemError> { - Err(SystemError::ENOSYS) - } - - fn set_metadata(&self, metadata: &Metadata) -> Result<(), SystemError> { - let mut inode = self.0.lock(); - inode.metadata.atime = metadata.atime; - inode.metadata.mtime = metadata.mtime; - inode.metadata.ctime = metadata.ctime; - inode.metadata.mode = metadata.mode; - inode.metadata.uid = metadata.uid; - inode.metadata.gid = metadata.gid; - - return Ok(()); - } - - /// 读设备 - 应该调用设备的函数读写,而不是通过文件系统读写 - fn read_at( - &self, - offset: usize, // lba地址 - len: usize, - buf: &mut [u8], - data: SpinLockGuard, - ) -> Result { - if buf.len() < len { - return Err(SystemError::EINVAL); - } - - if let FilePrivateData::Unused = *data { - return self.0.lock().disk.read_at_bytes(offset, len, buf); - } - - return Err(SystemError::EINVAL); - } - - /// 写设备 - 应该调用设备的函数读写,而不是通过文件系统读写 - fn write_at( - &self, - offset: usize, // lba地址 - len: usize, - buf: &[u8], - data: SpinLockGuard, - ) -> Result { - if buf.len() < len { - return Err(SystemError::EINVAL); - } - - if let FilePrivateData::Unused = *data { - return self.0.lock().disk.write_at_bytes(offset, len, buf); - } - - return Err(SystemError::EINVAL); - } -} diff --git a/kernel/src/driver/disk/ahci/hba.rs b/kernel/src/driver/disk/ahci/hba.rs index aa324e654..64be8c6bf 100644 --- a/kernel/src/driver/disk/ahci/hba.rs +++ b/kernel/src/driver/disk/ahci/hba.rs @@ -1,3 +1,4 @@ +//! 文件说明: 实现了 AHCI 中的控制器 HBA 的相关行为 use core::{intrinsics::size_of, ptr}; use core::sync::atomic::compiler_fence; @@ -5,8 +6,6 @@ use core::sync::atomic::compiler_fence; use crate::arch::MMArch; use crate::mm::{MemoryManagementArch, PhysAddr}; -/// 文件说明: 实现了 AHCI 中的控制器 HBA 的相关行为 - /// 根据 AHCI 写出 HBA 的 Command pub const ATA_CMD_READ_DMA_EXT: u8 = 0x25; // 读操作,并且退出 pub const ATA_CMD_WRITE_DMA_EXT: u8 = 0x35; // 写操作,并且退出 diff --git a/kernel/src/driver/disk/ahci/mod.rs b/kernel/src/driver/disk/ahci/mod.rs index 38e036d60..8af505816 100644 --- a/kernel/src/driver/disk/ahci/mod.rs +++ b/kernel/src/driver/disk/ahci/mod.rs @@ -1,5 +1,4 @@ // 导出 ahci 相关的 module -pub mod ahci_inode; pub mod ahcidisk; pub mod hba; use crate::arch::MMArch; diff --git a/kernel/src/driver/firmware/efi/memmap.rs b/kernel/src/driver/firmware/efi/memmap.rs index c213d853b..afada046a 100644 --- a/kernel/src/driver/firmware/efi/memmap.rs +++ b/kernel/src/driver/firmware/efi/memmap.rs @@ -67,7 +67,7 @@ impl<'a> EFIMemoryDescIter<'a> { } } -impl<'a> Iterator for EFIMemoryDescIter<'a> { +impl Iterator for EFIMemoryDescIter<'_> { type Item = MemoryDescriptor; fn next(&mut self) -> Option { diff --git a/kernel/src/driver/firmware/efi/tables.rs b/kernel/src/driver/firmware/efi/tables.rs index a6e9c3448..770c4a048 100644 --- a/kernel/src/driver/firmware/efi/tables.rs +++ b/kernel/src/driver/firmware/efi/tables.rs @@ -74,8 +74,7 @@ impl EFIManager { warn!("report systable header: failed to map systable header, err: {fw_ptr:?}"); } - let s = CStr::from_bytes_with_nul(&tmp_buf) - .unwrap_or_else(|_| CStr::from_bytes_with_nul(b"Unknown\0").unwrap()); + let s = CStr::from_bytes_with_nul(&tmp_buf).unwrap_or(c"Unknown"); info!("EFI version: {:?}, vendor: {:?}", header.revision, s); } diff --git a/kernel/src/driver/input/serio/serio_driver.rs b/kernel/src/driver/input/serio/serio_driver.rs index c076a5c44..e491b1840 100644 --- a/kernel/src/driver/input/serio/serio_driver.rs +++ b/kernel/src/driver/input/serio/serio_driver.rs @@ -45,8 +45,7 @@ pub trait SerioDriver: Driver { fn cleanup(&self, device: &Arc) -> Result<(), SystemError>; } -///todo: https://code.dragonos.org.cn/xref/linux-6.1.9/drivers/input/serio/serio.c#810 - +/// todo: https://code.dragonos.org.cn/xref/linux-6.1.9/drivers/input/serio/serio.c#810 #[allow(dead_code)] #[inline(always)] pub fn serio_driver_manager() -> &'static SerioDriverManager { diff --git a/kernel/src/driver/net/dma.rs b/kernel/src/driver/net/dma.rs index f8c06b74e..e03fe86a5 100644 --- a/kernel/src/driver/net/dma.rs +++ b/kernel/src/driver/net/dma.rs @@ -17,7 +17,9 @@ const PAGE_SIZE: usize = 4096; /// @return PhysAddr 获得的内存页的初始物理地址 pub fn dma_alloc(pages: usize) -> (usize, NonNull) { let page_num = PageFrameCount::new( - ((pages * PAGE_SIZE + MMArch::PAGE_SIZE - 1) / MMArch::PAGE_SIZE).next_power_of_two(), + (pages * PAGE_SIZE) + .div_ceil(MMArch::PAGE_SIZE) + .next_power_of_two(), ); unsafe { let (paddr, count) = allocate_page_frames(page_num).expect("e1000e: alloc page failed"); @@ -44,7 +46,9 @@ pub fn dma_alloc(pages: usize) -> (usize, NonNull) { /// @return i32 0表示成功 pub unsafe fn dma_dealloc(paddr: usize, vaddr: NonNull, pages: usize) -> i32 { let page_count = PageFrameCount::new( - ((pages * PAGE_SIZE + MMArch::PAGE_SIZE - 1) / MMArch::PAGE_SIZE).next_power_of_two(), + (pages * PAGE_SIZE) + .div_ceil(MMArch::PAGE_SIZE) + .next_power_of_two(), ); // 恢复页面属性 diff --git a/kernel/src/driver/net/loopback.rs b/kernel/src/driver/net/loopback.rs index f8861d43f..cb251ce4a 100644 --- a/kernel/src/driver/net/loopback.rs +++ b/kernel/src/driver/net/loopback.rs @@ -186,8 +186,14 @@ impl Clone for LoopbackDriver { } impl phy::Device for LoopbackDriver { - type RxToken<'a> = LoopbackRxToken where Self: 'a; - type TxToken<'a> = LoopbackTxToken where Self: 'a; + type RxToken<'a> + = LoopbackRxToken + where + Self: 'a; + type TxToken<'a> + = LoopbackTxToken + where + Self: 'a; /// ## 返回设备的物理层特性。 /// lo设备的最大传输单元为65535,最大突发大小为1,传输介质默认为Ethernet fn capabilities(&self) -> phy::DeviceCapabilities { diff --git a/kernel/src/driver/net/virtio_net.rs b/kernel/src/driver/net/virtio_net.rs index 521f2752b..35190e2b9 100644 --- a/kernel/src/driver/net/virtio_net.rs +++ b/kernel/src/driver/net/virtio_net.rs @@ -539,8 +539,14 @@ impl VirtioNetToken { } impl phy::Device for VirtIONicDeviceInner { - type RxToken<'a> = VirtioNetToken where Self: 'a; - type TxToken<'a> = VirtioNetToken where Self: 'a; + type RxToken<'a> + = VirtioNetToken + where + Self: 'a; + type TxToken<'a> + = VirtioNetToken + where + Self: 'a; fn receive( &mut self, diff --git a/kernel/src/driver/open_firmware/fdt.rs b/kernel/src/driver/open_firmware/fdt.rs index aff55017d..deefb05bc 100644 --- a/kernel/src/driver/open_firmware/fdt.rs +++ b/kernel/src/driver/open_firmware/fdt.rs @@ -71,6 +71,7 @@ impl OpenFirmwareFdtDriver { return Ok(()); } + #[allow(dead_code)] pub unsafe fn set_fdt_map_guard(&self, guard: Option) { self.inner.write().fdt_map_guard = guard; } @@ -293,6 +294,7 @@ impl OpenFirmwareFdtDriver { /// 在UEFI初始化后,扫描FDT中的`/reserved-memory`节点,设置保留的内存 /// /// 参考: https://code.dragonos.org.cn/xref/linux-6.1.9/drivers/of/fdt.c#634 + #[allow(dead_code)] pub fn early_init_fdt_scan_reserved_mem(&self) { let vaddr = boot_params().read().fdt(); if vaddr.is_none() { @@ -323,7 +325,6 @@ impl OpenFirmwareFdtDriver { } /// 保留fdt自身的内存空间 - fn early_reserve_fdt_itself(&self, fdt: &Fdt) { #[cfg(target_arch = "riscv64")] { diff --git a/kernel/src/driver/pci/pci.rs b/kernel/src/driver/pci/pci.rs index 0a22fe6da..82bb20c9e 100644 --- a/kernel/src/driver/pci/pci.rs +++ b/kernel/src/driver/pci/pci.rs @@ -1474,7 +1474,7 @@ pub struct ExternalCapabilityIterator<'a> { pub bus_device_function: BusDeviceFunction, pub next_capability_offset: Option, } -impl<'a> Iterator for ExternalCapabilityIterator<'a> { +impl Iterator for ExternalCapabilityIterator<'_> { type Item = ExternalCapabilityInfo; fn next(&mut self) -> Option { let offset = self.next_capability_offset?; diff --git a/kernel/src/driver/pci/root.rs b/kernel/src/driver/pci/root.rs index c74c6cf9b..40c2cbeaa 100644 --- a/kernel/src/driver/pci/root.rs +++ b/kernel/src/driver/pci/root.rs @@ -317,7 +317,7 @@ pub struct PciRootIterator<'a> { index: usize, } -impl<'a> Iterator for PciRootIterator<'a> { +impl Iterator for PciRootIterator<'_> { type Item = Arc; fn next(&mut self) -> Option { diff --git a/kernel/src/driver/scsi/mod.rs b/kernel/src/driver/scsi/mod.rs index 83e6be572..21a42cc85 100644 --- a/kernel/src/driver/scsi/mod.rs +++ b/kernel/src/driver/scsi/mod.rs @@ -64,6 +64,7 @@ impl ScsiManager { BlockDevName::new(format!("sd{}", x), id) } + #[allow(dead_code)] pub fn free_id(&self, id: usize) { if id >= Self::MAX_DEVICES { return; diff --git a/kernel/src/driver/video/fbdev/base/fbmem.rs b/kernel/src/driver/video/fbdev/base/fbmem.rs index bcea81ac8..c3749015d 100644 --- a/kernel/src/driver/video/fbdev/base/fbmem.rs +++ b/kernel/src/driver/video/fbdev/base/fbmem.rs @@ -181,6 +181,7 @@ impl FrameBufferManager { } /// 根据id查找帧缓冲区 + #[allow(dead_code)] pub fn find_fb_by_id(&self, id: FbId) -> Result>, SystemError> { if unlikely(!id.is_valid()) { return Err(SystemError::EINVAL); diff --git a/kernel/src/driver/virtio/irq.rs b/kernel/src/driver/virtio/irq.rs index c5d075eb0..3a4a86da3 100644 --- a/kernel/src/driver/virtio/irq.rs +++ b/kernel/src/driver/virtio/irq.rs @@ -77,7 +77,6 @@ impl VirtIOIrqManager { /// # 返回 /// - 如果找到了设备,返回一个包含设备的`Option>`。 /// - 如果没有找到设备,返回`None`。 - pub fn lookup_device(&self, dev_id: &Arc) -> Option> { let map = self.map.read_irqsave(); map.get(dev_id).cloned() diff --git a/kernel/src/driver/virtio/virtio_impl.rs b/kernel/src/driver/virtio/virtio_impl.rs index 0166b138b..0608a0ce4 100644 --- a/kernel/src/driver/virtio/virtio_impl.rs +++ b/kernel/src/driver/virtio/virtio_impl.rs @@ -23,7 +23,9 @@ unsafe impl Hal for HalImpl { _direction: BufferDirection, ) -> (virtio_drivers::PhysAddr, NonNull) { let page_num = PageFrameCount::new( - ((pages * PAGE_SIZE + MMArch::PAGE_SIZE - 1) / MMArch::PAGE_SIZE).next_power_of_two(), + (pages * PAGE_SIZE) + .div_ceil(MMArch::PAGE_SIZE) + .next_power_of_two(), ); unsafe { let (paddr, count) = @@ -55,7 +57,9 @@ unsafe impl Hal for HalImpl { pages: usize, ) -> i32 { let page_count = PageFrameCount::new( - ((pages * PAGE_SIZE + MMArch::PAGE_SIZE - 1) / MMArch::PAGE_SIZE).next_power_of_two(), + (pages * PAGE_SIZE) + .div_ceil(MMArch::PAGE_SIZE) + .next_power_of_two(), ); // 恢复页面属性 diff --git a/kernel/src/exception/irqdata.rs b/kernel/src/exception/irqdata.rs index 2388907cb..ca8da4cdc 100644 --- a/kernel/src/exception/irqdata.rs +++ b/kernel/src/exception/irqdata.rs @@ -306,6 +306,7 @@ impl IrqCommonData { self.inner.lock_irqsave().affinity = affinity; } + #[allow(dead_code)] pub fn set_effective_affinity(&self, affinity: CpuMask) { self.inner.lock_irqsave().effective_affinity = affinity; } @@ -346,6 +347,7 @@ impl InnerIrqCommonData { self.handler_data.clone() } + #[allow(dead_code)] pub fn effective_affinity(&self) -> &CpuMask { &self.effective_affinity } diff --git a/kernel/src/exception/irqdesc.rs b/kernel/src/exception/irqdesc.rs index 815655965..96ea15797 100644 --- a/kernel/src/exception/irqdesc.rs +++ b/kernel/src/exception/irqdesc.rs @@ -286,10 +286,12 @@ impl IrqDesc { ); } + #[allow(dead_code)] pub fn set_probe(&self) { self.modify_status(IrqLineStatus::IRQ_NOPROBE, IrqLineStatus::empty()); } + #[allow(dead_code)] pub fn set_noprobe(&self) { self.modify_status(IrqLineStatus::empty(), IrqLineStatus::IRQ_NOPROBE); } @@ -416,6 +418,7 @@ impl InnerIrqDesc { self.line_status.insert(IrqLineStatus::IRQ_NOTHREAD); } + #[allow(dead_code)] pub fn clear_nothread(&mut self) { self.line_status.remove(IrqLineStatus::IRQ_NOTHREAD); } @@ -451,6 +454,7 @@ impl InnerIrqDesc { !self.line_status.contains(IrqLineStatus::IRQ_NOAUTOEN) } + #[allow(dead_code)] pub fn can_thread(&self) -> bool { !self.line_status.contains(IrqLineStatus::IRQ_NOTHREAD) } @@ -486,6 +490,7 @@ impl InnerIrqDesc { self.actions.clear(); } + #[allow(dead_code)] pub fn remove_action(&mut self, action: &Arc) { self.actions.retain(|a| !Arc::ptr_eq(a, action)); } @@ -506,14 +511,17 @@ impl InnerIrqDesc { &self.common_data } + #[allow(dead_code)] pub fn depth(&self) -> u32 { self.depth } + #[allow(dead_code)] pub fn wake_depth(&self) -> u32 { self.wake_depth } + #[allow(dead_code)] pub fn set_depth(&mut self, depth: u32) { self.depth = depth; } @@ -540,6 +548,7 @@ impl InnerIrqDesc { &mut self.percpu_enabled } + #[allow(dead_code)] pub fn percpu_affinity(&self) -> &Option { &self.percpu_affinity } @@ -969,6 +978,7 @@ impl IrqDescManager { } /// 设置指定irq的可用cpu为所有cpu + #[allow(dead_code)] pub fn set_percpu_devid_all(&self, irq: IrqNumber) -> Result<(), SystemError> { self.set_percpu_devid(irq, None) } diff --git a/kernel/src/exception/irqdomain.rs b/kernel/src/exception/irqdomain.rs index 021979dd8..814884dd5 100644 --- a/kernel/src/exception/irqdomain.rs +++ b/kernel/src/exception/irqdomain.rs @@ -319,6 +319,7 @@ impl IrqDomainManager { /// - `handler_data`: 中断流处理程序数据 /// - `handler_name`: 中断处理程序名称 #[allow(clippy::too_many_arguments)] + #[allow(dead_code)] pub fn domain_set_info( &self, domain: &Arc, @@ -557,14 +558,17 @@ impl IrqDomain { } /// The number of mapped interrupts + #[allow(dead_code)] pub fn map_count(&self) -> u32 { self.revmap_read_irqsave().map.len() as u32 } + #[allow(dead_code)] pub fn host_data(&self) -> Option> { self.inner.lock_irqsave().host_data.clone() } + #[allow(dead_code)] pub fn set_host_data(&self, host_data: Option>) { self.inner.lock_irqsave().host_data = host_data; } diff --git a/kernel/src/exception/manage.rs b/kernel/src/exception/manage.rs index 851a4024f..4e84d8a68 100644 --- a/kernel/src/exception/manage.rs +++ b/kernel/src/exception/manage.rs @@ -785,6 +785,7 @@ impl IrqManager { ); } + #[allow(dead_code)] pub fn irq_set_affinity( &self, irq_data: &Arc, diff --git a/kernel/src/exception/softirq.rs b/kernel/src/exception/softirq.rs index f7d9513a5..c67cc23b0 100644 --- a/kernel/src/exception/softirq.rs +++ b/kernel/src/exception/softirq.rs @@ -275,13 +275,13 @@ struct RunningCountGuard<'a> { } impl<'a> RunningCountGuard<'a> { - fn new(cpu_running_count: &'a PerCpuVar) -> RunningCountGuard { + fn new(cpu_running_count: &'a PerCpuVar) -> RunningCountGuard<'a> { cpu_running_count.get().fetch_add(1, Ordering::SeqCst); return RunningCountGuard { cpu_running_count }; } } -impl<'a> Drop for RunningCountGuard<'a> { +impl Drop for RunningCountGuard<'_> { fn drop(&mut self) { self.cpu_running_count.get().fetch_sub(1, Ordering::SeqCst); } diff --git a/kernel/src/filesystem/fat/bpb.rs b/kernel/src/filesystem/fat/bpb.rs index c31e3a560..4add07d81 100644 --- a/kernel/src/filesystem/fat/bpb.rs +++ b/kernel/src/filesystem/fat/bpb.rs @@ -266,8 +266,7 @@ impl BiosParameterBlock { bpb.trail_sig = cursor.read_u16()?; // 计算根目录项占用的空间(单位:字节) - let root_sectors = ((bpb.root_entries_cnt as u32 * 32) + (bpb.bytes_per_sector as u32 - 1)) - / (bpb.bytes_per_sector as u32); + let root_sectors = (bpb.root_entries_cnt as u32 * 32).div_ceil(bpb.bytes_per_sector as u32); // 每FAT扇区数 let fat_size = if bpb.fat_size_16 != 0 { @@ -347,9 +346,8 @@ impl BiosParameterBlock { } }; - let root_sectors = ((self.root_entries_cnt as u32 * 32) - + (self.bytes_per_sector as u32 - 1)) - / (self.bytes_per_sector as u32); + let root_sectors = + (self.root_entries_cnt as u32 * 32).div_ceil(self.bytes_per_sector as u32); // 当前分区总扇区数 let total_sectors = if self.total_sectors_16 != 0 { diff --git a/kernel/src/filesystem/fat/entry.rs b/kernel/src/filesystem/fat/entry.rs index 0e825bf05..d6f69e7cb 100644 --- a/kernel/src/filesystem/fat/entry.rs +++ b/kernel/src/filesystem/fat/entry.rs @@ -256,8 +256,7 @@ impl FATFile { // 如果还需要更多的簇 if bytes_remain_in_cluster < extra_bytes { let clusters_to_allocate = - (extra_bytes - bytes_remain_in_cluster + fs.bytes_per_cluster() - 1) - / fs.bytes_per_cluster(); + (extra_bytes - bytes_remain_in_cluster).div_ceil(fs.bytes_per_cluster()); let last_cluster = if let Some(c) = fs.get_last_cluster(self.first_cluster) { c } else { @@ -338,7 +337,7 @@ impl FATFile { return Ok(()); } - let new_last_cluster = (new_size + fs.bytes_per_cluster() - 1) / fs.bytes_per_cluster(); + let new_last_cluster = new_size.div_ceil(fs.bytes_per_cluster()); if let Some(begin_delete) = fs.get_cluster_by_relative(self.first_cluster, new_last_cluster as usize) { @@ -463,8 +462,7 @@ impl FATDir { // 计算需要申请多少个簇 let clusters_required = - (remain_entries * FATRawDirEntry::DIR_ENTRY_LEN + fs.bytes_per_cluster() - 1) - / fs.bytes_per_cluster(); + (remain_entries * FATRawDirEntry::DIR_ENTRY_LEN).div_ceil(fs.bytes_per_cluster()); let mut first_cluster = Cluster::default(); let mut prev_cluster = current_cluster; // debug!( diff --git a/kernel/src/filesystem/fat/fs.rs b/kernel/src/filesystem/fat/fs.rs index 8e20210b5..fdd43859b 100644 --- a/kernel/src/filesystem/fat/fs.rs +++ b/kernel/src/filesystem/fat/fs.rs @@ -326,9 +326,8 @@ impl FATFileSystem { }; // 根目录项占用的扇区数(向上取整) - let root_dir_sectors: u64 = ((bpb.root_entries_cnt as u64 * 32) - + (bpb.bytes_per_sector as u64 - 1)) - / (bpb.bytes_per_sector as u64); + let root_dir_sectors: u64 = + (bpb.root_entries_cnt as u64 * 32).div_ceil(bpb.bytes_per_sector as u64); // FAT表大小(单位:扇区) let fat_size = if bpb.fat_size_16 != 0 { @@ -843,6 +842,7 @@ impl FATFileSystem { /// @return Ok(true) 正常 /// @return Ok(false) 不正常 /// @return Err(SystemError) 在判断时发生错误 + #[allow(dead_code)] pub fn is_hard_error_bit_ok(&mut self) -> Result { match self.bpb.fat_type { FATType::FAT32(_) => { @@ -935,10 +935,8 @@ impl FATFileSystem { _ => { // FAT12 / FAT16 - let root_dir_sectors: u64 = (((self.bpb.root_entries_cnt as u64) * 32) - + self.bpb.bytes_per_sector as u64 - - 1) - / self.bpb.bytes_per_sector as u64; + let root_dir_sectors: u64 = ((self.bpb.root_entries_cnt as u64) * 32) + .div_ceil(self.bpb.bytes_per_sector as u64); // 数据区扇区数 let data_sec: u64 = self.bpb.total_sectors_16 as u64 - (self.bpb.rsvd_sec_cnt as u64 @@ -1283,6 +1281,7 @@ impl FATFsInfo { /// @brief 根据fsinfo的信息,计算当前总的空闲簇数量 /// /// @param 当前文件系统的最大簇号 + #[allow(dead_code)] pub fn count_free_cluster(&self, max_cluster: Cluster) -> Option { let count_clusters = max_cluster.cluster_num - RESERVED_CLUSTERS as u64 + 1; // 信息不合理,当前的FsInfo中存储的free count大于计算出来的值 @@ -1301,6 +1300,7 @@ impl FATFsInfo { /// @brief 更新FsInfo中的“空闲簇统计信息“为new_count /// /// 请注意,除非手动调用`flush()`,否则本函数不会将数据刷入磁盘 + #[allow(dead_code)] pub fn update_free_count_abs(&mut self, new_count: u32) { self.free_count = new_count; } @@ -1308,6 +1308,7 @@ impl FATFsInfo { /// @brief 更新FsInfo中的“空闲簇统计信息“,把它加上delta. /// /// 请注意,除非手动调用`flush()`,否则本函数不会将数据刷入磁盘 + #[allow(dead_code)] pub fn update_free_count_delta(&mut self, delta: i32) { self.free_count = (self.free_count as i32 + delta) as u32; } @@ -1360,6 +1361,7 @@ impl FATFsInfo { /// @brief 读取磁盘上的Fs Info扇区,将里面的内容更新到结构体中 /// /// @param partition fs info所在的分区 + #[allow(dead_code)] pub fn update(&mut self, partition: Arc) -> Result<(), SystemError> { if let Some(off) = self.offset { let in_block_offset = off % LBA_SIZE as u64; @@ -1888,7 +1890,7 @@ struct ClusterIter<'a> { fs: &'a FATFileSystem, } -impl<'a> Iterator for ClusterIter<'a> { +impl Iterator for ClusterIter<'_> { type Item = Cluster; fn next(&mut self) -> Option { diff --git a/kernel/src/filesystem/mbr.rs b/kernel/src/filesystem/mbr.rs index 843be8959..9cf6eeddf 100644 --- a/kernel/src/filesystem/mbr.rs +++ b/kernel/src/filesystem/mbr.rs @@ -169,7 +169,7 @@ impl<'a> MbrPartitionIter<'a> { } } -impl<'a> Iterator for MbrPartitionIter<'a> { +impl Iterator for MbrPartitionIter<'_> { type Item = Partition; fn next(&mut self) -> Option { diff --git a/kernel/src/filesystem/overlayfs/mod.rs b/kernel/src/filesystem/overlayfs/mod.rs index 244217e32..3a68142ec 100644 --- a/kernel/src/filesystem/overlayfs/mod.rs +++ b/kernel/src/filesystem/overlayfs/mod.rs @@ -14,6 +14,7 @@ use alloc::sync::Arc; use alloc::sync::Weak; use alloc::vec::Vec; use entry::{OvlEntry, OvlLayer}; +use linkme::distributed_slice; use system_error::SystemError; const WHITEOUT_MODE: u64 = 0o020000 | 0o600; // whiteout字符设备文件模式与权限 @@ -89,7 +90,7 @@ struct OverlayFS { } #[derive(Debug)] -struct OvlInode { +pub struct OvlInode { redirect: String, // 重定向路径 file_type: FileType, flags: SpinLock, diff --git a/kernel/src/filesystem/procfs/syscall.rs b/kernel/src/filesystem/procfs/syscall.rs index f80365cc0..8066903c8 100644 --- a/kernel/src/filesystem/procfs/syscall.rs +++ b/kernel/src/filesystem/procfs/syscall.rs @@ -51,7 +51,6 @@ impl Syscall { /// - 成功,Ok(usize) /// - 失败,Err(SystemError) 操作失败,返回posix错误码 /// - pub fn do_syslog( syslog_action_type: usize, buf: &mut [u8], diff --git a/kernel/src/filesystem/vfs/file.rs b/kernel/src/filesystem/vfs/file.rs index 4b3d75b6f..3762474ea 100644 --- a/kernel/src/filesystem/vfs/file.rs +++ b/kernel/src/filesystem/vfs/file.rs @@ -800,7 +800,7 @@ impl<'a> FileDescriptorIterator<'a> { } } -impl<'a> Iterator for FileDescriptorIterator<'a> { +impl Iterator for FileDescriptorIterator<'_> { type Item = (i32, Arc); fn next(&mut self) -> Option { diff --git a/kernel/src/init/boot.rs b/kernel/src/init/boot.rs index b692e3fb1..ec345fd24 100644 --- a/kernel/src/init/boot.rs +++ b/kernel/src/init/boot.rs @@ -49,6 +49,7 @@ impl BootParams { core::str::from_utf8(&self.boot_cmdline()[..self.boot_cmdline_len()]).unwrap() } + #[allow(dead_code)] pub fn bootloader_name(&self) -> Option<&str> { self.bootloader_name.as_deref() } diff --git a/kernel/src/init/cmdline.rs b/kernel/src/init/cmdline.rs index 0d0ff040e..a313be51c 100644 --- a/kernel/src/init/cmdline.rs +++ b/kernel/src/init/cmdline.rs @@ -43,6 +43,7 @@ pub struct KernelCmdlineParamBuilder { inv: bool, } +#[allow(dead_code)] impl KernelCmdlineParamBuilder { pub const fn new(name: &'static str, ty: KCmdlineParamType) -> Self { Self { @@ -110,6 +111,7 @@ pub enum KernelCmdlineParameter { EarlyKV(&'static KernelCmdlineEarlyKV), } +#[allow(dead_code)] impl KernelCmdlineParameter { pub fn name(&self) -> &str { match self { @@ -195,6 +197,7 @@ pub struct KernelCmdlineEarlyKV { default: &'static str, } +#[allow(dead_code)] impl KernelCmdlineEarlyKV { pub const VALUE_MAX_LEN: usize = 256; diff --git a/kernel/src/ipc/signal_types.rs b/kernel/src/ipc/signal_types.rs index 6ebfbf611..d8d7b1677 100644 --- a/kernel/src/ipc/signal_types.rs +++ b/kernel/src/ipc/signal_types.rs @@ -297,7 +297,6 @@ pub struct UserSigaction { * siginfo中,根据signal的来源不同,该info中对应了不同的数据./= * 请注意,该info最大占用16字节 */ - #[repr(C)] #[derive(Copy, Clone, Debug)] pub struct SigInfo { diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs index 881f6d319..c35cc12bc 100644 --- a/kernel/src/lib.rs +++ b/kernel/src/lib.rs @@ -2,20 +2,15 @@ #![feature(alloc_error_handler)] #![feature(allocator_api)] #![feature(arbitrary_self_types)] -#![feature(asm_const)] #![feature(concat_idents)] #![feature(const_for)] -#![feature(const_mut_refs)] -#![feature(const_option)] #![feature(const_trait_impl)] -#![feature(const_refs_to_cell)] #![feature(core_intrinsics)] #![feature(c_void_variant)] #![feature(extract_if)] #![feature(fn_align)] #![feature(linked_list_retain)] #![feature(naked_functions)] -#![feature(new_uninit)] #![feature(ptr_internals)] #![feature(trait_upcasting)] #![feature(slice_ptr_get)] @@ -23,16 +18,19 @@ #![feature(vec_into_raw_parts)] #![feature(c_variadic)] #![cfg_attr(target_os = "none", no_std)] -#![allow(internal_features)] +#![allow(static_mut_refs, non_local_definitions, internal_features)] // clippy的配置 #![deny(clippy::all)] -#![allow(clippy::bad_bit_mask)] // DragonOS允许在函数中使用return语句(尤其是长函数时,我们推荐这么做) -#![allow(clippy::let_and_return)] -#![allow(clippy::needless_pass_by_ref_mut)] -#![allow(clippy::needless_return)] -#![allow(clippy::single_char_pattern)] -#![allow(clippy::upper_case_acronyms)] +#![allow( + clippy::macro_metavars_in_unsafe, + clippy::upper_case_acronyms, + clippy::single_char_pattern, + clippy::needless_return, + clippy::needless_pass_by_ref_mut, + clippy::let_and_return, + clippy::bad_bit_mask +)] #[cfg(test)] #[macro_use] diff --git a/kernel/src/libs/casting.rs b/kernel/src/libs/casting.rs index a80dc2619..05c9911f5 100644 --- a/kernel/src/libs/casting.rs +++ b/kernel/src/libs/casting.rs @@ -47,7 +47,6 @@ use alloc::sync::Arc; /// /// fn test() { /// let a = A { name: "a".to_string() }; - /// let a_arc: Arc = Arc::new(a) as Arc; /// let a_arc2: Option> = a_arc.downcast_arc::(); /// assert!(a_arc2.is_some()); diff --git a/kernel/src/libs/cpumask.rs b/kernel/src/libs/cpumask.rs index fc86b860d..6bbf3917e 100644 --- a/kernel/src/libs/cpumask.rs +++ b/kernel/src/libs/cpumask.rs @@ -129,7 +129,7 @@ pub struct CpuMaskIter<'a> { begin: bool, } -impl<'a> Iterator for CpuMaskIter<'a> { +impl Iterator for CpuMaskIter<'_> { type Item = ProcessorId; fn next(&mut self) -> Option { diff --git a/kernel/src/libs/futex/futex.rs b/kernel/src/libs/futex/futex.rs index a3a26d7db..cc651ad2e 100644 --- a/kernel/src/libs/futex/futex.rs +++ b/kernel/src/libs/futex/futex.rs @@ -844,7 +844,7 @@ impl<'a> FutexIterator<'a> { } } -impl<'a> Iterator for FutexIterator<'a> { +impl Iterator for FutexIterator<'_> { type Item = VirtAddr; fn next(&mut self) -> Option { diff --git a/kernel/src/libs/lib_ui/screen_manager.rs b/kernel/src/libs/lib_ui/screen_manager.rs index 839ce3600..93f6788d5 100644 --- a/kernel/src/libs/lib_ui/screen_manager.rs +++ b/kernel/src/libs/lib_ui/screen_manager.rs @@ -298,7 +298,6 @@ pub fn scm_init(enable_put_to_window: bool) { /// ## 参数 /// /// - framework 要启动的ui框架 - pub fn scm_framework_enable(framework: Arc) -> Result { // 获取信息 let metadata = framework.metadata()?; @@ -321,7 +320,6 @@ pub fn scm_framework_enable(framework: Arc) -> Result) -> Result { // 把ui框架加入链表 diff --git a/kernel/src/libs/lib_ui/textui.rs b/kernel/src/libs/lib_ui/textui.rs index 16e523979..69558b6e6 100644 --- a/kernel/src/libs/lib_ui/textui.rs +++ b/kernel/src/libs/lib_ui/textui.rs @@ -595,7 +595,6 @@ impl TextuiWindow { /// -flags 标志位 /// -vlines_num 虚拟行的总数 /// -chars_num 每行最大的字符数 - pub fn new(flags: WindowFlag, vlines_num: i32, chars_num: i32) -> Self { let mut initial_vlines = Vec::new(); @@ -667,10 +666,8 @@ impl TextuiWindow { /// 重新渲染某个窗口的某个虚拟行 /// ## 参数 - /// - window 窗口结构体 /// - vline_id 虚拟行号 - fn textui_refresh_vline(&mut self, vline_id: LineId) -> Result<(), SystemError> { if self.flags.contains(WindowFlag::TEXTUI_CHROMATIC) { return self.textui_refresh_characters( @@ -788,12 +785,10 @@ impl TextuiWindow { } /// 根据输入的一个字符在窗口上输出 /// ## 参数 - /// - window 窗口 /// - character 字符 /// - FRcolor 前景色(RGB) /// - BKcolor 背景色(RGB) - fn textui_putchar_window( &mut self, character: char, @@ -1027,7 +1022,6 @@ where /// - character 字符 /// - FRcolor 前景色(RGB) /// - BKcolor 背景色(RGB) - #[no_mangle] pub extern "C" fn rs_textui_putchar(character: u8, fr_color: u32, bk_color: u32) -> i32 { if let Some(current_vc) = vc_manager().current_vc() { diff --git a/kernel/src/libs/rbtree.rs b/kernel/src/libs/rbtree.rs index f1fed00f0..6aedb791f 100644 --- a/kernel/src/libs/rbtree.rs +++ b/kernel/src/libs/rbtree.rs @@ -286,7 +286,6 @@ impl NodePtr { /// A red black tree implemented with Rust /// It is required that the keys implement the [`Ord`] traits. - /// # Examples /// ```rust /// use rbtree::RBTree; @@ -431,7 +430,7 @@ where impl Eq for RBTree {} -impl<'a, K: Ord + Debug, V: Debug> Index<&'a K> for RBTree { +impl Index<&K> for RBTree { type Output = V; #[inline] @@ -482,7 +481,7 @@ impl<'a, K: Ord + Debug, V: Debug> Clone for Keys<'a, K, V> { } } -impl<'a, K: Ord + Debug, V: Debug> fmt::Debug for Keys<'a, K, V> { +impl fmt::Debug for Keys<'_, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.clone()).finish() } @@ -527,7 +526,7 @@ impl<'a, K: Ord + Debug, V: Debug> Clone for Values<'a, K, V> { } } -impl<'a, K: Ord + Debug, V: Debug> fmt::Debug for Values<'a, K, V> { +impl fmt::Debug for Values<'_, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.clone()).finish() } @@ -575,7 +574,7 @@ impl<'a, K: Ord + Debug, V: Debug> Clone for ValuesMut<'a, K, V> { } } -impl<'a, K: Ord + Debug, V: Debug> fmt::Debug for ValuesMut<'a, K, V> { +impl fmt::Debug for ValuesMut<'_, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.clone()).finish() } @@ -1651,7 +1650,7 @@ mod tests { let vec = vec![(1, 1), (2, 2), (3, 3)]; let mut map: RBTree<_, _> = vec.into_iter().collect(); for value in map.values_mut() { - *value = (*value) * 2 + *value *= 2 } let values: Vec<_> = map.values().cloned().collect(); assert_eq!(values.len(), 3); @@ -1808,7 +1807,7 @@ mod tests { b.insert(2, "two"); b.insert(3, "three"); - a.extend(b.into_iter()); + a.extend(b); assert_eq!(a.len(), 3); assert_eq!(a[&1], "one"); @@ -1818,6 +1817,7 @@ mod tests { #[test] fn test_rev_iter() { + use crate::libs::rbtree::RBTree; let mut a = RBTree::new(); a.insert(1, 1); a.insert(2, 2); @@ -1826,7 +1826,7 @@ mod tests { assert_eq!(a.len(), 3); let mut cache = vec![]; for e in a.iter().rev() { - cache.push(e.0.clone()); + cache.push(*e.0); } assert_eq!(&cache, &vec![3, 2, 1]); } diff --git a/kernel/src/libs/rwlock.rs b/kernel/src/libs/rwlock.rs index 63af797fc..2fabd5c2d 100644 --- a/kernel/src/libs/rwlock.rs +++ b/kernel/src/libs/rwlock.rs @@ -16,7 +16,6 @@ use crate::{ }; ///RwLock读写锁 - /// @brief READER位占据从右往左数第三个比特位 const READER: u32 = 1 << 2; @@ -548,7 +547,7 @@ impl<'rwlock, T> RwLockWriteGuard<'rwlock, T> { } } -impl<'rwlock, T> Deref for RwLockReadGuard<'rwlock, T> { +impl Deref for RwLockReadGuard<'_, T> { type Target = T; fn deref(&self) -> &Self::Target { @@ -556,7 +555,7 @@ impl<'rwlock, T> Deref for RwLockReadGuard<'rwlock, T> { } } -impl<'rwlock, T> Deref for RwLockUpgradableGuard<'rwlock, T> { +impl Deref for RwLockUpgradableGuard<'_, T> { type Target = T; fn deref(&self) -> &Self::Target { @@ -564,7 +563,7 @@ impl<'rwlock, T> Deref for RwLockUpgradableGuard<'rwlock, T> { } } -impl<'rwlock, T> Deref for RwLockWriteGuard<'rwlock, T> { +impl Deref for RwLockWriteGuard<'_, T> { type Target = T; fn deref(&self) -> &Self::Target { @@ -572,13 +571,13 @@ impl<'rwlock, T> Deref for RwLockWriteGuard<'rwlock, T> { } } -impl<'rwlock, T> DerefMut for RwLockWriteGuard<'rwlock, T> { +impl DerefMut for RwLockWriteGuard<'_, T> { fn deref_mut(&mut self) -> &mut Self::Target { return unsafe { &mut *self.data }; } } -impl<'rwlock, T> Drop for RwLockReadGuard<'rwlock, T> { +impl Drop for RwLockReadGuard<'_, T> { fn drop(&mut self) { debug_assert!(self.lock.load(Ordering::Relaxed) & !(WRITER | UPGRADED) > 0); self.lock.fetch_sub(READER, Ordering::Release); @@ -586,7 +585,7 @@ impl<'rwlock, T> Drop for RwLockReadGuard<'rwlock, T> { } } -impl<'rwlock, T> Drop for RwLockUpgradableGuard<'rwlock, T> { +impl Drop for RwLockUpgradableGuard<'_, T> { fn drop(&mut self) { debug_assert_eq!( self.inner.lock.load(Ordering::Relaxed) & (WRITER | UPGRADED), @@ -598,7 +597,7 @@ impl<'rwlock, T> Drop for RwLockUpgradableGuard<'rwlock, T> { } } -impl<'rwlock, T> Drop for RwLockWriteGuard<'rwlock, T> { +impl Drop for RwLockWriteGuard<'_, T> { fn drop(&mut self) { debug_assert_eq!(self.inner.lock.load(Ordering::Relaxed) & WRITER, WRITER); self.inner diff --git a/kernel/src/libs/volatile.rs b/kernel/src/libs/volatile.rs index efb8f3f33..e967be07a 100644 --- a/kernel/src/libs/volatile.rs +++ b/kernel/src/libs/volatile.rs @@ -64,7 +64,6 @@ macro_rules! volatile_write_bit { /// volwrite!(self.common_cfg, queue_enable, 0); /// /// 这样做不仅使代码的可读性提高了,也避免了对只读寄存器进行写入的误操作 - /// 只读寄存器 #[derive(Default)] #[repr(transparent)] diff --git a/kernel/src/mm/memblock.rs b/kernel/src/mm/memblock.rs index d17bd3434..ae5861463 100644 --- a/kernel/src/mm/memblock.rs +++ b/kernel/src/mm/memblock.rs @@ -473,7 +473,7 @@ pub struct MemBlockIter<'a> { } #[allow(dead_code)] -impl<'a> MemBlockIter<'a> { +impl MemBlockIter<'_> { /// 获取内存区域数量 pub fn total_num(&self) -> usize { self.inner.initial_memory_regions_num @@ -490,7 +490,7 @@ impl<'a> MemBlockIter<'a> { } } -impl<'a> Iterator for MemBlockIter<'a> { +impl Iterator for MemBlockIter<'_> { type Item = PhysMemoryArea; fn next(&mut self) -> Option { diff --git a/kernel/src/perf/bpf.rs b/kernel/src/perf/bpf.rs index 84af5436c..b283b2e54 100644 --- a/kernel/src/perf/bpf.rs +++ b/kernel/src/perf/bpf.rs @@ -208,6 +208,8 @@ impl RingPage { let data_head = unsafe { &(*(self.ptr as *mut perf_event_mmap_page)).data_head }; data_tail != data_head } + + #[allow(dead_code)] pub fn as_slice(&self) -> &[u8] { unsafe { core::slice::from_raw_parts(self.ptr as *const u8, self.size) } } diff --git a/kernel/src/perf/util.rs b/kernel/src/perf/util.rs index b1cc43eb4..1b24eed6b 100644 --- a/kernel/src/perf/util.rs +++ b/kernel/src/perf/util.rs @@ -116,7 +116,7 @@ pub struct PerfSample<'a> { pub value: &'a [u8], } -impl<'a> PerfSample<'a> { +impl PerfSample<'_> { pub fn calculate_size(value_size: usize) -> usize { size_of::() + value_size } diff --git a/kernel/src/process/exit.rs b/kernel/src/process/exit.rs index c88a9493b..9420c0fd0 100644 --- a/kernel/src/process/exit.rs +++ b/kernel/src/process/exit.rs @@ -39,7 +39,7 @@ pub struct WaitIdInfo { pub cause: i32, } -impl<'a> KernelWaitOption<'a> { +impl KernelWaitOption<'_> { pub fn new(pid_type: PidType, pid: Pid, options: WaitOption) -> Self { Self { pid_type, diff --git a/kernel/src/process/syscall.rs b/kernel/src/process/syscall.rs index 9dd04a114..9ba37e829 100644 --- a/kernel/src/process/syscall.rs +++ b/kernel/src/process/syscall.rs @@ -212,7 +212,7 @@ impl Syscall { return Ok(target_proc.basic().pgid()); } /// @brief 获取当前进程的父进程id - + /// /// 若为initproc则ppid设置为0 pub fn getppid() -> Result { let current_pcb = ProcessManager::current_pcb(); diff --git a/kernel/src/syscall/misc.rs b/kernel/src/syscall/misc.rs index f78029291..92879b3eb 100644 --- a/kernel/src/syscall/misc.rs +++ b/kernel/src/syscall/misc.rs @@ -10,12 +10,11 @@ use system_error::SystemError; use super::{user_access::UserBufferWriter, Syscall}; -#[repr(C)] - /// 系统信息 /// /// 参考 https://code.dragonos.org.cn/xref/linux-6.1.9/include/uapi/linux/sysinfo.h#8 #[derive(Debug, Default, Copy, Clone)] +#[repr(C)] pub struct SysInfo { uptime: u64, loads: [u64; 3], diff --git a/kernel/src/syscall/user_access.rs b/kernel/src/syscall/user_access.rs index 18a74764e..2850dfdc7 100644 --- a/kernel/src/syscall/user_access.rs +++ b/kernel/src/syscall/user_access.rs @@ -160,7 +160,7 @@ pub struct UserBufferReader<'a> { } #[allow(dead_code)] -impl<'a> UserBufferReader<'a> { +impl UserBufferReader<'_> { /// 构造一个指向用户空间位置的BufferReader,为了兼容类似传入 *const u8 的情况,使用单独的泛型来进行初始化 /// /// @param addr 用户空间指针 @@ -321,7 +321,7 @@ impl<'a> UserBufferWriter<'a> { return Ok(()); } - pub fn buffer(&'a mut self, offset: usize) -> Result<&mut [T], SystemError> { + pub fn buffer(&'a mut self, offset: usize) -> Result<&'a mut [T], SystemError> { Self::convert_with_offset::(self.buffer, offset).map_err(|_| SystemError::EINVAL) } diff --git a/tools/BUILD_CONTAINER_VERSION b/tools/BUILD_CONTAINER_VERSION index 59b6ef75f..536385712 100644 --- a/tools/BUILD_CONTAINER_VERSION +++ b/tools/BUILD_CONTAINER_VERSION @@ -1 +1 @@ -v1.5 \ No newline at end of file +v1.6 \ No newline at end of file diff --git a/tools/Makefile b/tools/Makefile index c4faeea5f..94ff2833a 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -6,4 +6,4 @@ clean: @cargo clean check: - @cargo +nightly-2024-07-23 check --workspace --message-format=json + @cargo +nightly-2024-11-05 check --workspace --message-format=json diff --git a/tools/bootstrap.sh b/tools/bootstrap.sh index ddb5a6088..b859c3ae9 100644 --- a/tools/bootstrap.sh +++ b/tools/bootstrap.sh @@ -23,7 +23,7 @@ DEFAULT_INSTALL="false" export RUSTUP_DIST_SERVER=${RUSTUP_DIST_SERVER:-https://rsproxy.cn} export RUSTUP_UPDATE_ROOT=${RUSTUP_UPDATE_ROOT:-https://rsproxy.cn/rustup} -export RUST_VERSION="${RUST_VERSION:-nightly-2024-07-23}" +export RUST_VERSION="${RUST_VERSION:-nightly-2024-11-05}" banner() { @@ -233,21 +233,21 @@ rustInstall() { echo "正在安装DragonOS所需的rust组件...首次安装需要一些时间来更新索引,请耐心等待..." cargo install cargo-binutils cargo install bpf-linker - rustup toolchain install nightly-2023-08-15-x86_64-unknown-linux-gnu + rustup toolchain install nightly-2024-11-05-x86_64-unknown-linux-gnu rustup toolchain install $RUST_VERSION-x86_64-unknown-linux-gnu rustup component add rust-src --toolchain $RUST_VERSION-x86_64-unknown-linux-gnu - rustup component add rust-src --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu + rustup component add rust-src --toolchain nightly-2024-11-05-x86_64-unknown-linux-gnu rustup target add x86_64-unknown-none --toolchain $RUST_VERSION-x86_64-unknown-linux-gnu - rustup target add x86_64-unknown-none --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu - rustup target add x86_64-unknown-linux-musl --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu + rustup target add x86_64-unknown-none --toolchain nightly-2024-11-05-x86_64-unknown-linux-gnu + rustup target add x86_64-unknown-linux-musl --toolchain nightly-2024-11-05-x86_64-unknown-linux-gnu rustup target add x86_64-unknown-linux-musl --toolchain $RUST_VERSION-x86_64-unknown-linux-gnu rustup toolchain install $RUST_VERSION-riscv64gc-unknown-linux-gnu --force-non-host - rustup toolchain install nightly-2023-08-15-riscv64gc-unknown-linux-gnu --force-non-host + rustup toolchain install nightly-2024-11-05-riscv64gc-unknown-linux-gnu --force-non-host rustup target add riscv64gc-unknown-none-elf --toolchain $RUST_VERSION-riscv64gc-unknown-linux-gnu rustup target add riscv64imac-unknown-none-elf --toolchain $RUST_VERSION-riscv64gc-unknown-linux-gnu - rustup target add riscv64gc-unknown-none-elf --toolchain nightly-2023-08-15-riscv64gc-unknown-linux-gnu - rustup target add riscv64imac-unknown-none-elf --toolchain nightly-2023-08-15-riscv64gc-unknown-linux-gnu + rustup target add riscv64gc-unknown-none-elf --toolchain nightly-2024-11-05-riscv64gc-unknown-linux-gnu + rustup target add riscv64imac-unknown-none-elf --toolchain nightly-2024-11-05-riscv64gc-unknown-linux-gnu rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu rustup component add rust-src diff --git a/tools/debugging/logmonitor/src/app.rs b/tools/debugging/logmonitor/src/app.rs index ab652a0b2..92d485665 100644 --- a/tools/debugging/logmonitor/src/app.rs +++ b/tools/debugging/logmonitor/src/app.rs @@ -110,7 +110,7 @@ pub struct TabsState<'a> { } impl<'a> TabsState<'a> { - pub fn new(titles: Vec<&'a str>) -> TabsState { + pub fn new(titles: Vec<&'a str>) -> TabsState<'a> { TabsState { titles, index: 0 } } pub fn next(&mut self) { diff --git a/user/apps/clear/Makefile b/user/apps/clear/Makefile index 127c6ccb3..0d1403539 100644 --- a/user/apps/clear/Makefile +++ b/user/apps/clear/Makefile @@ -1,4 +1,4 @@ -TOOLCHAIN="+nightly-2024-07-23-x86_64-unknown-linux-gnu" +TOOLCHAIN="+nightly-2024-11-05-x86_64-unknown-linux-gnu" # RUSTFLAGS+="-C target-feature=+crt-static -C link-arg=-no-pie" ifdef DADK_CURRENT_BUILD_DIR diff --git a/user/apps/test-backlog/Makefile b/user/apps/test-backlog/Makefile index f65b0d520..99b095d51 100644 --- a/user/apps/test-backlog/Makefile +++ b/user/apps/test-backlog/Makefile @@ -1,4 +1,4 @@ -TOOLCHAIN="+nightly-2024-07-23-x86_64-unknown-linux-gnu" +TOOLCHAIN="+nightly-2024-11-05-x86_64-unknown-linux-gnu" RUSTFLAGS+="" ifdef DADK_CURRENT_BUILD_DIR diff --git a/user/apps/test-blockcache/Makefile b/user/apps/test-blockcache/Makefile index 86a122015..e9aa93ae8 100644 --- a/user/apps/test-blockcache/Makefile +++ b/user/apps/test-blockcache/Makefile @@ -1,6 +1,6 @@ # The toolchain we use. # You can get it by running DragonOS' `tools/bootstrap.sh` -TOOLCHAIN="+nightly-2024-07-23-x86_64-unknown-linux-gnu" +TOOLCHAIN="+nightly-2024-11-05-x86_64-unknown-linux-gnu" RUSTFLAGS+="-C target-feature=+crt-static -C link-arg=-no-pie" # 如果是在dadk中编译,那么安装到dadk的安装目录中 diff --git a/user/apps/test-for-robustfutex/Makefile b/user/apps/test-for-robustfutex/Makefile index d9eb6cd1e..352c0562c 100644 --- a/user/apps/test-for-robustfutex/Makefile +++ b/user/apps/test-for-robustfutex/Makefile @@ -1,4 +1,4 @@ -TOOLCHAIN="+nightly-2024-07-23-x86_64-unknown-linux-gnu" +TOOLCHAIN="+nightly-2024-11-05-x86_64-unknown-linux-gnu" RUSTFLAGS+="" ifdef DADK_CURRENT_BUILD_DIR diff --git a/user/apps/test-mount/Makefile b/user/apps/test-mount/Makefile index d9eb6cd1e..352c0562c 100644 --- a/user/apps/test-mount/Makefile +++ b/user/apps/test-mount/Makefile @@ -1,4 +1,4 @@ -TOOLCHAIN="+nightly-2024-07-23-x86_64-unknown-linux-gnu" +TOOLCHAIN="+nightly-2024-11-05-x86_64-unknown-linux-gnu" RUSTFLAGS+="" ifdef DADK_CURRENT_BUILD_DIR diff --git a/user/apps/test_alarm/Makefile b/user/apps/test_alarm/Makefile index d9eb6cd1e..352c0562c 100644 --- a/user/apps/test_alarm/Makefile +++ b/user/apps/test_alarm/Makefile @@ -1,4 +1,4 @@ -TOOLCHAIN="+nightly-2024-07-23-x86_64-unknown-linux-gnu" +TOOLCHAIN="+nightly-2024-11-05-x86_64-unknown-linux-gnu" RUSTFLAGS+="" ifdef DADK_CURRENT_BUILD_DIR diff --git a/user/apps/test_ebpf/Makefile b/user/apps/test_ebpf/Makefile index f2770a320..0b5d9e43a 100644 --- a/user/apps/test_ebpf/Makefile +++ b/user/apps/test_ebpf/Makefile @@ -1,4 +1,4 @@ -TOOLCHAIN="+nightly-2024-07-23-x86_64-unknown-linux-gnu" +TOOLCHAIN="+nightly-2024-11-05-x86_64-unknown-linux-gnu" RUSTFLAGS+="" ifdef DADK_CURRENT_BUILD_DIR diff --git a/user/apps/test_ebpf/syscall_ebpf/syscall_ebpf-ebpf/rust-toolchain.toml b/user/apps/test_ebpf/syscall_ebpf/syscall_ebpf-ebpf/rust-toolchain.toml index 447b8f049..fda4ec82e 100644 --- a/user/apps/test_ebpf/syscall_ebpf/syscall_ebpf-ebpf/rust-toolchain.toml +++ b/user/apps/test_ebpf/syscall_ebpf/syscall_ebpf-ebpf/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2024-07-23" +channel = "nightly-2024-11-05" # The source code of rustc, provided by the rust-src component, is needed for # building eBPF programs. components = [ diff --git a/user/apps/test_namespace/Makefile b/user/apps/test_namespace/Makefile index 1b0274d20..352c0562c 100644 --- a/user/apps/test_namespace/Makefile +++ b/user/apps/test_namespace/Makefile @@ -1,4 +1,4 @@ -TOOLCHAIN="+nightly-2023-08-15-x86_64-unknown-linux-gnu" +TOOLCHAIN="+nightly-2024-11-05-x86_64-unknown-linux-gnu" RUSTFLAGS+="" ifdef DADK_CURRENT_BUILD_DIR diff --git a/user/apps/test_namespace/makefile.toml b/user/apps/test_namespace/makefile.toml index dc3f667e6..309c8631d 100644 --- a/user/apps/test_namespace/makefile.toml +++ b/user/apps/test_namespace/makefile.toml @@ -1,7 +1,7 @@ # Makefile.toml [env] -TOOLCHAIN = "+nightly-2023-08-15-x86_64-unknown-linux-gnu" +TOOLCHAIN = "+nightly-2024-11-05-x86_64-unknown-linux-gnu" ARCH = { default = "x86_64" } RUST_TARGET = { default = { if = "eq(env.ARCH, 'riscv64')", value = "riscv64gc-unknown-linux-gnu", else = "x86_64-unknown-linux-musl" } } diff --git a/user/apps/test_socket/Makefile b/user/apps/test_socket/Makefile index d9eb6cd1e..352c0562c 100644 --- a/user/apps/test_socket/Makefile +++ b/user/apps/test_socket/Makefile @@ -1,4 +1,4 @@ -TOOLCHAIN="+nightly-2024-07-23-x86_64-unknown-linux-gnu" +TOOLCHAIN="+nightly-2024-11-05-x86_64-unknown-linux-gnu" RUSTFLAGS+="" ifdef DADK_CURRENT_BUILD_DIR diff --git a/user/apps/test_statx/Makefile b/user/apps/test_statx/Makefile index 127c6ccb3..0d1403539 100644 --- a/user/apps/test_statx/Makefile +++ b/user/apps/test_statx/Makefile @@ -1,4 +1,4 @@ -TOOLCHAIN="+nightly-2024-07-23-x86_64-unknown-linux-gnu" +TOOLCHAIN="+nightly-2024-11-05-x86_64-unknown-linux-gnu" # RUSTFLAGS+="-C target-feature=+crt-static -C link-arg=-no-pie" ifdef DADK_CURRENT_BUILD_DIR diff --git a/user/apps/test_tokio/Makefile b/user/apps/test_tokio/Makefile index d9eb6cd1e..352c0562c 100644 --- a/user/apps/test_tokio/Makefile +++ b/user/apps/test_tokio/Makefile @@ -1,4 +1,4 @@ -TOOLCHAIN="+nightly-2024-07-23-x86_64-unknown-linux-gnu" +TOOLCHAIN="+nightly-2024-11-05-x86_64-unknown-linux-gnu" RUSTFLAGS+="" ifdef DADK_CURRENT_BUILD_DIR diff --git a/user/apps/user-manage/Makefile b/user/apps/user-manage/Makefile index 82cc81f92..b1691ea47 100644 --- a/user/apps/user-manage/Makefile +++ b/user/apps/user-manage/Makefile @@ -1,6 +1,6 @@ # The toolchain we use. # You can get it by running DragonOS' `tools/bootstrap.sh` -TOOLCHAIN="+nightly-2024-07-23-x86_64-unknown-linux-gnu" +TOOLCHAIN="+nightly-2024-11-05-x86_64-unknown-linux-gnu" RUSTFLAGS+="" ifdef DADK_CURRENT_BUILD_DIR diff --git a/user/dadk/config/dog_0_1_0.dadk b/user/dadk/config/dog_0_1_0.dadk index 1e145150e..157f085cb 100644 --- a/user/dadk/config/dog_0_1_0.dadk +++ b/user/dadk/config/dog_0_1_0.dadk @@ -8,7 +8,7 @@ "Git": { "url": "https://git.mirrors.dragonos.org.cn/DragonOS-Community/dog.git", "branch": null, - "revision": "4ad6075686" + "revision": "6f2c0c8f12" } } }, diff --git a/user/dadk/config/dragon_reach-0.1.0.dadk b/user/dadk/config/dragon_reach-0.1.0.dadk index bf0472a34..73dac2ac2 100644 --- a/user/dadk/config/dragon_reach-0.1.0.dadk +++ b/user/dadk/config/dragon_reach-0.1.0.dadk @@ -6,7 +6,7 @@ "BuildFromSource": { "Git": { "url" : "https://git.mirrors.dragonos.org.cn/DragonOS-Community/DragonReach.git", - "revision": "01cdc56863" + "revision": "e945c217b3" } } },