Skip to main content

BusSchemeServer

Struct BusSchemeServer 

Source
pub struct BusSchemeServer {
    drivers: Vec<(String, Box<dyn BusDriver>)>,
    port_handle: u64,
    handles: BTreeMap<u64, OpenHandle>,
    next_id: u64,
    pci_cache: Vec<PciDeviceInfo>,
}

Fields§

§drivers: Vec<(String, Box<dyn BusDriver>)>§port_handle: u64§handles: BTreeMap<u64, OpenHandle>§next_id: u64§pci_cache: Vec<PciDeviceInfo>

Implementations§

Source§

impl BusSchemeServer

Source

pub fn new(drivers: Vec<(String, Box<dyn BusDriver>)>, port_handle: u64) -> Self

Creates a new instance.

Source

pub fn refresh_pci_cache(&mut self) -> Result<usize, ()>

Performs the refresh pci cache operation.

Returns Ok(count) with the number of devices found, or Err(()) if the underlying pci_enum syscall failed (cache remains unchanged).

Source

fn ok_reply(sender: u64) -> IpcMessage

Source

fn err_reply(sender: u64, code: usize) -> IpcMessage

Source

fn alloc_id(&mut self) -> u64

Source

fn resolve_driver_path<'a>(&self, path: &'a str) -> Option<(usize, &'a str)>

Split a normalised path into a driver index + sub-path, or detect PCI / root.

Source

fn is_pci_path(path: &str) -> bool

Source

fn path_exists(&self, path: &str) -> bool

Source

fn parse_reg_offset(path: &str) -> Option<usize>

Source

fn handle_open(&mut self, sender: u64, payload: &[u8]) -> IpcMessage

Source

fn handle_read(&self, sender: u64, payload: &[u8]) -> IpcMessage

Source

fn generate_read_content(&self, kind: &HandleKind, offset: usize) -> Vec<u8>

Source

fn read_pci_content(&self, path: &str) -> Vec<u8>

Source

fn read_driver_content( &self, driver: &Box<dyn BusDriver>, name: &str, sub_path: &str, ) -> Vec<u8>

Source

fn handle_write(&mut self, sender: u64, payload: &[u8]) -> IpcMessage

Source

fn handle_close(&mut self, sender: u64, payload: &[u8]) -> IpcMessage

Source

fn handle_readdir(&self, sender: u64, payload: &[u8]) -> IpcMessage

Source

pub fn serve(&mut self) -> !

Performs the serve operation.

Source

fn normalize_path(path: &str) -> String

Source

fn parse_hex_u8(s: &str) -> Option<u8>

Source

fn parse_hex_u16(s: &str) -> Option<u16>

Source

fn parse_pci_bdf(s: &str) -> Option<PciAddress>

Source

fn parse_cfg_path(path: &str) -> Option<(PciAddress, u8, u8)>

Source

fn parse_find_path(path: &str) -> Option<(u16, u16)>

Source

fn render_inventory(&self) -> Vec<u8>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.