Replace old user space read/write with new APIs

This commit is contained in:
Chen Chengjun
2024-08-09 16:11:43 +08:00
committed by Tate, Hongliang Tian
parent 7ade2fcb57
commit 75da7fd30e
82 changed files with 252 additions and 329 deletions

View File

@ -8,7 +8,6 @@ use crate::{
},
prelude::*,
syscall::constants::MAX_FILENAME_LEN,
util::read_cstring_from_user,
};
pub fn sys_linkat(
@ -18,8 +17,10 @@ pub fn sys_linkat(
new_path_addr: Vaddr,
flags: u32,
) -> Result<SyscallReturn> {
let old_path = read_cstring_from_user(old_path_addr, MAX_FILENAME_LEN)?;
let new_path = read_cstring_from_user(new_path_addr, MAX_FILENAME_LEN)?;
let user_space = CurrentUserSpace::get();
let old_path = user_space.read_cstring(old_path_addr, MAX_FILENAME_LEN)?;
let new_path = user_space.read_cstring(new_path_addr, MAX_FILENAME_LEN)?;
let flags =
LinkFlags::from_bits(flags).ok_or(Error::with_message(Errno::EINVAL, "invalid flags"))?;
debug!(