Skip to content

Commit

Permalink
Small fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
travis1829 committed Jan 28, 2021
1 parent 027eea7 commit 220a53d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions kernel-rs/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl File {
}

match &self.typ {
FileType::Pipe { pipe } => unsafe { pipe.read(addr, usize::try_from(n).unwrap_or(0)) },
FileType::Pipe { pipe } => pipe.read(addr, usize::try_from(n).unwrap_or(0)),
FileType::Inode { ip, off } => {
let mut ip = ip.deref().lock();
let curr_off = unsafe { *off.get() };
Expand All @@ -126,7 +126,7 @@ impl File {
}

match &self.typ {
FileType::Pipe { pipe } => unsafe { pipe.write(addr, usize::try_from(n).unwrap_or(0)) },
FileType::Pipe { pipe } => pipe.write(addr, usize::try_from(n).unwrap_or(0)),
FileType::Inode { ip, off } => {
// write a few blocks at a time to avoid exceeding
// the maximum log transaction size, including
Expand Down
4 changes: 2 additions & 2 deletions kernel-rs/src/pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl Pipe {
pub fn read(&self, addr: UVAddr, n: usize) -> Result<usize, ()> {
let mut inner = self.inner.lock();
loop {
match unsafe { inner.try_read(addr, n) } {
match inner.try_read(addr, n) {
Ok(r) => {
//DOC: piperead-wakeup
self.write_waitchannel.wakeup();
Expand All @@ -71,7 +71,7 @@ impl Pipe {
let mut written = 0;
let mut inner = self.inner.lock();
loop {
match unsafe { inner.try_write(addr + written, n - written) } {
match inner.try_write(addr + written, n - written) {
Ok(r) => {
written += r;
self.read_waitchannel.wakeup();
Expand Down

0 comments on commit 220a53d

Please sign in to comment.