mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-23 09:23:25 +00:00
Refactor Dentry
to optimize the vfs layer
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
271e893889
commit
ea489252f4
@ -58,7 +58,7 @@ fn lookup_executable_file(
|
||||
filename: String,
|
||||
flags: OpenFlags,
|
||||
ctx: &Context,
|
||||
) -> Result<Arc<Dentry>> {
|
||||
) -> Result<Dentry> {
|
||||
let fs_resolver = ctx.process.fs().read();
|
||||
let dentry = if flags.contains(OpenFlags::AT_EMPTY_PATH) && filename.is_empty() {
|
||||
fs_resolver.lookup_from_fd(dfd)
|
||||
@ -79,7 +79,7 @@ fn lookup_executable_file(
|
||||
}
|
||||
|
||||
fn do_execve(
|
||||
elf_file: Arc<Dentry>,
|
||||
elf_file: Dentry,
|
||||
argv_ptr_ptr: Vaddr,
|
||||
envp_ptr_ptr: Vaddr,
|
||||
ctx: &Context,
|
||||
@ -193,7 +193,7 @@ fn read_cstring_vec(
|
||||
fn set_uid_from_elf(
|
||||
current: &Process,
|
||||
credentials: &Credentials<WriteOp>,
|
||||
elf_file: &Arc<Dentry>,
|
||||
elf_file: &Dentry,
|
||||
) -> Result<()> {
|
||||
if elf_file.mode()?.has_set_uid() {
|
||||
let uid = elf_file.owner()?;
|
||||
@ -211,7 +211,7 @@ fn set_uid_from_elf(
|
||||
fn set_gid_from_elf(
|
||||
current: &Process,
|
||||
credentials: &Credentials<WriteOp>,
|
||||
elf_file: &Arc<Dentry>,
|
||||
elf_file: &Dentry,
|
||||
) -> Result<()> {
|
||||
if elf_file.mode()?.has_set_gid() {
|
||||
let gid = elf_file.group()?;
|
||||
|
@ -83,7 +83,7 @@ fn do_remount() -> Result<()> {
|
||||
/// Such as use user command `mount --rbind src dst`.
|
||||
fn do_bind_mount(
|
||||
src_name: CString,
|
||||
dst_dentry: Arc<Dentry>,
|
||||
dst_dentry: Dentry,
|
||||
recursive: bool,
|
||||
ctx: &Context,
|
||||
) -> Result<()> {
|
||||
@ -109,7 +109,7 @@ fn do_change_type() -> Result<()> {
|
||||
}
|
||||
|
||||
/// Move a mount from src location to dst location.
|
||||
fn do_move_mount_old(src_name: CString, dst_dentry: Arc<Dentry>, ctx: &Context) -> Result<()> {
|
||||
fn do_move_mount_old(src_name: CString, dst_dentry: Dentry, ctx: &Context) -> Result<()> {
|
||||
let src_dentry = {
|
||||
let src_name = src_name.to_string_lossy();
|
||||
if src_name.is_empty() {
|
||||
@ -135,7 +135,7 @@ fn do_move_mount_old(src_name: CString, dst_dentry: Arc<Dentry>, ctx: &Context)
|
||||
fn do_new_mount(
|
||||
devname: CString,
|
||||
fs_type: Vaddr,
|
||||
target_dentry: Arc<Dentry>,
|
||||
target_dentry: Dentry,
|
||||
ctx: &Context,
|
||||
) -> Result<()> {
|
||||
if target_dentry.type_() != InodeType::Dir {
|
||||
|
@ -109,7 +109,7 @@ struct Utimbuf {
|
||||
modtime: i64,
|
||||
}
|
||||
|
||||
fn vfs_utimes(dentry: &Arc<Dentry>, times: Option<TimeSpecPair>) -> Result<SyscallReturn> {
|
||||
fn vfs_utimes(dentry: &Dentry, times: Option<TimeSpecPair>) -> Result<SyscallReturn> {
|
||||
let (atime, mtime, ctime) = match times {
|
||||
Some(times) => {
|
||||
if !times.atime.is_valid() || !times.mtime.is_valid() {
|
||||
|
Reference in New Issue
Block a user