Skip to content

Commit

Permalink
revise filesystem interface
Browse files Browse the repository at this point in the history
- remove old style
- using of slices instead of raw pointer
  • Loading branch information
stlankes committed Jan 2, 2024
1 parent c1fbd59 commit 876c75e
Show file tree
Hide file tree
Showing 15 changed files with 2,492 additions and 1,961 deletions.
13 changes: 7 additions & 6 deletions src/executor/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use crate::drivers::net::NetworkDriver;
use crate::drivers::pci::get_network_driver;
use crate::executor::device::HermitNet;
use crate::executor::{spawn, TaskNotify};
use crate::fd::IoError;
use crate::scheduler::PerCoreSchedulerExt;

pub(crate) enum NetworkState<'a> {
Expand Down Expand Up @@ -248,9 +249,9 @@ fn network_poll(timestamp: Instant) {
}

/// Blocks the current thread on `f`, running the executor when idling.
pub(crate) fn block_on<F, T>(future: F, timeout: Option<Duration>) -> Result<T, i32>
pub(crate) fn block_on<F, T>(future: F, timeout: Option<Duration>) -> Result<T, IoError>
where
F: Future<Output = Result<T, i32>>,
F: Future<Output = Result<T, IoError>>,
{
// disable network interrupts
let no_retransmission = {
Expand Down Expand Up @@ -297,7 +298,7 @@ where
// allow network interrupts
get_network_driver().unwrap().lock().set_polling_mode(false);

return Err(-crate::errno::ETIME);
return Err(IoError::ETIME);
}
}

Expand Down Expand Up @@ -327,9 +328,9 @@ where
}

/// Blocks the current thread on `f`, running the executor when idling.
pub(crate) fn poll_on<F, T>(future: F, timeout: Option<Duration>) -> Result<T, i32>
pub(crate) fn poll_on<F, T>(future: F, timeout: Option<Duration>) -> Result<T, IoError>
where
F: Future<Output = Result<T, i32>>,
F: Future<Output = Result<T, IoError>>,
{
// disable network interrupts
let no_retransmission = {
Expand Down Expand Up @@ -372,7 +373,7 @@ where
// allow network interrupts
get_network_driver().unwrap().lock().set_polling_mode(false);

return Err(-crate::errno::ETIME);
return Err(IoError::ETIME);
}
}
}
Expand Down
137 changes: 0 additions & 137 deletions src/fd/file.rs

This file was deleted.

Loading

0 comments on commit 876c75e

Please sign in to comment.