Refactor Dentry to optimize the vfs layer

This commit is contained in:
Shaowei Song
2024-10-10 12:51:26 +00:00
committed by Tate, Hongliang Tian
parent 271e893889
commit ea489252f4
14 changed files with 177 additions and 175 deletions

View File

@ -34,7 +34,7 @@ use crate::{
pub fn load_elf_to_vm(
process_vm: &ProcessVm,
file_header: &[u8],
elf_file: Arc<Dentry>,
elf_file: Dentry,
fs_resolver: &FsResolver,
argv: Vec<CString>,
envp: Vec<CString>,
@ -85,7 +85,7 @@ fn lookup_and_parse_ldso(
elf: &Elf,
file_header: &[u8],
fs_resolver: &FsResolver,
) -> Result<Option<(Arc<Dentry>, Elf)>> {
) -> Result<Option<(Dentry, Elf)>> {
let ldso_file = {
let Some(ldso_path) = elf.ldso_path(file_header)? else {
return Ok(None);
@ -112,7 +112,7 @@ fn load_ldso(root_vmar: &Vmar<Full>, ldso_file: &Dentry, ldso_elf: &Elf) -> Resu
fn init_and_map_vmos(
process_vm: &ProcessVm,
ldso: Option<(Arc<Dentry>, Elf)>,
ldso: Option<(Dentry, Elf)>,
parsed_elf: &Elf,
elf_file: &Dentry,
) -> Result<(Vaddr, AuxVec)> {

View File

@ -25,7 +25,7 @@ use crate::{
/// because the interpreter is usually an elf binary(e.g., /bin/bash)
pub fn load_program_to_vm(
process_vm: &ProcessVm,
elf_file: Arc<Dentry>,
elf_file: Dentry,
argv: Vec<CString>,
envp: Vec<CString>,
fs_resolver: &FsResolver,
@ -68,7 +68,7 @@ pub fn load_program_to_vm(
Ok((abs_path, elf_load_info))
}
pub fn check_executable_file(dentry: &Arc<Dentry>) -> Result<()> {
pub fn check_executable_file(dentry: &Dentry) -> Result<()> {
if dentry.type_().is_directory() {
return_errno_with_message!(Errno::EISDIR, "the file is a directory");
}