mirror of
https://github.com/sgmarz/osblog.git
synced 2024-11-23 18:06:20 +04:00
use &str instead of String for paths.
This commit is contained in:
parent
c435371969
commit
8a0c87a103
@ -192,7 +192,7 @@ impl MinixFileSystem {
|
||||
/// The goal of open is to traverse the path given by path. If we cache the inodes
|
||||
/// in RAM, it might make this much quicker. For now, this doesn't do anything since
|
||||
/// we're just testing read based on if we know the Inode we're looking for.
|
||||
pub fn open(bdev: usize, path: &String) -> Result<Inode, FsError> {
|
||||
pub fn open(bdev: usize, path: &str) -> Result<Inode, FsError> {
|
||||
if let Some(cache) = unsafe { MFS_INODE_CACHE[bdev-1].take() } {
|
||||
let ret;
|
||||
if let Some(inode) = cache.get(path) {
|
||||
|
@ -5,7 +5,6 @@ use crate::{elf,
|
||||
fs::MinixFileSystem,
|
||||
process::{PROCESS_LIST,
|
||||
PROCESS_LIST_MUTEX}};
|
||||
use alloc::string::String;
|
||||
|
||||
/// Test block will load raw binaries into memory to execute them. This function
|
||||
/// will load ELF files and try to execute them.
|
||||
@ -15,7 +14,7 @@ pub fn test() {
|
||||
// This could be better. We should see what our probe gave us, and it if is
|
||||
// a block device, init the filesystem.
|
||||
MinixFileSystem::init(BDEV);
|
||||
let file_to_read = String::from("/helloworld.elf");
|
||||
let file_to_read = "/helloworld.elf";
|
||||
let desc = MinixFileSystem::open(BDEV, &file_to_read).ok();
|
||||
if desc.is_none() {
|
||||
println!("Error reading {}", file_to_read);
|
||||
|
Loading…
Reference in New Issue
Block a user