Skip to content
Snippets Groups Projects
Commit b8702113 authored by Stefan Lankes's avatar Stefan Lankes
Browse files

minor changes to build libhermit without PCI support

parent 0505c1c6
No related branches found
No related tags found
No related merge requests found
......@@ -16,17 +16,22 @@
//#[cfg(not(feature = "newlib"))]
pub mod net;
#[cfg(feature = "pci")]
pub mod virtio;
#[cfg(feature = "pci")]
use crate::drivers::error::DriverError;
#[cfg(feature = "pci")]
pub type Result<T> = core::result::Result<T, DriverError>;
/// A common error module for drivers.
/// [DriverError](enums.drivererror.html) values will be
/// passed on to higher layers.
#[cfg(feature = "pci")]
pub mod error {
use crate::drivers::virtio::error::VirtioError;
use core::fmt;
#[derive(Debug)]
pub enum DriverError {
InitVirtioDevFail(VirtioError),
......
......@@ -5,6 +5,8 @@
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.
#[cfg(feature = "pci")]
pub mod virtio_net;
use crate::arch::kernel::percore::*;
......
......@@ -166,6 +166,7 @@ pub trait SyscallInterface: Send + Sync {
}
fn receive_rx_buffer(&self) -> Result<(&'static [u8], usize), ()> {
#[cfg(feature = "pci")]
match arch::kernel::pci::get_network_driver() {
Some(driver) => driver.lock().receive_rx_buffer(),
_ => Err(()),
......@@ -175,6 +176,7 @@ pub trait SyscallInterface: Send + Sync {
}
fn rx_buffer_consumed(&self, handle: usize) -> Result<(), ()> {
#[cfg(feature = "pci")]
match arch::kernel::pci::get_network_driver() {
Some(driver) => {
driver.lock().rx_buffer_consumed(handle);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment