mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-26 19:03:27 +00:00
Fix multiple deprecation problems
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
cda8ffa7da
commit
952fbacaf1
@ -3,7 +3,7 @@
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_variables)]
|
||||
|
||||
use core::ops::Range;
|
||||
use core::{fmt::Display, ops::Range};
|
||||
|
||||
use aster_frame::mm::VmIo;
|
||||
use aster_rights::Full;
|
||||
@ -737,9 +737,9 @@ impl ExfatName {
|
||||
}
|
||||
}
|
||||
|
||||
impl ToString for ExfatName {
|
||||
fn to_string(&self) -> String {
|
||||
String::from_utf16_lossy(&self.0)
|
||||
impl Display for ExfatName {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
write!(f, "{}", String::from_utf16_lossy(&self.0))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -481,6 +481,8 @@ impl ExfatInodeInner {
|
||||
target_name.to_string()
|
||||
};
|
||||
|
||||
// FIXME: This isn't expected by the compiler.
|
||||
#[allow(non_local_definitions)]
|
||||
impl DirentVisitor for Vec<(String, usize)> {
|
||||
fn visit(
|
||||
&mut self,
|
||||
@ -992,6 +994,8 @@ impl ExfatInode {
|
||||
let new_parent_hash = self.hash_index();
|
||||
let sub_dir = inner.num_sub_inodes;
|
||||
let mut child_offsets: Vec<usize> = vec![];
|
||||
// FIXME: This isn't expected by the compiler.
|
||||
#[allow(non_local_definitions)]
|
||||
impl DirentVisitor for Vec<usize> {
|
||||
fn visit(
|
||||
&mut self,
|
||||
|
@ -118,7 +118,7 @@ impl InodeHandle_ {
|
||||
let mut offset = self.offset.lock();
|
||||
let new_offset: isize = match pos {
|
||||
SeekFrom::Start(off /* as usize */) => {
|
||||
if off > isize::max_value() as usize {
|
||||
if off > isize::MAX as usize {
|
||||
return_errno_with_message!(Errno::EINVAL, "file offset is too large");
|
||||
}
|
||||
off as isize
|
||||
@ -137,7 +137,7 @@ impl InodeHandle_ {
|
||||
if new_offset < 0 {
|
||||
return_errno_with_message!(Errno::EINVAL, "file offset must not be negative");
|
||||
}
|
||||
// Invariant: 0 <= new_offset <= isize::max_value()
|
||||
// Invariant: 0 <= new_offset <= isize::MAX
|
||||
let new_offset = new_offset as usize;
|
||||
*offset = new_offset;
|
||||
Ok(new_offset)
|
||||
|
@ -351,12 +351,12 @@ impl DirInMemory {
|
||||
match old {
|
||||
DentryInMemory::Dir(ref mut dir) => {
|
||||
dir.inode = lookup_new_inode_result.unwrap();
|
||||
dir.name = new_name.clone();
|
||||
dir.name.clone_from(new_name);
|
||||
dir.depth = self.depth + 1;
|
||||
}
|
||||
DentryInMemory::File(ref mut file) => {
|
||||
file.inode = lookup_new_inode_result.unwrap();
|
||||
file.name = new_name.clone();
|
||||
file.name.clone_from(new_name);
|
||||
}
|
||||
}
|
||||
if exist {
|
||||
|
@ -67,10 +67,7 @@ pub struct RLimit64 {
|
||||
|
||||
impl RLimit64 {
|
||||
pub fn new(cur: u64) -> Self {
|
||||
Self {
|
||||
cur,
|
||||
max: u64::max_value(),
|
||||
}
|
||||
Self { cur, max: u64::MAX }
|
||||
}
|
||||
|
||||
pub fn get_cur(&self) -> u64 {
|
||||
@ -85,8 +82,8 @@ impl RLimit64 {
|
||||
impl Default for RLimit64 {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
cur: u64::max_value(),
|
||||
max: u64::max_value(),
|
||||
cur: u64::MAX,
|
||||
max: u64::MAX,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user