From ba06509a5cefe671cf3d2f79f97eaf28f23c50ad Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Thu, 13 Jun 2024 10:51:15 -0700 Subject: [PATCH] vm_control: fix more wildcard re-exports Import balloon_control items directly from that crate rather than via re-exports from vm_control. This fixes the fuzzer build, which depended on an implicitly imported type via one of the conditional wildcard imports. BUG=chromium:69590 TEST=(cd fuzz; cargo build) Change-Id: I97d5df66741cfb64f600bebd503b73d779888440 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5630345 Reviewed-by: Dennis Kempin Commit-Queue: Daniel Verkamp --- Cargo.lock | 1 + crosvm_control/Cargo.toml | 1 + crosvm_control/src/lib.rs | 6 +++--- vm_control/src/balloon_tube.rs | 10 +++------- vm_control/src/lib.rs | 15 ++++++++++----- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1953ccfb19..a01e3153f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -891,6 +891,7 @@ name = "crosvm_control" version = "0.1.0" dependencies = [ "anyhow", + "balloon_control", "base", "cbindgen", "cc", diff --git a/crosvm_control/Cargo.toml b/crosvm_control/Cargo.toml index 57c4ac8e19..c09ab8d6ea 100644 --- a/crosvm_control/Cargo.toml +++ b/crosvm_control/Cargo.toml @@ -12,6 +12,7 @@ registered_events = ["vm_control/registered_events"] crate-type = ["cdylib", "staticlib"] [dependencies] +balloon_control = { path = "../common/balloon_control" } base = { path = "../base" } libc = "0.2.65" swap = { path = "../swap", default-features = false } diff --git a/crosvm_control/src/lib.rs b/crosvm_control/src/lib.rs index 0bfefc8ea5..687c3c031e 100644 --- a/crosvm_control/src/lib.rs +++ b/crosvm_control/src/lib.rs @@ -27,6 +27,9 @@ use std::path::Path; use std::path::PathBuf; use std::time::Duration; +use balloon_control::BalloonStats; +use balloon_control::BalloonWS; +use balloon_control::WSBucket; use libc::c_char; use libc::ssize_t; pub use swap::SwapStatus; @@ -41,8 +44,6 @@ use vm_control::client::handle_request; use vm_control::client::handle_request_with_timeout; use vm_control::client::vms_request; use vm_control::BalloonControlCommand; -use vm_control::BalloonStats; -use vm_control::BalloonWS; use vm_control::DiskControlCommand; use vm_control::RegisteredEvent; use vm_control::SwapCommand; @@ -50,7 +51,6 @@ use vm_control::UsbControlAttachedDevice; use vm_control::UsbControlResult; use vm_control::VmRequest; use vm_control::VmResponse; -use vm_control::WSBucket; use vm_control::USB_CONTROL_MAX_PORTS; pub const VIRTIO_BALLOON_WS_MAX_NUM_BINS: usize = 16; diff --git a/vm_control/src/balloon_tube.rs b/vm_control/src/balloon_tube.rs index 9f7148a4fc..e78eb2c08a 100644 --- a/vm_control/src/balloon_tube.rs +++ b/vm_control/src/balloon_tube.rs @@ -9,13 +9,8 @@ use std::collections::VecDeque; use anyhow::bail; use anyhow::Context; use anyhow::Result; -pub use balloon_control::BalloonStats; use balloon_control::BalloonTubeCommand; -pub use balloon_control::BalloonTubeResult; -pub use balloon_control::BalloonWS; -pub use balloon_control::WSBucket; -pub use balloon_control::VIRTIO_BALLOON_WS_MAX_NUM_BINS; -pub use balloon_control::VIRTIO_BALLOON_WS_MIN_NUM_BINS; +use balloon_control::BalloonTubeResult; use base::error; use base::Error as SysError; use base::Tube; @@ -94,7 +89,6 @@ pub struct BalloonTube { pending_adjust_with_completion: Option<(u64, usize)>, } -#[cfg(feature = "balloon")] impl BalloonTube { pub fn new(tube: Tube) -> Self { BalloonTube { @@ -211,6 +205,8 @@ impl BalloonTube { #[cfg(test)] mod tests { + use balloon_control::BalloonStats; + use super::*; fn balloon_device_respond_stats(device: &Tube) { diff --git a/vm_control/src/lib.rs b/vm_control/src/lib.rs index b53f81c98f..0733bd77ab 100644 --- a/vm_control/src/lib.rs +++ b/vm_control/src/lib.rs @@ -110,7 +110,9 @@ pub use vm_control_product::ServiceSendToGpu; use vm_memory::GuestAddress; #[cfg(feature = "balloon")] -pub use crate::balloon_tube::*; +pub use crate::balloon_tube::BalloonControlCommand; +#[cfg(feature = "balloon")] +pub use crate::balloon_tube::BalloonTube; #[cfg(feature = "gdb")] pub use crate::gdb::VcpuDebug; #[cfg(feature = "gdb")] @@ -1366,7 +1368,7 @@ pub enum RegisteredEvent { #[derive(Serialize, Deserialize, Debug)] pub enum RegisteredEventWithData { VirtioBalloonWsReport { - ws_buckets: Vec, + ws_buckets: Vec, balloon_actual: u64, }, VirtioBalloonResize, @@ -1418,7 +1420,7 @@ impl RegisteredEventWithData { } } - pub fn from_ws(ws: &BalloonWS, balloon_actual: u64) -> Self { + pub fn from_ws(ws: &balloon_control::BalloonWS, balloon_actual: u64) -> Self { RegisteredEventWithData::VirtioBalloonWsReport { ws_buckets: ws.ws.clone(), balloon_actual, @@ -2233,12 +2235,15 @@ pub enum VmResponse { /// Results of balloon control commands. #[cfg(feature = "balloon")] BalloonStats { - stats: BalloonStats, + stats: balloon_control::BalloonStats, balloon_actual: u64, }, /// Results of balloon WS-R command #[cfg(feature = "balloon")] - BalloonWS { ws: BalloonWS, balloon_actual: u64 }, + BalloonWS { + ws: balloon_control::BalloonWS, + balloon_actual: u64, + }, /// Results of PCI hot plug #[cfg(feature = "pci-hotplug")] PciHotPlugResponse { bus: u8 },