From 07c9bdf35288bc6f9c5d0a0e45aab9150dafe915 Mon Sep 17 00:00:00 2001 From: Keiichi Watanabe Date: Tue, 4 Oct 2022 22:14:59 +0900 Subject: [PATCH] vmm_vhost: sys: Align platform-specific code with style guide Update /third_party/vmm_vhost/stc/sys.rs to align it with the code organization described in https://crosvm.dev/book/contributing/style_guide_platform_specific_code.html#code-organization BUG=none TEST=cargo check in /devices TEST=cargo check --target=x86_64-pc-windows-gnu in /devices Change-Id: I4f4035aadcd800335ceb035ab9645c2e6c6b0732 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3932449 Commit-Queue: Keiichi Watanabe Reviewed-by: Vikram Auradkar --- third_party/vmm_vhost/src/connection/socket.rs | 2 +- third_party/vmm_vhost/src/sys.rs | 14 ++++++++++---- third_party/vmm_vhost/src/sys/windows.rs | 3 --- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/third_party/vmm_vhost/src/connection/socket.rs b/third_party/vmm_vhost/src/connection/socket.rs index 64d345ab40..59ceddca95 100644 --- a/third_party/vmm_vhost/src/connection/socket.rs +++ b/third_party/vmm_vhost/src/connection/socket.rs @@ -23,9 +23,9 @@ use crate::connection::Listener as ListenerTrait; use crate::connection::Req; use crate::message::*; use crate::take_single_file; +use crate::unix::SystemListener; use crate::Error; use crate::Result; -use crate::SystemListener; use crate::SystemStream; /// Unix domain socket listener for accepting incoming connections. diff --git a/third_party/vmm_vhost/src/sys.rs b/third_party/vmm_vhost/src/sys.rs index c37943a539..999acec4c9 100644 --- a/third_party/vmm_vhost/src/sys.rs +++ b/third_party/vmm_vhost/src/sys.rs @@ -5,12 +5,18 @@ cfg_if::cfg_if! { if #[cfg(unix)] { - mod unix; - pub use unix::*; + pub mod unix; + use unix as platform; } else if #[cfg(windows)] { - mod windows; - pub use windows::*; + pub mod windows; + use windows as platform; } else { compile_error!("Unsupported platform"); } } + +#[cfg(feature = "device")] +pub(crate) use platform::MasterReqEndpoint; +#[cfg(feature = "device")] +pub(crate) use platform::SlaveReqEndpoint; +pub use platform::SystemStream; diff --git a/third_party/vmm_vhost/src/sys/windows.rs b/third_party/vmm_vhost/src/sys/windows.rs index dd038eb879..f3acc6f5f2 100644 --- a/third_party/vmm_vhost/src/sys/windows.rs +++ b/third_party/vmm_vhost/src/sys/windows.rs @@ -17,6 +17,3 @@ cfg_if::cfg_if! { pub(crate) type MasterReqEndpoint = TubeEndpoint; } } - -/// Collection of platform-specific methods that SystemListener provides. -pub(crate) trait SystemListenerExt {}