Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/axfs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ log = "=0.4.21"
cfg-if = "1.0"
lazyinit = "0.2"
cap_access = "0.1"
axio = { version = "0.1", features = ["alloc"] }
axio = { version = "0.1.1", features = ["alloc"] }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just update Cargo.lock, leave this file unchanged.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, the previous changes have been rolled back.

axerrno = "0.1"
axfs_vfs = "0.1"
axfs_devfs = { version = "0.1", optional = true }
Expand Down
11 changes: 10 additions & 1 deletion modules/axfs/src/api/file.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use axio::{Result, SeekFrom, prelude::*};
use alloc::vec::Vec;
use axio::{Result, SeekFrom, default_read_to_end, prelude::*};
use core::fmt;

use crate::fops;
Expand Down Expand Up @@ -174,6 +175,14 @@ impl Read for File {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
self.inner.read(buf)
}

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
default_read_to_end(
self,
buf,
self.metadata().ok().map(|metadata| metadata.size() as _),
)
}
}

impl Write for File {
Expand Down
Loading