hermit/drivers/virtio/
mod.rs1pub mod transport;
5pub mod virtqueue;
6
7pub mod error {
8 use thiserror::Error;
9
10 #[cfg(feature = "console")]
11 pub use crate::drivers::console::error::VirtioConsoleError;
12 #[cfg(feature = "fuse")]
13 pub use crate::drivers::fs::virtio_fs::error::VirtioFsError;
14 #[cfg(all(
15 not(all(target_arch = "riscv64", feature = "gem-net", not(feature = "pci"))),
16 not(feature = "rtl8139"),
17 feature = "virtio-net",
18 ))]
19 pub use crate::drivers::net::virtio::error::VirtioNetError;
20 #[cfg(feature = "pci")]
21 use crate::drivers::pci::error::PciError;
22 #[cfg(feature = "vsock")]
23 pub use crate::drivers::vsock::error::VirtioVsockError;
24
25 #[allow(dead_code)]
26 #[derive(Error, Debug)]
27 pub enum VirtioError {
28 #[cfg(feature = "pci")]
29 #[error(transparent)]
30 FromPci(PciError),
31
32 #[cfg(feature = "pci")]
33 #[error(
34 "Virtio driver failed, for device {0:x}, due to a missing or malformed common config!"
35 )]
36 NoComCfg(u16),
37
38 #[cfg(feature = "pci")]
39 #[error(
40 "Virtio driver failed, for device {0:x}, due to a missing or malformed ISR status config!"
41 )]
42 NoIsrCfg(u16),
43
44 #[cfg(feature = "pci")]
45 #[error(
46 "Virtio driver failed, for device {0:x}, due to a missing or malformed notification config!"
47 )]
48 NoNotifCfg(u16),
49
50 #[error("Device with id {0:#x} not supported.")]
51 DevNotSupported(u16),
52
53 #[cfg(all(
54 not(all(target_arch = "riscv64", feature = "gem-net", not(feature = "pci"))),
55 not(feature = "rtl8139"),
56 feature = "virtio-net",
57 ))]
58 #[error(transparent)]
59 NetDriver(VirtioNetError),
60
61 #[cfg(feature = "fuse")]
62 #[error(transparent)]
63 FsDriver(VirtioFsError),
64
65 #[cfg(feature = "vsock")]
66 #[error(transparent)]
67 VsockDriver(VirtioVsockError),
68
69 #[cfg(feature = "console")]
70 #[error(transparent)]
71 ConsoleDriver(VirtioConsoleError),
72
73 #[cfg(not(feature = "pci"))]
74 #[error("Driver failure")]
75 Unknown,
76 }
77}