Remove module-level allowed lints in system call handlers

This commit is contained in:
Zhang Junyang 2024-08-11 12:17:25 +00:00 committed by Tate, Hongliang Tian
parent a739b3828d
commit 19ad2a2eb4
12 changed files with 11 additions and 30 deletions

View File

@ -1,6 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
#![allow(non_camel_case_types)]
use core::time::Duration;
use int_to_c_enum::TryFromInt;
@ -34,6 +33,7 @@ pub fn sys_clock_gettime(clockid: clockid_t, timespec_addr: Vaddr) -> Result<Sys
// The hard-coded clock IDs.
#[derive(Debug, Copy, Clone, TryFromInt, PartialEq)]
#[repr(i32)]
#[allow(non_camel_case_types)]
pub enum ClockId {
CLOCK_REALTIME = 0,
CLOCK_MONOTONIC = 1,

View File

@ -1,7 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
#![allow(unused_variables)]
use ostd::cpu::UserContext;
use super::SyscallReturn;
@ -11,7 +9,6 @@ use crate::{
};
pub fn sys_fork(parent_context: &UserContext) -> Result<SyscallReturn> {
let current = current!();
let clone_args = CloneArgs::for_fork();
let child_pid = clone_child(parent_context, clone_args).unwrap();
Ok(SyscallReturn::Return(child_pid as _))

View File

@ -1,7 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
#![allow(dead_code)]
use core::marker::PhantomData;
use super::SyscallReturn;
@ -234,6 +232,7 @@ impl DirentSerializer for Dirent64 {
#[repr(u8)]
#[derive(Debug, Clone, Copy)]
enum DirentType {
#[allow(dead_code)]
DT_UNKNOWN = 0,
DT_FIFO = 1,
DT_CHR = 2,
@ -242,6 +241,7 @@ enum DirentType {
DT_REG = 8,
DT_LNK = 10,
DT_SOCK = 12,
#[allow(dead_code)]
DT_WHT = 14,
}

View File

@ -1,7 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
#![allow(non_camel_case_types)]
use int_to_c_enum::TryFromInt;
use super::SyscallReturn;

View File

@ -1,7 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
#![allow(dead_code)]
//! This mod defines mmap flags and the handler to syscall mmap
use align_ext::AlignExt;

View File

@ -1,8 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
#![allow(dead_code)]
#![allow(unused_variables)]
use super::SyscallReturn;
use crate::{
prelude::*,
@ -85,7 +82,9 @@ pub enum PrctlCmd {
PR_GET_PDEATHSIG(Vaddr),
PR_SET_NAME(Vaddr),
PR_GET_NAME(Vaddr),
#[allow(dead_code)]
PR_SET_TIMERSLACK(u64),
#[allow(dead_code)]
PR_GET_TIMERSLACK,
PR_SET_DUMPABLE(Dumpable),
PR_GET_DUMPABLE,
@ -100,7 +99,7 @@ pub enum Dumpable {
}
impl PrctlCmd {
fn from_args(option: i32, arg2: u64, arg3: u64, arg4: u64, arg5: u64) -> Result<PrctlCmd> {
fn from_args(option: i32, arg2: u64, _arg3: u64, _arg4: u64, _arg5: u64) -> Result<PrctlCmd> {
match option {
PR_SET_PDEATHSIG => {
let signum = SigNum::try_from(arg2 as u8)?;

View File

@ -1,7 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
#![allow(dead_code)]
use core::time::Duration;
use super::{
@ -203,6 +201,7 @@ impl FdSet {
}
/// Equivalent to FD_CLR.
#[allow(unused)]
pub fn unset(&mut self, fd: FileDesc) -> Result<()> {
let fd = fd as usize;
if fd >= FD_SETSIZE {

View File

@ -1,6 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
#![allow(non_camel_case_types)]
use core::time::Duration;
use super::SyscallReturn;
@ -12,6 +11,7 @@ use crate::{
/// `ItimerType` is used to differ the target timer for some timer-related syscalls.
#[derive(Debug, Copy, Clone, TryFromInt, PartialEq)]
#[repr(i32)]
#[allow(non_camel_case_types)]
pub(super) enum ItimerType {
ITIMER_REAL = 0,
ITIMER_VIRTUAL = 1,

View File

@ -1,7 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
#![allow(dead_code)]
use super::SyscallReturn;
use crate::{
prelude::*,
@ -111,5 +109,6 @@ impl From<SigStack> for stack_t {
}
}
#[allow(unused)]
const SIGSTKSZ: usize = 8192;
const MINSTKSZ: usize = 2048;

View File

@ -1,7 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
#![allow(dead_code)]
use super::SyscallReturn;
use crate::{
fs::{

View File

@ -1,7 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
#![allow(unused_variables)]
use super::SyscallReturn;
use crate::{
prelude::*,
@ -11,9 +9,9 @@ use crate::{
pub fn sys_waitid(
which: u64,
upid: u64,
infoq_addr: u64,
_infoq_addr: u64,
options: u64,
rusage_addr: u64,
_rusage_addr: u64,
) -> Result<SyscallReturn> {
// FIXME: what does infoq and rusage use for?
let process_filter = ProcessFilter::from_which_and_id(which, upid);

View File

@ -1,13 +1,8 @@
// SPDX-License-Identifier: MPL-2.0
#![allow(dead_code)]
use super::SyscallReturn;
use crate::{fs::file_table::FileDesc, prelude::*};
const STDOUT: u64 = 1;
const STDERR: u64 = 2;
pub fn sys_write(fd: FileDesc, user_buf_ptr: Vaddr, user_buf_len: usize) -> Result<SyscallReturn> {
debug!(
"fd = {}, user_buf_ptr = 0x{:x}, user_buf_len = 0x{:x}",