mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-27 03:13:23 +00:00
Fix multiple dead code problems
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
05533d7afd
commit
eaf51ccb24
@ -1,8 +1,5 @@
|
|||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
#![allow(dead_code)]
|
|
||||||
#![allow(unused_variables)]
|
|
||||||
|
|
||||||
use core::{fmt::Display, ops::Range};
|
use core::{fmt::Display, ops::Range};
|
||||||
|
|
||||||
use aster_frame::mm::VmIo;
|
use aster_frame::mm::VmIo;
|
||||||
@ -58,18 +55,25 @@ impl ExfatDentry {
|
|||||||
|
|
||||||
const EXFAT_UNUSED: u8 = 0x00;
|
const EXFAT_UNUSED: u8 = 0x00;
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
const EXFAT_INVAL: u8 = 0x80;
|
const EXFAT_INVAL: u8 = 0x80;
|
||||||
const EXFAT_BITMAP: u8 = 0x81;
|
const EXFAT_BITMAP: u8 = 0x81;
|
||||||
|
#[allow(dead_code)]
|
||||||
const EXFAT_UPCASE: u8 = 0x82;
|
const EXFAT_UPCASE: u8 = 0x82;
|
||||||
|
#[allow(dead_code)]
|
||||||
const EXFAT_VOLUME: u8 = 0x83;
|
const EXFAT_VOLUME: u8 = 0x83;
|
||||||
const EXFAT_FILE: u8 = 0x85;
|
const EXFAT_FILE: u8 = 0x85;
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
const EXFAT_GUID: u8 = 0xA0;
|
const EXFAT_GUID: u8 = 0xA0;
|
||||||
|
#[allow(dead_code)]
|
||||||
const EXFAT_PADDING: u8 = 0xA1;
|
const EXFAT_PADDING: u8 = 0xA1;
|
||||||
|
#[allow(dead_code)]
|
||||||
const EXFAT_ACLTAB: u8 = 0xA2;
|
const EXFAT_ACLTAB: u8 = 0xA2;
|
||||||
|
|
||||||
const EXFAT_STREAM: u8 = 0xC0;
|
const EXFAT_STREAM: u8 = 0xC0;
|
||||||
const EXFAT_NAME: u8 = 0xC1;
|
const EXFAT_NAME: u8 = 0xC1;
|
||||||
|
#[allow(dead_code)]
|
||||||
const EXFAT_ACL: u8 = 0xC2;
|
const EXFAT_ACL: u8 = 0xC2;
|
||||||
|
|
||||||
const EXFAT_VENDOR_EXT: u8 = 0xE0;
|
const EXFAT_VENDOR_EXT: u8 = 0xE0;
|
||||||
@ -201,6 +205,7 @@ impl ExfatDentrySet {
|
|||||||
/// Stream dentry index.
|
/// Stream dentry index.
|
||||||
const ES_IDX_STREAM: usize = 1;
|
const ES_IDX_STREAM: usize = 1;
|
||||||
/// Name dentry index.
|
/// Name dentry index.
|
||||||
|
#[allow(dead_code)]
|
||||||
const ES_IDX_FIRST_FILENAME: usize = 2;
|
const ES_IDX_FIRST_FILENAME: usize = 2;
|
||||||
|
|
||||||
pub(super) fn new(dentries: Vec<ExfatDentry>, should_checksum_match: bool) -> Result<Self> {
|
pub(super) fn new(dentries: Vec<ExfatDentry>, should_checksum_match: bool) -> Result<Self> {
|
||||||
@ -216,7 +221,7 @@ impl ExfatDentrySet {
|
|||||||
fs: Arc<ExfatFS>,
|
fs: Arc<ExfatFS>,
|
||||||
name: &str,
|
name: &str,
|
||||||
inode_type: InodeType,
|
inode_type: InodeType,
|
||||||
mode: InodeMode,
|
_mode: InodeMode,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
let attrs = {
|
let attrs = {
|
||||||
if inode_type == InodeType::Dir {
|
if inode_type == InodeType::Dir {
|
||||||
@ -298,7 +303,7 @@ impl ExfatDentrySet {
|
|||||||
let mut dentries = Vec::<ExfatDentry>::with_capacity(num_secondary + 1);
|
let mut dentries = Vec::<ExfatDentry>::with_capacity(num_secondary + 1);
|
||||||
dentries.push(ExfatDentry::File(*file_dentry));
|
dentries.push(ExfatDentry::File(*file_dentry));
|
||||||
|
|
||||||
for i in 0..num_secondary {
|
for _i in 0..num_secondary {
|
||||||
let dentry_result = iter.next();
|
let dentry_result = iter.next();
|
||||||
if dentry_result.is_none() {
|
if dentry_result.is_none() {
|
||||||
return_errno!(Errno::ENOENT);
|
return_errno!(Errno::ENOENT);
|
||||||
@ -477,7 +482,7 @@ impl Iterator for ExfatDentryIterator {
|
|||||||
|
|
||||||
let read_result = self.page_cache.read_bytes(byte_start, &mut dentry_buf);
|
let read_result = self.page_cache.read_bytes(byte_start, &mut dentry_buf);
|
||||||
|
|
||||||
if let Err(e) = read_result {
|
if let Err(_e) = read_result {
|
||||||
return Some(Err(Error::with_message(
|
return Some(Err(Error::with_message(
|
||||||
Errno::EIO,
|
Errno::EIO,
|
||||||
"Unable to read dentry from page cache.",
|
"Unable to read dentry from page cache.",
|
||||||
@ -656,7 +661,7 @@ impl ExfatName {
|
|||||||
fn push_char(
|
fn push_char(
|
||||||
&mut self,
|
&mut self,
|
||||||
value: UTF16Char,
|
value: UTF16Char,
|
||||||
upcase_table: Arc<SpinLock<ExfatUpcaseTable>>,
|
_upcase_table: Arc<SpinLock<ExfatUpcaseTable>>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
if !Self::is_valid_char(value) {
|
if !Self::is_valid_char(value) {
|
||||||
return_errno_with_message!(Errno::EINVAL, "not a valid char")
|
return_errno_with_message!(Errno::EINVAL, "not a valid char")
|
||||||
@ -682,10 +687,6 @@ impl ExfatName {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn len(&self) -> usize {
|
|
||||||
self.0.len()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn checksum(&self) -> u16 {
|
pub fn checksum(&self) -> u16 {
|
||||||
let bytes = self
|
let bytes = self
|
||||||
.0
|
.0
|
||||||
@ -696,7 +697,7 @@ impl ExfatName {
|
|||||||
calc_checksum_16(&bytes, EMPTY_RANGE, 0)
|
calc_checksum_16(&bytes, EMPTY_RANGE, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_str(name: &str, upcase_table: Arc<SpinLock<ExfatUpcaseTable>>) -> Result<Self> {
|
pub fn from_str(name: &str, _upcase_table: Arc<SpinLock<ExfatUpcaseTable>>) -> Result<Self> {
|
||||||
let name = ExfatName(name.encode_utf16().collect());
|
let name = ExfatName(name.encode_utf16().collect());
|
||||||
// upcase_table.lock().transform_to_upcase(&mut name.0)?;
|
// upcase_table.lock().transform_to_upcase(&mut name.0)?;
|
||||||
name.verify()?;
|
name.verify()?;
|
||||||
|
@ -165,16 +165,23 @@ impl ElfHeader {
|
|||||||
pub struct HeaderPt2_64 {
|
pub struct HeaderPt2_64 {
|
||||||
pub type_: Type_,
|
pub type_: Type_,
|
||||||
pub machine: Machine_,
|
pub machine: Machine_,
|
||||||
|
#[allow(dead_code)]
|
||||||
pub version: u32,
|
pub version: u32,
|
||||||
pub entry_point: u64,
|
pub entry_point: u64,
|
||||||
pub ph_offset: u64,
|
pub ph_offset: u64,
|
||||||
|
#[allow(dead_code)]
|
||||||
pub sh_offset: u64,
|
pub sh_offset: u64,
|
||||||
|
#[allow(dead_code)]
|
||||||
pub flags: u32,
|
pub flags: u32,
|
||||||
|
#[allow(dead_code)]
|
||||||
pub header_size: u16,
|
pub header_size: u16,
|
||||||
pub ph_entry_size: u16,
|
pub ph_entry_size: u16,
|
||||||
pub ph_count: u16,
|
pub ph_count: u16,
|
||||||
|
#[allow(dead_code)]
|
||||||
pub sh_entry_size: u16,
|
pub sh_entry_size: u16,
|
||||||
|
#[allow(dead_code)]
|
||||||
pub sh_count: u16,
|
pub sh_count: u16,
|
||||||
|
#[allow(dead_code)]
|
||||||
pub sh_str_index: u16,
|
pub sh_str_index: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ pub enum ClockId {
|
|||||||
pub enum DynamicClockIdInfo {
|
pub enum DynamicClockIdInfo {
|
||||||
Pid(u32, DynamicClockType),
|
Pid(u32, DynamicClockType),
|
||||||
Tid(u32, DynamicClockType),
|
Tid(u32, DynamicClockType),
|
||||||
|
#[allow(dead_code)]
|
||||||
Fd(u32),
|
Fd(u32),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ pub fn sys_creat(path_addr: Vaddr, mode: u16) -> Result<SyscallReturn> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// File for output busybox ash log.
|
/// File for output busybox ash log.
|
||||||
|
#[allow(dead_code)]
|
||||||
struct BusyBoxTraceFile;
|
struct BusyBoxTraceFile;
|
||||||
|
|
||||||
impl FileLike for BusyBoxTraceFile {
|
impl FileLike for BusyBoxTraceFile {
|
||||||
|
@ -83,6 +83,7 @@ pub fn sys_utimensat(
|
|||||||
|
|
||||||
trait UtimeExt {
|
trait UtimeExt {
|
||||||
fn utime_now() -> Self;
|
fn utime_now() -> Self;
|
||||||
|
#[allow(dead_code)]
|
||||||
fn utime_omit() -> Self;
|
fn utime_omit() -> Self;
|
||||||
fn is_utime_now(&self) -> bool;
|
fn is_utime_now(&self) -> bool;
|
||||||
fn is_utime_omit(&self) -> bool;
|
fn is_utime_omit(&self) -> bool;
|
||||||
|
@ -32,6 +32,7 @@ pub enum ProjectType {
|
|||||||
/// The osdk manifest from configuration file `OSDK.toml`.
|
/// The osdk manifest from configuration file `OSDK.toml`.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct TomlManifest {
|
pub struct TomlManifest {
|
||||||
|
#[allow(dead_code)]
|
||||||
pub project_type: Option<ProjectType>,
|
pub project_type: Option<ProjectType>,
|
||||||
pub default_scheme: Scheme,
|
pub default_scheme: Scheme,
|
||||||
pub map: HashMap<String, Scheme>,
|
pub map: HashMap<String, Scheme>,
|
||||||
|
Reference in New Issue
Block a user