diff --git a/Cargo.toml b/Cargo.toml index f7db6050fa..406060373c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -354,7 +354,10 @@ vtpm = ["devices/vtpm"] ## Enables reporting of crosvm crashes crash-report = ["broker_ipc/crash-report", "crash_report"] +gvm = [] +perfetto = [] process-invariants = [] +prod-build = [] sandbox = [] #! ### Platform Feature Sets diff --git a/base/src/sys/windows/mod.rs b/base/src/sys/windows/mod.rs index 51303ef0ba..464c733140 100644 --- a/base/src/sys/windows/mod.rs +++ b/base/src/sys/windows/mod.rs @@ -4,8 +4,6 @@ //! Small system utility modules for usage by other modules. -#![cfg(windows)] - #[macro_use] pub mod ioctl; #[macro_use] diff --git a/base/src/sys/windows/punch_hole.rs b/base/src/sys/windows/punch_hole.rs index 094d2c4693..67111f6120 100644 --- a/base/src/sys/windows/punch_hole.rs +++ b/base/src/sys/windows/punch_hole.rs @@ -20,13 +20,13 @@ struct FILE_ZERO_DATA_INFORMATION { } pub(crate) fn file_punch_hole(handle: &File, offset: u64, length: u64) -> io::Result<()> { - let large_offset = if offset > std::i64::MAX as u64 { + let large_offset = if offset > i64::MAX as u64 { return Err(std::io::Error::from_raw_os_error(libc::EINVAL)); } else { LargeInteger::new(offset as i64) }; - if (offset + length) > std::i64::MAX as u64 { + if (offset + length) > i64::MAX as u64 { return Err(std::io::Error::from_raw_os_error(libc::EINVAL)); } diff --git a/devices/Cargo.toml b/devices/Cargo.toml index 582a5ebfcf..cc5be002f4 100644 --- a/devices/Cargo.toml +++ b/devices/Cargo.toml @@ -32,7 +32,7 @@ minigbm = ["rutabaga_gfx/minigbm"] x = ["gpu_display/x", "rutabaga_gfx/x"] virgl_renderer = ["gpu", "rutabaga_gfx/virgl_renderer"] vtpm = ["system_api", "protobuf", "dbus"] -gfxstream = ["gpu", "rutabaga_gfx/gfxstream"] +gfxstream = ["gpu", "gpu_display/gfxstream", "rutabaga_gfx/gfxstream"] registered_events = [] slirp = ["net_util/slirp"] slirp-ring-capture = [] diff --git a/devices/src/serial/sys/windows.rs b/devices/src/serial/sys/windows.rs index 1ae78f0389..88b20532ad 100644 --- a/devices/src/serial/sys/windows.rs +++ b/devices/src/serial/sys/windows.rs @@ -273,8 +273,8 @@ mod tests { #[allow(clippy::undocumented_unsafe_blocks)] unsafe { // Check that serial output is sent to the pipe - device.write(serial_bus_address(DATA), &[b'T']); - device.write(serial_bus_address(DATA), &[b'D']); + device.write(serial_bus_address(DATA), b"T"); + device.write(serial_bus_address(DATA), b"D"); let mut read_buf: [u8; 2] = [0; 2]; diff --git a/e2e_tests/fixture/src/sys/windows.rs b/e2e_tests/fixture/src/sys/windows.rs index 61537a487b..03762eb319 100644 --- a/e2e_tests/fixture/src/sys/windows.rs +++ b/e2e_tests/fixture/src/sys/windows.rs @@ -226,7 +226,7 @@ impl TestVmSys { "--kernel-log-file", hypervisor_log_str, ]); - command.args(&get_hypervisor_args()); + command.args(get_hypervisor_args()); command.args(cfg.extra_args); println!("Running command: {:?}", command); diff --git a/gpu_display/Cargo.toml b/gpu_display/Cargo.toml index b9231a104b..0d89f4349f 100644 --- a/gpu_display/Cargo.toml +++ b/gpu_display/Cargo.toml @@ -14,6 +14,7 @@ android_display = [] # Stub implementation of the Android display backend. This is only used for building and testing the # Android display backend on a non-Android target android_display_stub = [] +gfxstream = [] [dependencies] anyhow = "1" diff --git a/gpu_display/src/gpu_display_win/math_util.rs b/gpu_display/src/gpu_display_win/math_util.rs index 93ce4016fd..9714dca778 100644 --- a/gpu_display/src/gpu_display_win/math_util.rs +++ b/gpu_display/src/gpu_display_win/math_util.rs @@ -25,12 +25,18 @@ pub trait SizeExtension { expected_aspect_ratio: f32, should_adjust_width: bool, ) -> Self; + #[allow(dead_code)] fn get_largest_inner_rect_size(original_size: &Self, expected_aspect_ratio: f32) -> Self; + #[allow(dead_code)] fn scale(&self, ratio: f32) -> Self; + #[allow(dead_code)] fn transpose(&self) -> Self; + #[allow(dead_code)] fn shorter_edge(&self) -> i32; fn aspect_ratio(&self) -> f32; + #[allow(dead_code)] fn is_square(&self) -> bool; + #[allow(dead_code)] fn is_landscape(&self) -> bool; } diff --git a/gpu_display/src/gpu_display_win/window.rs b/gpu_display/src/gpu_display_win/window.rs index 84509331de..5cbc6d78ea 100644 --- a/gpu_display/src/gpu_display_win/window.rs +++ b/gpu_display/src/gpu_display_win/window.rs @@ -279,6 +279,7 @@ pub(crate) trait BasicWindow { } /// Calls `RemovePropW()` internally. + #[allow(dead_code)] fn remove_property(&self, property: &str) -> Result<()> { // SAFETY: // Safe because the window object won't outlive the HWND, and failures are handled below. diff --git a/gpu_display/src/lib.rs b/gpu_display/src/lib.rs index 49656fbb53..929c0f3d9a 100644 --- a/gpu_display/src/lib.rs +++ b/gpu_display/src/lib.rs @@ -262,21 +262,25 @@ trait GpuDisplaySurface { } /// Returns the type of the completed buffer. + #[allow(dead_code)] fn buffer_completion_type(&self) -> u32 { 0 } /// Draws the current buffer on the screen. + #[allow(dead_code)] fn draw_current_buffer(&mut self) { // no-op } /// Handles a compositor-specific client event. + #[allow(dead_code)] fn on_client_message(&mut self, _client_data: u64) { // no-op } /// Handles a compositor-specific shared memory completion event. + #[allow(dead_code)] fn on_shm_completion(&mut self, _shm_complete: u64) { // no-op } diff --git a/gpu_display/src/vulkan/sys/windows.rs b/gpu_display/src/vulkan/sys/windows.rs index dbdc82d675..ba9c36d9c5 100644 --- a/gpu_display/src/vulkan/sys/windows.rs +++ b/gpu_display/src/vulkan/sys/windows.rs @@ -368,7 +368,7 @@ static WND_CLASS_REGISTRATION_SUCCESS: Mutex = Mutex::new(false); /// # Safety /// - The passed in `worker` must not be destroyed before the created window is destroyed if the -/// window creation succeeds. +/// window creation succeeds. /// - The WNDPROC must be called within the same thread that calls create_window. /// # Arguments /// * `worker` - we use the runtime borrow checker to make sure there is no unwanted borrowing to diff --git a/hypervisor/Cargo.toml b/hypervisor/Cargo.toml index 3012bacac0..662cecd0ab 100644 --- a/hypervisor/Cargo.toml +++ b/hypervisor/Cargo.toml @@ -5,6 +5,7 @@ authors = ["The ChromiumOS Authors"] edition = "2021" [features] +enable_haxm_tests = [] haxm = [] whpx = [] geniezone = [] diff --git a/src/crosvm/sys/windows/cmdline.rs b/src/crosvm/sys/windows/cmdline.rs index cf3e78bbb7..27d17e3855 100644 --- a/src/crosvm/sys/windows/cmdline.rs +++ b/src/crosvm/sys/windows/cmdline.rs @@ -37,6 +37,7 @@ pub struct RunMainCommand { /// Start a new metrics instance pub struct RunMetricsCommand { #[argh(option, arg_name = "TRANSPORT_TUBE_RD")] + #[allow(dead_code)] /// tube transporter descriptor used to bootstrap the metrics process. pub bootstrap: usize, } diff --git a/tools/custom_checks b/tools/custom_checks index 35dd5d937d..00630fec04 100755 --- a/tools/custom_checks +++ b/tools/custom_checks @@ -92,8 +92,11 @@ def check_rust_lockfiles(*files: str): # These crosvm features are currently not built upstream. Do not add to this list. KNOWN_DISABLED_FEATURES = [ "default-no-sandbox", + "gvm", "libvda", + "perfetto", "process-invariants", + "prod-build", "sandbox", "seccomp_trace", "slirp-ring-capture", diff --git a/usb_sys/src/lib.rs b/usb_sys/src/lib.rs index 897df07a94..90b25bff1b 100644 --- a/usb_sys/src/lib.rs +++ b/usb_sys/src/lib.rs @@ -9,6 +9,7 @@ #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] +#![allow(dead_code)] use std::os::raw::c_char; use std::os::raw::c_int; diff --git a/win_audio/src/win_audio_impl/async_stream.rs b/win_audio/src/win_audio_impl/async_stream.rs index f40d55d36f..73ef3bcced 100644 --- a/win_audio/src/win_audio_impl/async_stream.rs +++ b/win_audio/src/win_audio_impl/async_stream.rs @@ -228,16 +228,11 @@ impl AsyncPlaybackBufferStream for WinAudioRenderer { self.device.guest_frame_rate, self.device.incoming_buffer_size_in_frames, ) - .map_err(|e| { - match &e { - RenderError::WinAudioError(win_audio_error) => { - log_playback_error_with_limit(win_audio_error.into()) - } - _ => { - log_playback_error_with_limit((&WinAudioError::Unknown).into()) - } + .inspect_err(|e| match &e { + RenderError::WinAudioError(win_audio_error) => { + log_playback_error_with_limit(win_audio_error.into()) } - e + _ => log_playback_error_with_limit((&WinAudioError::Unknown).into()), })?; } }