1use anyhow::bail;
10use anyhow::Result;
11use argh::FromArgValue;
12use devices::virtio::VirtioDevice;
13use devices::VirtioDeviceArgs;
14use devices::VirtioDeviceModule;
15#[cfg(any(target_os = "android", target_os = "linux"))]
16use jail::JailConfig;
17#[cfg(any(target_os = "android", target_os = "linux"))]
18use minijail::Minijail;
19use serde::Deserialize;
20use serde::Serialize;
21
22#[derive(Serialize, Deserialize)]
23#[serde(rename_all = "kebab-case")]
24pub enum VendorDeviceModule {
26 Unsupported,
27}
28
29impl VirtioDeviceModule for VendorDeviceModule {
30 fn sort_name(&self) -> &'static str {
31 "vendor_device"
32 }
33
34 fn create(&self, _cx: &mut VirtioDeviceArgs<'_>) -> Result<Box<dyn VirtioDevice>> {
41 bail!("no vendor devices are supported in this build")
42 }
43
44 #[cfg(any(target_os = "android", target_os = "linux"))]
45 fn create_jail(&self, _jail_config: Option<&JailConfig>) -> Result<Option<Minijail>> {
46 bail!("no vendor devices are supported in this build")
47 }
48}
49
50impl FromArgValue for VendorDeviceModule {
58 fn from_arg_value(_value: &str) -> std::result::Result<Self, String> {
59 Err("no vendor devices are supported in this build".to_string())
60 }
61}