forked from M-Labs/artiq
firmware: remove io::Result<T, E> in favor of Result<T, impl Fail>.
This doesn't yet use impl Fail since std_artiq::io::Error doesn't impl it.
This commit is contained in:
parent
140ca729aa
commit
26faaad2b7
@ -11,8 +11,6 @@ extern crate alloc;
|
||||
#[cfg(feature = "byteorder")]
|
||||
extern crate byteorder;
|
||||
|
||||
use core::result;
|
||||
|
||||
mod cursor;
|
||||
#[cfg(feature = "byteorder")]
|
||||
mod proto;
|
||||
@ -21,8 +19,6 @@ pub use cursor::Cursor;
|
||||
#[cfg(feature = "byteorder")]
|
||||
pub use proto::{ProtoRead, ProtoWrite};
|
||||
|
||||
pub type Result<T, E> = result::Result<T, Error<E>>;
|
||||
|
||||
#[derive(Fail, Debug, Clone, PartialEq)]
|
||||
pub enum Error<T> {
|
||||
#[fail(display = "unexpected end of stream")]
|
||||
@ -44,10 +40,10 @@ pub trait Read {
|
||||
|
||||
/// Pull some bytes from this source into the specified buffer, returning
|
||||
/// how many bytes were read.
|
||||
fn read(&mut self, buf: &mut [u8]) -> result::Result<usize, Self::ReadError>;
|
||||
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::ReadError>;
|
||||
|
||||
/// Read the exact number of bytes required to fill `buf`.
|
||||
fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<(), Self::ReadError> {
|
||||
fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<(), Error<Self::ReadError>> {
|
||||
while !buf.is_empty() {
|
||||
let read_bytes = self.read(buf)?;
|
||||
if read_bytes == 0 {
|
||||
@ -64,7 +60,7 @@ pub trait Read {
|
||||
impl<'a, T: Read> Read for &'a mut T {
|
||||
type ReadError = T::ReadError;
|
||||
|
||||
fn read(&mut self, buf: &mut [u8]) -> result::Result<usize, Self::ReadError> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::ReadError> {
|
||||
T::read(self, buf)
|
||||
}
|
||||
}
|
||||
@ -74,14 +70,14 @@ pub trait Write {
|
||||
type FlushError;
|
||||
|
||||
/// Write a buffer into this object, returning how many bytes were written.
|
||||
fn write(&mut self, buf: &[u8]) -> result::Result<usize, Self::WriteError>;
|
||||
fn write(&mut self, buf: &[u8]) -> Result<usize, Self::WriteError>;
|
||||
|
||||
/// Flush this output stream, ensuring that all intermediately buffered contents
|
||||
/// reach their destination.
|
||||
fn flush(&mut self) -> result::Result<(), Self::FlushError>;
|
||||
fn flush(&mut self) -> Result<(), Self::FlushError>;
|
||||
|
||||
/// Attempts to write an entire buffer into `self`.
|
||||
fn write_all(&mut self, mut buf: &[u8]) -> Result<(), Self::WriteError> {
|
||||
fn write_all(&mut self, mut buf: &[u8]) -> Result<(), Error<Self::WriteError>> {
|
||||
while buf.len() > 0 {
|
||||
let written_bytes = self.write(buf)?;
|
||||
if written_bytes == 0 {
|
||||
@ -105,11 +101,11 @@ impl<'a, T: Write> Write for &'a mut T {
|
||||
type WriteError = T::WriteError;
|
||||
type FlushError = T::FlushError;
|
||||
|
||||
fn write(&mut self, buf: &[u8]) -> result::Result<usize, Self::WriteError> {
|
||||
fn write(&mut self, buf: &[u8]) -> Result<usize, Self::WriteError> {
|
||||
T::write(self, buf)
|
||||
}
|
||||
|
||||
fn flush(&mut self) -> result::Result<(), Self::FlushError> {
|
||||
fn flush(&mut self) -> Result<(), Self::FlushError> {
|
||||
T::flush(self)
|
||||
}
|
||||
|
||||
@ -122,14 +118,14 @@ impl<'a> Write for &'a mut [u8] {
|
||||
type WriteError = !;
|
||||
type FlushError = !;
|
||||
|
||||
fn write(&mut self, buf: &[u8]) -> result::Result<usize, Self::WriteError> {
|
||||
fn write(&mut self, buf: &[u8]) -> Result<usize, Self::WriteError> {
|
||||
let len = buf.len().min(self.len());
|
||||
self[..len].copy_from_slice(&buf[..len]);
|
||||
Ok(len)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn flush(&mut self) -> result::Result<(), Self::FlushError> {
|
||||
fn flush(&mut self) -> Result<(), Self::FlushError> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@ -139,13 +135,13 @@ impl<'a> Write for alloc::Vec<u8> {
|
||||
type WriteError = !;
|
||||
type FlushError = !;
|
||||
|
||||
fn write(&mut self, buf: &[u8]) -> result::Result<usize, Self::WriteError> {
|
||||
fn write(&mut self, buf: &[u8]) -> Result<usize, Self::WriteError> {
|
||||
self.extend_from_slice(buf);
|
||||
Ok(buf.len())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn flush(&mut self) -> result::Result<(), Self::FlushError> {
|
||||
fn flush(&mut self) -> Result<(), Self::FlushError> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
use io::{Write, ProtoWrite, Result};
|
||||
use io::{Write, ProtoWrite, Error};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Header {
|
||||
@ -10,7 +10,7 @@ pub struct Header {
|
||||
}
|
||||
|
||||
impl Header {
|
||||
pub fn write_to<T: Write>(&self, writer: &mut T) -> Result<(), T::WriteError> {
|
||||
pub fn write_to<T: Write>(&self, writer: &mut T) -> Result<(), Error<T::WriteError>> {
|
||||
writer.write_u32(self.sent_bytes)?;
|
||||
writer.write_u64(self.total_byte_count)?;
|
||||
writer.write_u8(self.overflow_occurred as u8)?;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use io::{Read, ProtoRead, Write, ProtoWrite, Error, Result};
|
||||
use io::{Read, ProtoRead, Write, ProtoWrite, Error};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Packet {
|
||||
@ -36,7 +36,7 @@ pub enum Packet {
|
||||
}
|
||||
|
||||
impl Packet {
|
||||
pub fn read_from<T: Read>(reader: &mut T) -> Result<Self, T::ReadError> {
|
||||
pub fn read_from<T: Read>(reader: &mut T) -> Result<Self, Error<T::ReadError>> {
|
||||
Ok(match reader.read_u8()? {
|
||||
0x00 => Packet::EchoRequest,
|
||||
0x01 => Packet::EchoReply,
|
||||
@ -133,7 +133,7 @@ impl Packet {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn write_to<T: Write>(&self, writer: &mut T) -> Result<(), T::WriteError> {
|
||||
pub fn write_to<T: Write>(&self, writer: &mut T) -> Result<(), Error<T::WriteError>> {
|
||||
match *self {
|
||||
Packet::EchoRequest =>
|
||||
writer.write_u8(0x00)?,
|
||||
|
@ -2,7 +2,7 @@ use alloc::Vec;
|
||||
#[cfg(feature = "log")]
|
||||
use log;
|
||||
|
||||
use io::{Read, ProtoRead, Write, ProtoWrite, Error, Result};
|
||||
use io::{Read, ProtoRead, Write, ProtoWrite, Error};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Request {
|
||||
@ -40,10 +40,10 @@ pub enum Reply<'a> {
|
||||
}
|
||||
|
||||
impl Request {
|
||||
pub fn read_from<T: Read + ?Sized>(reader: &mut T) -> Result<Self, T::ReadError> {
|
||||
pub fn read_from<T: Read + ?Sized>(reader: &mut T) -> Result<Self, Error<T::ReadError>> {
|
||||
#[cfg(feature = "log")]
|
||||
fn read_log_level_filter<T: Read + ?Sized>(reader: &mut T) ->
|
||||
Result<log::LevelFilter, T::ReadError> {
|
||||
Result<log::LevelFilter, Error<T::ReadError>> {
|
||||
Ok(match reader.read_u8()? {
|
||||
0 => log::LevelFilter::Off,
|
||||
1 => log::LevelFilter::Error,
|
||||
@ -79,7 +79,7 @@ impl Request {
|
||||
}
|
||||
|
||||
impl<'a> Reply<'a> {
|
||||
pub fn write_to<T: Write + ?Sized>(&self, writer: &mut T) -> Result<(), T::WriteError> {
|
||||
pub fn write_to<T: Write + ?Sized>(&self, writer: &mut T) -> Result<(), Error<T::WriteError>> {
|
||||
match *self {
|
||||
Reply::Success => {
|
||||
writer.write_u8(1)?;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use io::{Read, ProtoRead, Write, ProtoWrite, Error, Result};
|
||||
use io::{Read, ProtoRead, Write, ProtoWrite, Error};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum HostMessage {
|
||||
@ -14,7 +14,7 @@ pub enum DeviceMessage {
|
||||
}
|
||||
|
||||
impl HostMessage {
|
||||
pub fn read_from<T: Read + ?Sized>(reader: &mut T) -> Result<Self, T::ReadError> {
|
||||
pub fn read_from<T: Read + ?Sized>(reader: &mut T) -> Result<Self, Error<T::ReadError>> {
|
||||
Ok(match reader.read_u8()? {
|
||||
0 => HostMessage::Monitor {
|
||||
enable: if reader.read_u8()? == 0 { false } else { true },
|
||||
@ -36,7 +36,7 @@ impl HostMessage {
|
||||
}
|
||||
|
||||
impl DeviceMessage {
|
||||
pub fn write_to<T: Write + ?Sized>(&self, writer: &mut T) -> Result<(), T::WriteError> {
|
||||
pub fn write_to<T: Write + ?Sized>(&self, writer: &mut T) -> Result<(), Error<T::WriteError>> {
|
||||
match *self {
|
||||
DeviceMessage::MonitorStatus { channel, probe, value } => {
|
||||
writer.write_u8(0)?;
|
||||
|
@ -1,12 +1,12 @@
|
||||
use core::str;
|
||||
use cslice::{CSlice, CMutSlice};
|
||||
|
||||
use io::{ProtoRead, Read, Write, ProtoWrite, Result};
|
||||
use io::{ProtoRead, Read, Write, ProtoWrite, Error};
|
||||
use self::tag::{Tag, TagIterator, split_tag};
|
||||
|
||||
unsafe fn recv_value<T>(reader: &mut T, tag: Tag, data: &mut *mut (),
|
||||
alloc: &Fn(usize) -> Result<*mut (), T::ReadError>)
|
||||
-> Result<(), T::ReadError>
|
||||
alloc: &Fn(usize) -> Result<*mut (), Error<T::ReadError>>)
|
||||
-> Result<(), Error<T::ReadError>>
|
||||
where T: Read + ?Sized
|
||||
{
|
||||
macro_rules! consume_value {
|
||||
@ -75,8 +75,8 @@ unsafe fn recv_value<T>(reader: &mut T, tag: Tag, data: &mut *mut (),
|
||||
}
|
||||
|
||||
pub fn recv_return<T>(reader: &mut T, tag_bytes: &[u8], data: *mut (),
|
||||
alloc: &Fn(usize) -> Result<*mut (), T::ReadError>)
|
||||
-> Result<(), T::ReadError>
|
||||
alloc: &Fn(usize) -> Result<*mut (), Error<T::ReadError>>)
|
||||
-> Result<(), Error<T::ReadError>>
|
||||
where T: Read + ?Sized
|
||||
{
|
||||
let mut it = TagIterator::new(tag_bytes);
|
||||
@ -91,7 +91,7 @@ pub fn recv_return<T>(reader: &mut T, tag_bytes: &[u8], data: *mut (),
|
||||
}
|
||||
|
||||
unsafe fn send_value<T>(writer: &mut T, tag: Tag, data: &mut *const ())
|
||||
-> Result<(), T::WriteError>
|
||||
-> Result<(), Error<T::WriteError>>
|
||||
where T: Write + ?Sized
|
||||
{
|
||||
macro_rules! consume_value {
|
||||
@ -168,7 +168,7 @@ unsafe fn send_value<T>(writer: &mut T, tag: Tag, data: &mut *const ())
|
||||
}
|
||||
|
||||
pub fn send_args<T>(writer: &mut T, service: u32, tag_bytes: &[u8], data: *const *const ())
|
||||
-> Result<(), T::WriteError>
|
||||
-> Result<(), Error<T::WriteError>>
|
||||
where T: Write + ?Sized
|
||||
{
|
||||
let (arg_tags_bytes, return_tag_bytes) = split_tag(tag_bytes);
|
||||
|
@ -1,8 +1,8 @@
|
||||
use alloc::{Vec, String};
|
||||
|
||||
use io::{Read, ProtoRead, Write, ProtoWrite, Error, Result};
|
||||
use io::{Read, ProtoRead, Write, ProtoWrite, Error};
|
||||
|
||||
fn read_sync<T: Read + ?Sized>(reader: &mut T) -> Result<(), T::ReadError> {
|
||||
fn read_sync<T: Read + ?Sized>(reader: &mut T) -> Result<(), Error<T::ReadError>> {
|
||||
let mut sync = [0; 4];
|
||||
for i in 0.. {
|
||||
sync[i % 4] = reader.read_u8()?;
|
||||
@ -11,7 +11,7 @@ fn read_sync<T: Read + ?Sized>(reader: &mut T) -> Result<(), T::ReadError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn write_sync<T: Write + ?Sized>(writer: &mut T) -> Result<(), T::WriteError> {
|
||||
fn write_sync<T: Write + ?Sized>(writer: &mut T) -> Result<(), Error<T::WriteError>> {
|
||||
writer.write_all(&[0x5a; 4])
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ pub enum Request {
|
||||
}
|
||||
|
||||
impl Request {
|
||||
pub fn read_from<T: Read + ?Sized>(reader: &mut T) -> Result<Self, T::ReadError> {
|
||||
pub fn read_from<T: Read + ?Sized>(reader: &mut T) -> Result<Self, Error<T::ReadError>> {
|
||||
read_sync(reader)?;
|
||||
Ok(match reader.read_u8()? {
|
||||
3 => Request::SystemInfo,
|
||||
@ -114,7 +114,7 @@ pub enum Reply<'a> {
|
||||
}
|
||||
|
||||
impl<'a> Reply<'a> {
|
||||
pub fn write_to<T: Write + ?Sized>(&self, writer: &mut T) -> Result<(), T::WriteError> {
|
||||
pub fn write_to<T: Write + ?Sized>(&self, writer: &mut T) -> Result<(), Error<T::WriteError>> {
|
||||
write_sync(writer)?;
|
||||
match *self {
|
||||
Reply::SystemInfo { ident, finished_cleanly } => {
|
||||
|
@ -35,7 +35,7 @@ fn disarm() {
|
||||
}
|
||||
}
|
||||
|
||||
fn worker(stream: &mut TcpStream) -> io::Result<(), ::std::io::Error> {
|
||||
fn worker(stream: &mut TcpStream) -> Result<(), io::Error<::std::io::Error>> {
|
||||
let data = unsafe { &BUFFER.data[..] };
|
||||
let overflow_occurred = unsafe { csr::rtio_analyzer::message_encoder_overflow_read() != 0 };
|
||||
let total_byte_count = unsafe { csr::rtio_analyzer::dma_byte_count_read() };
|
||||
|
@ -291,7 +291,7 @@ mod spi {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn process_kern_hwreq(io: &Io, request: &kern::Message) -> io::Result<bool, ::std::io::Error> {
|
||||
pub fn process_kern_hwreq(io: &Io, request: &kern::Message) -> Result<bool, io::Error<::std::io::Error>> {
|
||||
match request {
|
||||
#[cfg(has_rtio_core)]
|
||||
&kern::RtioInitRequest => {
|
||||
|
@ -8,7 +8,7 @@ use sched::{TcpListener, TcpStream};
|
||||
use mgmt_proto::*;
|
||||
use profiler;
|
||||
|
||||
fn check_magic(stream: &mut TcpStream) -> io::Result<(), ::std::io::Error> {
|
||||
fn check_magic(stream: &mut TcpStream) -> Result<(), io::Error<::std::io::Error>> {
|
||||
const MAGIC: &'static [u8] = b"ARTIQ management\n";
|
||||
|
||||
let mut magic: [u8; 17] = [0; 17];
|
||||
@ -20,7 +20,7 @@ fn check_magic(stream: &mut TcpStream) -> io::Result<(), ::std::io::Error> {
|
||||
}
|
||||
}
|
||||
|
||||
fn worker(io: &Io, stream: &mut TcpStream) -> io::Result<(), ::std::io::Error> {
|
||||
fn worker(io: &Io, stream: &mut TcpStream) -> Result<(), io::Error<::std::io::Error>> {
|
||||
check_magic(stream)?;
|
||||
info!("new connection from {}", stream.remote_endpoint());
|
||||
|
||||
@ -34,7 +34,7 @@ fn worker(io: &Io, stream: &mut TcpStream) -> io::Result<(), ::std::io::Error> {
|
||||
}
|
||||
|
||||
Request::ClearLog => {
|
||||
BufferLogger::with(|logger| -> io::Result<(), ::std::io::Error> {
|
||||
BufferLogger::with(|logger| -> Result<(), io::Error<::std::io::Error>> {
|
||||
let mut buffer = io.until_ok(|| logger.buffer())?;
|
||||
Ok(buffer.clear())
|
||||
})?;
|
||||
@ -43,7 +43,7 @@ fn worker(io: &Io, stream: &mut TcpStream) -> io::Result<(), ::std::io::Error> {
|
||||
}
|
||||
|
||||
Request::PullLog => {
|
||||
BufferLogger::with(|logger| -> io::Result<(), ::std::io::Error> {
|
||||
BufferLogger::with(|logger| -> Result<(), io::Error<::std::io::Error>> {
|
||||
loop {
|
||||
// Do this *before* acquiring the buffer, since that sets the log level
|
||||
// to OFF.
|
||||
|
@ -9,7 +9,7 @@ use drtioaux;
|
||||
|
||||
use moninj_proto::*;
|
||||
|
||||
fn check_magic(stream: &mut TcpStream) -> io::Result<(), ::std::io::Error> {
|
||||
fn check_magic(stream: &mut TcpStream) -> Result<(), io::Error<::std::io::Error>> {
|
||||
const MAGIC: &'static [u8] = b"ARTIQ moninj\n";
|
||||
|
||||
let mut magic: [u8; 13] = [0; 13];
|
||||
@ -159,7 +159,7 @@ fn read_injection_status(channel: u32, probe: u8) -> u8 {
|
||||
0
|
||||
}
|
||||
|
||||
fn connection_worker(io: &Io, mut stream: &mut TcpStream) -> io::Result<(), ::std::io::Error> {
|
||||
fn connection_worker(io: &Io, mut stream: &mut TcpStream) -> Result<(), io::Error<::std::io::Error>> {
|
||||
let mut watch_list = BTreeMap::new();
|
||||
let mut next_check = 0;
|
||||
|
||||
|
@ -102,7 +102,7 @@ impl<'a> Drop for Session<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn check_magic(stream: &mut TcpStream) -> io::Result<(), ::std::io::Error> {
|
||||
fn check_magic(stream: &mut TcpStream) -> Result<(), io::Error<::std::io::Error>> {
|
||||
const MAGIC: &'static [u8] = b"ARTIQ coredev\n";
|
||||
|
||||
let mut magic: [u8; 14] = [0; 14];
|
||||
@ -114,7 +114,7 @@ fn check_magic(stream: &mut TcpStream) -> io::Result<(), ::std::io::Error> {
|
||||
}
|
||||
}
|
||||
|
||||
fn host_read(stream: &mut TcpStream) -> io::Result<host::Request, ::std::io::Error> {
|
||||
fn host_read(stream: &mut TcpStream) -> Result<host::Request, io::Error<::std::io::Error>> {
|
||||
let request = host::Request::read_from(stream)?;
|
||||
match &request {
|
||||
&host::Request::LoadKernel(_) => debug!("comm<-host LoadLibrary(...)"),
|
||||
@ -123,12 +123,12 @@ fn host_read(stream: &mut TcpStream) -> io::Result<host::Request, ::std::io::Err
|
||||
Ok(request)
|
||||
}
|
||||
|
||||
fn host_write(stream: &mut TcpStream, reply: host::Reply) -> io::Result<(), ::std::io::Error> {
|
||||
fn host_write(stream: &mut TcpStream, reply: host::Reply) -> Result<(), io::Error<::std::io::Error>> {
|
||||
debug!("comm->host {:?}", reply);
|
||||
reply.write_to(stream)
|
||||
}
|
||||
|
||||
pub fn kern_send(io: &Io, request: &kern::Message) -> io::Result<(), ::std::io::Error> {
|
||||
pub fn kern_send(io: &Io, request: &kern::Message) -> Result<(), io::Error<::std::io::Error>> {
|
||||
match request {
|
||||
&kern::LoadRequest(_) => debug!("comm->kern LoadRequest(...)"),
|
||||
&kern::DmaRetrieveReply { trace, duration } => {
|
||||
@ -144,8 +144,8 @@ pub fn kern_send(io: &Io, request: &kern::Message) -> io::Result<(), ::std::io::
|
||||
Ok(io.until(mailbox::acknowledged)?)
|
||||
}
|
||||
|
||||
fn kern_recv_notrace<R, F>(io: &Io, f: F) -> io::Result<R, ::std::io::Error>
|
||||
where F: FnOnce(&kern::Message) -> io::Result<R, ::std::io::Error> {
|
||||
fn kern_recv_notrace<R, F>(io: &Io, f: F) -> Result<R, io::Error<::std::io::Error>>
|
||||
where F: FnOnce(&kern::Message) -> Result<R, io::Error<::std::io::Error>> {
|
||||
io.until(|| mailbox::receive() != 0)?;
|
||||
if !kernel::validate(mailbox::receive()) {
|
||||
let message = format!("invalid kernel CPU pointer 0x{:x}", mailbox::receive());
|
||||
@ -171,20 +171,20 @@ fn kern_recv_dotrace(reply: &kern::Message) {
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn kern_recv<R, F>(io: &Io, f: F) -> io::Result<R, ::std::io::Error>
|
||||
where F: FnOnce(&kern::Message) -> io::Result<R, ::std::io::Error> {
|
||||
fn kern_recv<R, F>(io: &Io, f: F) -> Result<R, io::Error<::std::io::Error>>
|
||||
where F: FnOnce(&kern::Message) -> Result<R, io::Error<::std::io::Error>> {
|
||||
kern_recv_notrace(io, |reply| {
|
||||
kern_recv_dotrace(reply);
|
||||
f(reply)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn kern_acknowledge() -> io::Result<(), ::std::io::Error> {
|
||||
pub fn kern_acknowledge() -> Result<(), io::Error<::std::io::Error>> {
|
||||
mailbox::acknowledge();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
unsafe fn kern_load(io: &Io, session: &mut Session, library: &[u8]) -> io::Result<(), ::std::io::Error> {
|
||||
unsafe fn kern_load(io: &Io, session: &mut Session, library: &[u8]) -> Result<(), io::Error<::std::io::Error>> {
|
||||
if session.running() {
|
||||
unexpected!("attempted to load a new kernel while a kernel was running")
|
||||
}
|
||||
@ -209,7 +209,7 @@ unsafe fn kern_load(io: &Io, session: &mut Session, library: &[u8]) -> io::Resul
|
||||
})
|
||||
}
|
||||
|
||||
fn kern_run(session: &mut Session) -> io::Result<(), ::std::io::Error> {
|
||||
fn kern_run(session: &mut Session) -> Result<(), io::Error<::std::io::Error>> {
|
||||
if session.kernel_state != KernelState::Loaded {
|
||||
unexpected!("attempted to run a kernel while not in Loaded state")
|
||||
}
|
||||
@ -221,7 +221,7 @@ fn kern_run(session: &mut Session) -> io::Result<(), ::std::io::Error> {
|
||||
|
||||
fn process_host_message(io: &Io,
|
||||
stream: &mut TcpStream,
|
||||
session: &mut Session) -> io::Result<(), ::std::io::Error> {
|
||||
session: &mut Session) -> Result<(), io::Error<::std::io::Error>> {
|
||||
match host_read(stream)? {
|
||||
host::Request::SystemInfo => {
|
||||
host_write(stream, host::Reply::SystemInfo {
|
||||
@ -359,7 +359,7 @@ fn process_host_message(io: &Io,
|
||||
}
|
||||
|
||||
fn process_kern_message(io: &Io, mut stream: Option<&mut TcpStream>,
|
||||
session: &mut Session) -> io::Result<bool, ::std::io::Error> {
|
||||
session: &mut Session) -> Result<bool, io::Error<::std::io::Error>> {
|
||||
kern_recv_notrace(io, |request| {
|
||||
match (request, session.kernel_state) {
|
||||
(&kern::LoadReply(_), KernelState::Loaded) |
|
||||
@ -516,7 +516,7 @@ fn process_kern_message(io: &Io, mut stream: Option<&mut TcpStream>,
|
||||
}
|
||||
|
||||
fn process_kern_queued_rpc(stream: &mut TcpStream,
|
||||
_session: &mut Session) -> io::Result<(), ::std::io::Error> {
|
||||
_session: &mut Session) -> Result<(), io::Error<::std::io::Error>> {
|
||||
rpc_queue::dequeue(|slice| {
|
||||
debug!("comm<-kern (async RPC)");
|
||||
let length = NetworkEndian::read_u32(slice) as usize;
|
||||
@ -529,7 +529,7 @@ fn process_kern_queued_rpc(stream: &mut TcpStream,
|
||||
|
||||
fn host_kernel_worker(io: &Io,
|
||||
stream: &mut TcpStream,
|
||||
congress: &mut Congress) -> io::Result<(), ::std::io::Error> {
|
||||
congress: &mut Congress) -> Result<(), io::Error<::std::io::Error>> {
|
||||
let mut session = Session::new(congress);
|
||||
|
||||
loop {
|
||||
@ -568,7 +568,7 @@ fn host_kernel_worker(io: &Io,
|
||||
|
||||
fn flash_kernel_worker(io: &Io,
|
||||
congress: &mut Congress,
|
||||
config_key: &str) -> io::Result<(), ::std::io::Error> {
|
||||
config_key: &str) -> Result<(), io::Error<::std::io::Error>> {
|
||||
let mut session = Session::new(congress);
|
||||
|
||||
config::read(config_key, |result| {
|
||||
|
Loading…
Reference in New Issue
Block a user