YJwu2023 ef9c935732
fix: 检查栈帧大小 (#1126)
* feat: 打开clippy的stack overflow静态检查

*限制栈大小最大为4096字节
*限制栈中的数组最大为1024字节

* fix: 修复部分函数的爆栈问题 (#1172)

* fix:修复部分函数的爆栈问题

* feat(filesystem): 重构FAT文件系统重命名和移动文件逻辑

将rename_file_in_same_dir和move_file_to_other_dir函数重构为LockedFATInode的方法,优化代码结构。同时更新clippy配置,添加栈大小和数组大小阈值。

Signed-off-by: longjin <longjin@DragonOS.org>

---------

Signed-off-by: longjin <longjin@DragonOS.org>
Co-authored-by: longjin <longjin@DragonOS.org>

---------

Signed-off-by: longjin <longjin@DragonOS.org>
Co-authored-by: DoL <1240800466@qq.com>
Co-authored-by: longjin <longjin@DragonOS.org>
2025-05-26 17:33:25 +08:00

106 lines
2.4 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#![no_main] // <1>
#![no_std]
#![feature(alloc_error_handler)]
#![feature(asm_goto)]
#![feature(new_zeroed_alloc)]
#![feature(allocator_api)]
#![feature(arbitrary_self_types)]
#![feature(concat_idents)]
#![feature(const_for)]
#![feature(const_size_of_val)]
#![feature(const_trait_impl)]
#![feature(core_intrinsics)]
#![feature(c_variadic)]
#![feature(c_void_variant)]
#![feature(extract_if)]
#![feature(fn_align)]
#![feature(linked_list_retain)]
#![feature(naked_functions)]
#![feature(ptr_internals)]
#![feature(trait_upcasting)]
#![feature(slice_ptr_get)]
#![feature(sync_unsafe_cell)]
#![feature(vec_into_raw_parts)]
#![feature(linkage)]
#![feature(panic_can_unwind)]
#![allow(static_mut_refs, non_local_definitions, internal_features)]
// clippy的配置
#![deny(clippy::all)]
// 取消下面的注释以启用clippy对栈帧大小的检查
// #![deny(clippy::large_stack_frames)]
// #![deny(clippy::large_const_arrays)]
// DragonOS允许在函数中使用return语句尤其是长函数时我们推荐这么做
#![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]
extern crate std;
/// 导出x86_64架构相关的代码命名为arch模块
#[macro_use]
mod arch;
#[macro_use]
mod libs;
#[macro_use]
mod include;
mod bpf;
mod cgroup;
mod debug;
mod driver; // 如果driver依赖了libs应该在libs后面导出
mod exception;
mod filesystem;
mod init;
mod ipc;
mod misc;
mod mm;
mod namespaces;
mod net;
mod perf;
mod process;
mod sched;
mod smp;
mod syscall;
mod time;
#[cfg(target_arch = "x86_64")]
mod virt;
#[macro_use]
extern crate alloc;
#[macro_use]
extern crate atomic_enum;
#[macro_use]
extern crate bitflags;
extern crate elf;
#[macro_use]
extern crate lazy_static;
extern crate num;
#[macro_use]
extern crate num_derive;
extern crate smoltcp;
#[macro_use]
extern crate intertrait;
#[cfg(target_arch = "x86_64")]
extern crate x86;
#[macro_use]
extern crate kcmdline_macros;
extern crate klog_types;
extern crate uefi;
extern crate uefi_raw;
#[macro_use]
extern crate wait_queue_macros;
use crate::mm::allocator::kernel_allocator::KernelAllocator;
// 声明全局的分配器
#[cfg_attr(not(test), global_allocator)]
pub static KERNEL_ALLOCATOR: KernelAllocator = KernelAllocator;