mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-30 00:23:24 +00:00
Add struct Path for VFS
Signed-off-by: Zhenchen Wang <m202372036@hust.edu.cn>
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
bc1bf4cb53
commit
6d486c6c01
@ -12,7 +12,7 @@ use super::elf_file::Elf;
|
||||
use crate::{
|
||||
fs::{
|
||||
fs_resolver::{FsPath, FsResolver, AT_FDCWD},
|
||||
utils::Dentry,
|
||||
utils::{Dentry, Path},
|
||||
},
|
||||
prelude::*,
|
||||
process::{
|
||||
@ -35,7 +35,7 @@ use crate::{
|
||||
pub fn load_elf_to_vm(
|
||||
process_vm: &ProcessVm,
|
||||
file_header: &[u8],
|
||||
elf_file: Arc<Dentry>,
|
||||
elf_file: Arc<Path>,
|
||||
fs_resolver: &FsResolver,
|
||||
argv: Vec<CString>,
|
||||
envp: Vec<CString>,
|
||||
@ -101,11 +101,11 @@ fn lookup_and_parse_ldso(
|
||||
};
|
||||
let ldso_elf = {
|
||||
let mut buf = Box::new([0u8; PAGE_SIZE]);
|
||||
let inode = ldso_file.inode();
|
||||
let inode = ldso_file.dentry().inode();
|
||||
inode.read_at(0, &mut *buf)?;
|
||||
Elf::parse_elf(&*buf)?
|
||||
};
|
||||
Ok((ldso_file, ldso_elf))
|
||||
Ok((ldso_file.dentry().clone(), ldso_elf))
|
||||
}
|
||||
|
||||
fn load_ldso(root_vmar: &Vmar<Full>, ldso_file: &Dentry, ldso_elf: &Elf) -> Result<LdsoLoadInfo> {
|
||||
|
@ -11,7 +11,7 @@ use super::process_vm::ProcessVm;
|
||||
use crate::{
|
||||
fs::{
|
||||
fs_resolver::{FsPath, FsResolver, AT_FDCWD},
|
||||
utils::Dentry,
|
||||
utils::{Dentry, Path},
|
||||
},
|
||||
prelude::*,
|
||||
};
|
||||
@ -25,14 +25,14 @@ 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: Arc<Path>,
|
||||
argv: Vec<CString>,
|
||||
envp: Vec<CString>,
|
||||
fs_resolver: &FsResolver,
|
||||
recursion_limit: usize,
|
||||
) -> Result<(String, ElfLoadInfo)> {
|
||||
let abs_path = elf_file.abs_path();
|
||||
let inode = elf_file.inode();
|
||||
let inode = elf_file.dentry().inode();
|
||||
let file_header = {
|
||||
// read the first page of file header
|
||||
let mut file_header_buffer = Box::new([0u8; PAGE_SIZE]);
|
||||
@ -49,7 +49,7 @@ pub fn load_program_to_vm(
|
||||
let fs_path = FsPath::new(AT_FDCWD, &filename)?;
|
||||
fs_resolver.lookup(&fs_path)?
|
||||
};
|
||||
check_executable_file(&interpreter)?;
|
||||
check_executable_file(interpreter.dentry())?;
|
||||
return load_program_to_vm(
|
||||
process_vm,
|
||||
interpreter,
|
||||
|
Reference in New Issue
Block a user