diff --git a/cykusz-rs/src/arch/x86_64/output/mod.rs b/cykusz-rs/src/arch/x86_64/output/mod.rs index 553cd519..971872dd 100644 --- a/cykusz-rs/src/arch/x86_64/output/mod.rs +++ b/cykusz-rs/src/arch/x86_64/output/mod.rs @@ -195,6 +195,11 @@ pub fn log_fmt(args: core::fmt::Arguments) -> core::fmt::Result { core::fmt::write(&mut Log {}, args) } +pub fn log_fmt_disabled(_args: core::fmt::Arguments) -> core::fmt::Result { + //core::fmt::write(&mut Log {}, args) + Ok(()) +} + #[macro_export] macro_rules! println { ($fmt:expr) => (print!(concat!($fmt, "\n"))); @@ -215,9 +220,11 @@ macro_rules! logln_disabled { } #[macro_export] +#[allow(unused)] macro_rules! log_disabled { ($($arg:tt)*) => {{ - //$crate::arch::output::log_fmt(format_args!($($arg)*)).unwrap(); + let _ = ($($arg)*); + $crate::arch::output::log_fmt_disabled(format_args!($($arg)*)).unwrap(); }}; } @@ -228,9 +235,10 @@ macro_rules! logln { } #[macro_export] +#[allow(unused)] macro_rules! log { ($($arg:tt)*) => ({ - //$crate::arch::output::log_fmt(format_args!($($arg)*)).unwrap(); + $crate::arch::output::log_fmt_disabled(format_args!($($arg)*)).unwrap(); }); } #[macro_export] @@ -240,9 +248,10 @@ macro_rules! logln2 { } #[macro_export] +#[allow(unused)] macro_rules! log2 { ($($arg:tt)*) => {{ - //$crate::arch::output::log_fmt(format_args!($($arg)*)).unwrap(); + $crate::arch::output::log_fmt_disabled(format_args!($($arg)*)).unwrap(); }}; } #[macro_export] @@ -252,9 +261,10 @@ macro_rules! logln3 { } #[macro_export] +#[allow(unused)] macro_rules! log3 { ($($arg:tt)*) => {{ - //$crate::arch::output::log_fmt(format_args!($($arg)*)).unwrap(); + $crate::arch::output::log_fmt_disabled(format_args!($($arg)*)).unwrap(); }}; } @@ -265,8 +275,9 @@ macro_rules! logln4 { } #[macro_export] +#[allow(unused)] macro_rules! log4 { ($($arg:tt)*) => {{ - $crate::arch::output::log_fmt(format_args!($($arg)*)).unwrap(); + $crate::arch::output::log_fmt_disabled(format_args!($($arg)*)).unwrap(); }}; } diff --git a/cykusz-rs/src/arch/x86_64/syscall.rs b/cykusz-rs/src/arch/x86_64/syscall.rs index 05508de9..10bac522 100644 --- a/cykusz-rs/src/arch/x86_64/syscall.rs +++ b/cykusz-rs/src/arch/x86_64/syscall.rs @@ -56,7 +56,7 @@ pub extern "C" fn fast_syscall_handler(sys_frame: &mut SyscallFrame, regs: &mut regs.rax, regs.rdi, regs.rsi, regs.rdx, regs.r10, regs.r8, regs.r9, ); - logln_disabled!("done syscall {} = {}", regs.rax, res); + logln_disabled!("done syscall {} = {:?}", regs.rax, res); crate::arch::signal::arch_sys_check_signals(res, sys_frame, regs); } diff --git a/cykusz-rs/src/arch/x86_64/utils.rs b/cykusz-rs/src/arch/x86_64/utils.rs index ea03c15d..5648c9c9 100644 --- a/cykusz-rs/src/arch/x86_64/utils.rs +++ b/cykusz-rs/src/arch/x86_64/utils.rs @@ -1,4 +1,3 @@ -use alloc::vec::Vec; use crate::arch::mm::VirtAddr; use crate::drivers::elf::types::AuxvType; use crate::drivers::elf::ElfHeader; @@ -61,7 +60,7 @@ impl<'a> StackHelper<'a> { } pub unsafe fn write_aux(&mut self, hdr: &ElfHeader, base_addr: VirtAddr, path_ptr: u64) { - let mut hdr: [(AuxvType, usize); 5] = [ + let hdr: [(AuxvType, usize); 5] = [ (AuxvType::AtPhdr, hdr.e_phoff as usize + base_addr.0), (AuxvType::AtPhEnt, hdr.e_phentsize as usize), (AuxvType::AtPhNum, hdr.e_phnum as usize), diff --git a/cykusz-rs/src/kernel/fs/ext2/blockgroup.rs b/cykusz-rs/src/kernel/fs/ext2/blockgroup.rs index 0cb501fb..05a9efd8 100644 --- a/cykusz-rs/src/kernel/fs/ext2/blockgroup.rs +++ b/cykusz-rs/src/kernel/fs/ext2/blockgroup.rs @@ -359,7 +359,7 @@ impl BlockGroupDescriptors { pub fn debug(&self) { let l = self.d_desc.lock(); - for _d in l.vec.iter() { + for d in l.vec.iter() { logln_disabled!("{:?}", d); } } diff --git a/cykusz-rs/src/kernel/fs/ext2/mod.rs b/cykusz-rs/src/kernel/fs/ext2/mod.rs index 9d6c88fd..e9d079a0 100644 --- a/cykusz-rs/src/kernel/fs/ext2/mod.rs +++ b/cykusz-rs/src/kernel/fs/ext2/mod.rs @@ -4,7 +4,6 @@ use alloc::sync::{Arc, Weak}; use crate::kernel::block::BlockDev; use spin::Once; use uuid::Uuid; -use crate::kernel::device::Device; use crate::kernel::fs::dirent::{DirEntry, DirEntryItem}; use crate::kernel::fs::ext2::buf_block::{BufBlock, SliceBlock}; diff --git a/cykusz-rs/src/kernel/syscall/sys.rs b/cykusz-rs/src/kernel/syscall/sys.rs index 1f8a4226..5faca316 100644 --- a/cykusz-rs/src/kernel/syscall/sys.rs +++ b/cykusz-rs/src/kernel/syscall/sys.rs @@ -473,8 +473,6 @@ pub fn sys_unlink(at: u64, path: u64, path_len: u64, flags: u64) -> SyscallResul return Err(SyscallError::EBADFD); } - - let (_, name) = path.containing_dir(); let file = lookup_by_real_path(path, LookupMode::None)?; @@ -1107,9 +1105,13 @@ pub fn sys_truncate(fd: u64, size: u64) -> SyscallResult { logln4!("truncate {} to size {}", fd, size); let task = current_task_ref(); - task.filetable().get_handle(fd as usize).ok_or(SyscallError::EBADFD)?.inode.inode().truncate(size as usize).map(|_r| { - Ok(0) - })? + task.filetable() + .get_handle(fd as usize) + .ok_or(SyscallError::EBADFD)? + .inode + .inode() + .truncate(size as usize) + .map(|_r| Ok(0))? } pub fn sys_futex_wake(uaddr: u64) -> SyscallResult { diff --git a/cykusz-rs/src/kernel/task/mod.rs b/cykusz-rs/src/kernel/task/mod.rs index 3406bf1b..6e489b15 100644 --- a/cykusz-rs/src/kernel/task/mod.rs +++ b/cykusz-rs/src/kernel/task/mod.rs @@ -202,8 +202,16 @@ impl Task { if let Some((base_addr, entry, elf_hdr, tls_vm)) = vm.load_bin(exe.clone()) { vm.log_vm(); unsafe { - self.arch_task_mut() - .exec(base_addr, entry, &elf_hdr, vm, tls_vm, exe.full_path(), args, envs) + self.arch_task_mut().exec( + base_addr, + entry, + &elf_hdr, + vm, + tls_vm, + exe.full_path(), + args, + envs, + ) } } else { Err(SyscallError::EINVAL)