mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 20:48:55 +00:00
vm_control: Expose do_net_add without hotplug
This CL defines do_net_add/remove with the same function signature when pci-hotplug feature flag is disabled. This allows crosvm_control to be unaware of the pci-hotplug flag. TEST=presubmit tests. BUG=b:294777126 Change-Id: I4c6a3b96c01ecea9f9f01dcd1c7f65ca042a5664 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4851835 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Ningyuan Wang <ningyuan@google.com>
This commit is contained in:
parent
9c031a9840
commit
ce6ef2b36a
1 changed files with 18 additions and 1 deletions
|
@ -8,7 +8,6 @@ use std::path::PathBuf;
|
|||
|
||||
#[cfg(feature = "pci-hotplug")]
|
||||
use anyhow::anyhow;
|
||||
#[cfg(feature = "pci-hotplug")]
|
||||
use anyhow::Result as AnyHowResult;
|
||||
use base::open_file_or_duplicate;
|
||||
use remain::sorted;
|
||||
|
@ -73,6 +72,15 @@ pub fn do_net_add<T: AsRef<Path> + std::fmt::Debug>(
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "pci-hotplug"))]
|
||||
/// Send a `VmRequest` for PCI hotplug that expects `VmResponse::PciResponse::AddOk(bus)`
|
||||
pub fn do_net_add<T: AsRef<Path> + std::fmt::Debug>(
|
||||
_tap_name: &str,
|
||||
_socket_path: T,
|
||||
) -> AnyHowResult<u8> {
|
||||
bail!("Unsupported: pci-hotplug feature disabled");
|
||||
}
|
||||
|
||||
#[cfg(feature = "pci-hotplug")]
|
||||
/// Send a `VmRequest` for removing hotplugged PCI device that expects `VmResponse::Ok`
|
||||
pub fn do_net_remove<T: AsRef<Path> + std::fmt::Debug>(
|
||||
|
@ -87,6 +95,15 @@ pub fn do_net_remove<T: AsRef<Path> + std::fmt::Debug>(
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "pci-hotplug"))]
|
||||
/// Send a `VmRequest` for removing hotplugged PCI device that expects `VmResponse::Ok`
|
||||
pub fn do_net_remove<T: AsRef<Path> + std::fmt::Debug>(
|
||||
_bus_num: u8,
|
||||
_socket_path: T,
|
||||
) -> AnyHowResult<()> {
|
||||
bail!("Unsupported: pci-hotplug feature disabled");
|
||||
}
|
||||
|
||||
pub fn do_usb_attach<T: AsRef<Path> + std::fmt::Debug>(
|
||||
socket_path: T,
|
||||
dev_path: &Path,
|
||||
|
|
Loading…
Reference in a new issue