From 902e7c8450978ddf800b5a311f570aa982ff2ba4 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 8 Apr 2019 23:00:57 -0700 Subject: [PATCH] edition: Use 2018-style paths in devices crate These are import paths in new code added since CL:1513054 that need to be made compatible with 2018 edition's treatment of paths. TEST=cargo check TEST=cargo check --all-features TEST=cargo check --target aarch64-unknown-linux-gnu Change-Id: Icb3ecf2fb2015332e0c03cdc22bff2ecab2c40df Reviewed-on: https://chromium-review.googlesource.com/1559264 Commit-Ready: ChromeOS CL Exonerator Bot Tested-by: David Tolnay Tested-by: kokoro Reviewed-by: David Tolnay --- devices/src/ioapic.rs | 2 +- devices/src/pci/ac97_bus_master.rs | 8 ++++--- devices/src/pic.rs | 2 +- devices/src/register_space/register.rs | 10 ++++----- devices/src/usb/host_backend/context.rs | 8 +++---- devices/src/usb/host_backend/error.rs | 8 +++---- .../host_backend_device_provider.rs | 8 +++---- devices/src/usb/host_backend/host_device.rs | 22 +++++++++---------- devices/src/usb/host_backend/hotplug.rs | 6 ++--- devices/src/usb/host_backend/usb_endpoint.rs | 14 ++++++------ devices/src/usb/host_backend/utils.rs | 10 ++++----- .../src/usb/xhci/command_ring_controller.rs | 2 +- devices/src/usb/xhci/device_slot.rs | 6 ++--- devices/src/usb/xhci/interrupter.rs | 2 +- devices/src/usb/xhci/intr_resample_handler.rs | 2 +- devices/src/usb/xhci/ring_buffer.rs | 2 +- .../src/usb/xhci/ring_buffer_controller.rs | 4 ++-- devices/src/usb/xhci/ring_buffer_stop_cb.rs | 2 +- devices/src/usb/xhci/scatter_gather_buffer.rs | 2 +- .../src/usb/xhci/transfer_ring_controller.rs | 8 +++---- devices/src/usb/xhci/usb_hub.rs | 2 +- devices/src/usb/xhci/xhci.rs | 4 ++-- .../usb/xhci/xhci_backend_device_provider.rs | 2 +- devices/src/usb/xhci/xhci_controller.rs | 14 ++++++------ devices/src/usb/xhci/xhci_regs.rs | 2 +- devices/src/usb/xhci/xhci_transfer.rs | 4 ++-- devices/src/virtio/gpu/backend.rs | 3 +-- devices/src/virtio/gpu/mod.rs | 2 +- devices/src/virtio/input/event_source.rs | 6 ++--- devices/src/virtio/virtio_pci_device.rs | 2 +- 30 files changed, 85 insertions(+), 84 deletions(-) diff --git a/devices/src/ioapic.rs b/devices/src/ioapic.rs index a4bb98edf7..a022c859ea 100644 --- a/devices/src/ioapic.rs +++ b/devices/src/ioapic.rs @@ -5,8 +5,8 @@ // Implementation of an intel 82093AA Input/Output Advanced Programmable Interrupt Controller // See https://pdos.csail.mit.edu/6.828/2016/readings/ia32/ioapic.pdf for a specification. +use crate::BusDevice; use bit_field::*; -use BusDevice; // TODO(mutexlox): once https://crrev.com/c/1519686 has landed, refactor these bitfields to use // better types where applicable. diff --git a/devices/src/pci/ac97_bus_master.rs b/devices/src/pci/ac97_bus_master.rs index 5f7f444426..d4b6f73ca7 100644 --- a/devices/src/pci/ac97_bus_master.rs +++ b/devices/src/pci/ac97_bus_master.rs @@ -418,9 +418,11 @@ impl Ac97BusMaster { current_buffer_size(self.regs.lock().func_regs(func), &self.mem)?; let buffer_frames = buffer_samples / num_channels; - let (mut stream_control, mut output_stream) = self - .audio_server - .new_playback_stream(num_channels, DEVICE_SAMPLE_RATE, buffer_frames)?; + let (stream_control, output_stream) = self.audio_server.new_playback_stream( + num_channels, + DEVICE_SAMPLE_RATE, + buffer_frames, + )?; self.po_stream_control = Some(stream_control); self.update_mixer_settings(mixer); diff --git a/devices/src/pic.rs b/devices/src/pic.rs index cdc4d3995c..a55a3367df 100644 --- a/devices/src/pic.rs +++ b/devices/src/pic.rs @@ -12,7 +12,7 @@ // For the purposes of both using more descriptive terms and avoiding terms with lots of charged // emotional context, this file refers to them instead as "primary" and "secondary" PITs. -use BusDevice; +use crate::BusDevice; #[repr(usize)] #[derive(Debug, Clone, Copy, PartialEq)] diff --git a/devices/src/register_space/register.rs b/devices/src/register_space/register.rs index 19e526702a..432534476d 100644 --- a/devices/src/register_space/register.rs +++ b/devices/src/register_space/register.rs @@ -172,7 +172,7 @@ where #[macro_export] macro_rules! static_register { (ty: $ty:ty,offset: $offset:expr,value: $value:expr,) => {{ - use register_space::*; + use crate::register_space::*; static REG_SPEC: StaticRegisterSpec<$ty> = StaticRegisterSpec::<$ty> { offset: $offset, value: $value, @@ -356,7 +356,7 @@ macro_rules! register { guest_writeable_mask: $mask:expr, guest_write_1_to_clear_mask: $w1tcm:expr, ) => {{ - use register_space::*; + use crate::register_space::*; let spec: RegisterSpec<$ty> = RegisterSpec::<$ty> { name: String::from($name), offset: $offset, @@ -367,7 +367,7 @@ macro_rules! register { Register::<$ty>::new(spec, $rv) }}; (name: $name:tt, ty: $ty:ty,offset: $offset:expr,reset_value: $rv:expr,) => {{ - use register_space::*; + use crate::register_space::*; let spec: RegisterSpec<$ty> = RegisterSpec::<$ty> { name: String::from($name), offset: $offset, @@ -392,11 +392,11 @@ macro_rules! register_array { $gwm:expr,guest_write_1_to_clear_mask: $gw1tcm:expr, ) => {{ - use register_space::*; + use crate::register_space::*; let mut v: Vec> = Vec::new(); for i in 0..$cnt { let offset = $base_offset + ($stride * i) as RegisterOffset; - let mut spec: RegisterSpec<$ty> = RegisterSpec::<$ty> { + let spec: RegisterSpec<$ty> = RegisterSpec::<$ty> { name: format!("{}-{}", $name, i), offset, reset_value: $rv, diff --git a/devices/src/usb/host_backend/context.rs b/devices/src/usb/host_backend/context.rs index dc35a9f238..5d8b689203 100644 --- a/devices/src/usb/host_backend/context.rs +++ b/devices/src/usb/host_backend/context.rs @@ -3,14 +3,14 @@ // found in the LICENSE file. use super::error::*; +use crate::usb::usb_util::hotplug::UsbHotplugHandler; +use crate::usb::usb_util::libusb_context::{LibUsbContext, LibUsbPollfdChangeHandler}; +use crate::usb::usb_util::libusb_device::LibUsbDevice; +use crate::utils::{EventHandler, EventLoop}; use std::os::raw::c_short; use std::os::unix::io::RawFd; use std::sync::{Arc, Weak}; use sys_util::WatchingEvents; -use usb::usb_util::hotplug::UsbHotplugHandler; -use usb::usb_util::libusb_context::{LibUsbContext, LibUsbPollfdChangeHandler}; -use usb::usb_util::libusb_device::LibUsbDevice; -use utils::{EventHandler, EventLoop}; use vm_control::MaybeOwnedFd; /// Context wraps libusb context with libusb event handling. diff --git a/devices/src/usb/host_backend/error.rs b/devices/src/usb/host_backend/error.rs index b414c97e73..c9906cabde 100644 --- a/devices/src/usb/host_backend/error.rs +++ b/devices/src/usb/host_backend/error.rs @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +use crate::usb::usb_util::error::Error as UsbUtilError; +use crate::usb::xhci::scatter_gather_buffer::Error as BufferError; +use crate::usb::xhci::xhci_transfer::Error as XhciTransferError; +use crate::utils::Error as UtilsError; use msg_socket::MsgError; use std::fmt::{self, Display}; -use usb::usb_util::error::Error as UsbUtilError; -use usb::xhci::scatter_gather_buffer::Error as BufferError; -use usb::xhci::xhci_transfer::Error as XhciTransferError; -use utils::Error as UtilsError; #[derive(Debug)] pub enum Error { diff --git a/devices/src/usb/host_backend/host_backend_device_provider.rs b/devices/src/usb/host_backend/host_backend_device_provider.rs index 6aca696fc7..de80521956 100644 --- a/devices/src/usb/host_backend/host_backend_device_provider.rs +++ b/devices/src/usb/host_backend/host_backend_device_provider.rs @@ -8,16 +8,16 @@ use super::context::Context; use super::error::*; use super::host_device::HostDevice; use super::hotplug::HotplugHandler; +use crate::usb::xhci::usb_hub::UsbHub; +use crate::usb::xhci::xhci_backend_device_provider::XhciBackendDeviceProvider; +use crate::utils::AsyncJobQueue; +use crate::utils::{EventHandler, EventLoop, FailHandle}; use msg_socket::{MsgReceiver, MsgSender, MsgSocket}; use std::mem; use std::os::unix::io::{AsRawFd, RawFd}; use std::time::Duration; use sys_util::net::UnixSeqpacket; use sys_util::WatchingEvents; -use usb::xhci::usb_hub::UsbHub; -use usb::xhci::xhci_backend_device_provider::XhciBackendDeviceProvider; -use utils::AsyncJobQueue; -use utils::{EventHandler, EventLoop, FailHandle}; use vm_control::{UsbControlCommand, UsbControlResult, UsbControlSocket}; const SOCKET_TIMEOUT_MS: u64 = 2000; diff --git a/devices/src/usb/host_backend/host_device.rs b/devices/src/usb/host_backend/host_device.rs index ca00da8e3b..8a47037423 100644 --- a/devices/src/usb/host_backend/host_device.rs +++ b/devices/src/usb/host_backend/host_device.rs @@ -9,22 +9,22 @@ use sync::Mutex; use super::error::*; use super::usb_endpoint::UsbEndpoint; use super::utils::{submit_transfer, update_transfer_state}; -use std::collections::HashMap; -use usb::usb_util::device_handle::DeviceHandle; -use usb::usb_util::error::Error as LibUsbError; -use usb::usb_util::libusb_device::LibUsbDevice; -use usb::usb_util::types::{ +use crate::usb::usb_util::device_handle::DeviceHandle; +use crate::usb::usb_util::error::Error as LibUsbError; +use crate::usb::usb_util::libusb_device::LibUsbDevice; +use crate::usb::usb_util::types::{ ControlRequestDataPhaseTransferDirection, ControlRequestRecipient, ControlRequestType, StandardControlRequest, UsbRequestSetup, }; -use usb::usb_util::usb_transfer::{ +use crate::usb::usb_util::usb_transfer::{ control_transfer, ControlTransferBuffer, TransferStatus, UsbTransfer, }; -use usb::xhci::scatter_gather_buffer::ScatterGatherBuffer; -use usb::xhci::xhci_backend_device::{BackendType, UsbDeviceAddress, XhciBackendDevice}; -use usb::xhci::xhci_transfer::{XhciTransfer, XhciTransferState, XhciTransferType}; -use utils::AsyncJobQueue; -use utils::FailHandle; +use crate::usb::xhci::scatter_gather_buffer::ScatterGatherBuffer; +use crate::usb::xhci::xhci_backend_device::{BackendType, UsbDeviceAddress, XhciBackendDevice}; +use crate::usb::xhci::xhci_transfer::{XhciTransfer, XhciTransferState, XhciTransferType}; +use crate::utils::AsyncJobQueue; +use crate::utils::FailHandle; +use std::collections::HashMap; #[derive(PartialEq)] pub enum ControlEndpointState { diff --git a/devices/src/usb/host_backend/hotplug.rs b/devices/src/usb/host_backend/hotplug.rs index 218402abbf..8abcfd6c45 100644 --- a/devices/src/usb/host_backend/hotplug.rs +++ b/devices/src/usb/host_backend/hotplug.rs @@ -4,9 +4,9 @@ use std::sync::Arc; -use usb::usb_util::hotplug::{HotplugEvent, UsbHotplugHandler}; -use usb::usb_util::libusb_device::LibUsbDevice; -use usb::xhci::usb_hub::UsbHub; +use crate::usb::usb_util::hotplug::{HotplugEvent, UsbHotplugHandler}; +use crate::usb::usb_util::libusb_device::LibUsbDevice; +use crate::usb::xhci::usb_hub::UsbHub; pub struct HotplugHandler { hub: Arc, diff --git a/devices/src/usb/host_backend/usb_endpoint.rs b/devices/src/usb/host_backend/usb_endpoint.rs index ba1d3590cf..7678b88ef1 100644 --- a/devices/src/usb/host_backend/usb_endpoint.rs +++ b/devices/src/usb/host_backend/usb_endpoint.rs @@ -8,17 +8,17 @@ use sync::Mutex; use super::error::*; use super::utils::{submit_transfer, update_transfer_state}; -use usb::usb_util::device_handle::DeviceHandle; -use usb::usb_util::types::{EndpointDirection, EndpointType, ENDPOINT_DIRECTION_OFFSET}; -use usb::usb_util::usb_transfer::{ +use crate::usb::usb_util::device_handle::DeviceHandle; +use crate::usb::usb_util::types::{EndpointDirection, EndpointType, ENDPOINT_DIRECTION_OFFSET}; +use crate::usb::usb_util::usb_transfer::{ bulk_transfer, interrupt_transfer, BulkTransferBuffer, TransferStatus, UsbTransfer, }; -use usb::xhci::scatter_gather_buffer::ScatterGatherBuffer; -use usb::xhci::xhci_transfer::{ +use crate::usb::xhci::scatter_gather_buffer::ScatterGatherBuffer; +use crate::usb::xhci::xhci_transfer::{ TransferDirection, XhciTransfer, XhciTransferState, XhciTransferType, }; -use utils::AsyncJobQueue; -use utils::FailHandle; +use crate::utils::AsyncJobQueue; +use crate::utils::FailHandle; /// Isochronous, Bulk or Interrupt endpoint. pub struct UsbEndpoint { diff --git a/devices/src/usb/host_backend/utils.rs b/devices/src/usb/host_backend/utils.rs index 60e29d7e63..9805f39294 100644 --- a/devices/src/usb/host_backend/utils.rs +++ b/devices/src/usb/host_backend/utils.rs @@ -7,11 +7,11 @@ use std::sync::Arc; use sync::Mutex; use super::error::*; -use usb::usb_util::device_handle::DeviceHandle; -use usb::usb_util::usb_transfer::{TransferStatus, UsbTransfer, UsbTransferBuffer}; -use usb::xhci::xhci_transfer::{XhciTransfer, XhciTransferState}; -use utils::AsyncJobQueue; -use utils::FailHandle; +use crate::usb::usb_util::device_handle::DeviceHandle; +use crate::usb::usb_util::usb_transfer::{TransferStatus, UsbTransfer, UsbTransferBuffer}; +use crate::usb::xhci::xhci_transfer::{XhciTransfer, XhciTransferState}; +use crate::utils::AsyncJobQueue; +use crate::utils::FailHandle; /// Helper function to update xhci_transfer state. pub fn update_transfer_state( diff --git a/devices/src/usb/xhci/command_ring_controller.rs b/devices/src/usb/xhci/command_ring_controller.rs index 0796250712..ea34ca0a90 100644 --- a/devices/src/usb/xhci/command_ring_controller.rs +++ b/devices/src/usb/xhci/command_ring_controller.rs @@ -14,11 +14,11 @@ use super::xhci_abi::{ TrbCompletionCode, TrbType, }; use super::xhci_regs::{valid_slot_id, MAX_SLOTS}; +use crate::utils::EventLoop; use std::fmt::{self, Display}; use std::sync::Arc; use sync::Mutex; use sys_util::{Error as SysError, EventFd, GuestAddress, GuestMemory}; -use utils::EventLoop; #[derive(Debug)] pub enum Error { diff --git a/devices/src/usb/xhci/device_slot.rs b/devices/src/usb/xhci/device_slot.rs index 6f4e8f3af9..b9bb1acd5b 100644 --- a/devices/src/usb/xhci/device_slot.rs +++ b/devices/src/usb/xhci/device_slot.rs @@ -11,15 +11,15 @@ use super::xhci_abi::{ InputControlContext, SlotContext, TrbCompletionCode, DEVICE_CONTEXT_ENTRY_SIZE, }; use super::xhci_regs::{valid_slot_id, MAX_PORTS, MAX_SLOTS}; -use register_space::Register; +use crate::register_space::Register; +use crate::usb::xhci::ring_buffer_stop_cb::{fallible_closure, RingBufferStopCallback}; +use crate::utils::{EventLoop, FailHandle}; use std::fmt::{self, Display}; use std::mem::size_of; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use sync::Mutex; use sys_util::{GuestAddress, GuestMemory, GuestMemoryError}; -use usb::xhci::ring_buffer_stop_cb::{fallible_closure, RingBufferStopCallback}; -use utils::{EventLoop, FailHandle}; #[derive(Debug)] pub enum Error { diff --git a/devices/src/usb/xhci/interrupter.rs b/devices/src/usb/xhci/interrupter.rs index 2e0089b259..e850eb2eb3 100644 --- a/devices/src/usb/xhci/interrupter.rs +++ b/devices/src/usb/xhci/interrupter.rs @@ -8,7 +8,7 @@ use super::xhci_abi::{ TrbCast, TrbCompletionCode, TrbType, }; use super::xhci_regs::*; -use register_space::Register; +use crate::register_space::Register; use std::fmt::{self, Display}; use sys_util::{Error as SysError, EventFd, GuestAddress, GuestMemory}; diff --git a/devices/src/usb/xhci/intr_resample_handler.rs b/devices/src/usb/xhci/intr_resample_handler.rs index d4faa71dec..1eb11a6a8f 100644 --- a/devices/src/usb/xhci/intr_resample_handler.rs +++ b/devices/src/usb/xhci/intr_resample_handler.rs @@ -3,10 +3,10 @@ // found in the LICENSE file. use super::interrupter::Interrupter; +use crate::utils::{EventHandler, EventLoop}; use std::sync::Arc; use sync::Mutex; use sys_util::{EventFd, WatchingEvents}; -use utils::{EventHandler, EventLoop}; /// Interrupt Resample handler handles resample event. It will reassert interrupt if needed. pub struct IntrResampleHandler { diff --git a/devices/src/usb/xhci/ring_buffer.rs b/devices/src/usb/xhci/ring_buffer.rs index 37afe17a8d..bd173958f5 100644 --- a/devices/src/usb/xhci/ring_buffer.rs +++ b/devices/src/usb/xhci/ring_buffer.rs @@ -152,7 +152,7 @@ impl RingBuffer { #[cfg(test)] mod test { use super::*; - use usb::xhci::xhci_abi::*; + use crate::usb::xhci::xhci_abi::*; #[test] fn ring_test_dequeue() { diff --git a/devices/src/usb/xhci/ring_buffer_controller.rs b/devices/src/usb/xhci/ring_buffer_controller.rs index 36387fc745..f37517881c 100644 --- a/devices/src/usb/xhci/ring_buffer_controller.rs +++ b/devices/src/usb/xhci/ring_buffer_controller.rs @@ -4,10 +4,10 @@ use super::ring_buffer_stop_cb::RingBufferStopCallback; use super::xhci_abi::*; +use crate::utils::{self, EventHandler, EventLoop}; use std::fmt::{self, Display}; use std::sync::{Arc, MutexGuard}; use sync::Mutex; -use utils::{self, EventHandler, EventLoop}; use sys_util::{Error as SysError, EventFd, GuestAddress, GuestMemory, WatchingEvents}; @@ -238,9 +238,9 @@ where #[cfg(test)] mod tests { use super::*; + use crate::utils::FailHandle; use std::mem::size_of; use std::sync::mpsc::{channel, Sender}; - use utils::FailHandle; struct TestHandler { sender: Sender, diff --git a/devices/src/usb/xhci/ring_buffer_stop_cb.rs b/devices/src/usb/xhci/ring_buffer_stop_cb.rs index 8608601270..b1cb6e8656 100644 --- a/devices/src/usb/xhci/ring_buffer_stop_cb.rs +++ b/devices/src/usb/xhci/ring_buffer_stop_cb.rs @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +use crate::utils::FailHandle; use std::sync::{Arc, Mutex}; -use utils::FailHandle; /// RingBufferStopCallback wraps a callback. The callback will be invoked when last instance of /// RingBufferStopCallback and its clones is dropped. diff --git a/devices/src/usb/xhci/scatter_gather_buffer.rs b/devices/src/usb/xhci/scatter_gather_buffer.rs index 1dc3ee22fc..c05afd5466 100644 --- a/devices/src/usb/xhci/scatter_gather_buffer.rs +++ b/devices/src/usb/xhci/scatter_gather_buffer.rs @@ -126,7 +126,7 @@ impl ScatterGatherBuffer { #[cfg(test)] mod test { use super::*; - use usb::xhci::xhci_abi::{AddressedTrb, Trb}; + use crate::usb::xhci::xhci_abi::{AddressedTrb, Trb}; #[test] fn scatter_gather_buffer_test() { diff --git a/devices/src/usb/xhci/transfer_ring_controller.rs b/devices/src/usb/xhci/transfer_ring_controller.rs index f5eb4c0a63..dec210864d 100644 --- a/devices/src/usb/xhci/transfer_ring_controller.rs +++ b/devices/src/usb/xhci/transfer_ring_controller.rs @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +use crate::usb::xhci::ring_buffer_controller::{ + Error as RingBufferControllerError, RingBufferController, TransferDescriptorHandler, +}; +use crate::utils::EventLoop; use std::sync::Arc; use sync::Mutex; use sys_util::{EventFd, GuestMemory}; -use usb::xhci::ring_buffer_controller::{ - Error as RingBufferControllerError, RingBufferController, TransferDescriptorHandler, -}; -use utils::EventLoop; use super::interrupter::Interrupter; use super::usb_hub::UsbPort; diff --git a/devices/src/usb/xhci/usb_hub.rs b/devices/src/usb/xhci/usb_hub.rs index 37c59fba6e..d5c532e637 100644 --- a/devices/src/usb/xhci/usb_hub.rs +++ b/devices/src/usb/xhci/usb_hub.rs @@ -9,7 +9,7 @@ use super::xhci_regs::{ PORTSC_PORT_ENABLED, PORTSC_PORT_ENABLED_DISABLED_CHANGE, USB2_PORTS_END, USB2_PORTS_START, USB3_PORTS_END, USB3_PORTS_START, USB_STS_PORT_CHANGE_DETECT, }; -use register_space::Register; +use crate::register_space::Register; use std::fmt::{self, Display}; use std::sync::{Arc, MutexGuard}; use sync::Mutex; diff --git a/devices/src/usb/xhci/xhci.rs b/devices/src/usb/xhci/xhci.rs index 0ede18acb4..0b66197f04 100644 --- a/devices/src/usb/xhci/xhci.rs +++ b/devices/src/usb/xhci/xhci.rs @@ -10,12 +10,12 @@ use super::ring_buffer_stop_cb::RingBufferStopCallback; use super::usb_hub::UsbHub; use super::xhci_backend_device_provider::XhciBackendDeviceProvider; use super::xhci_regs::*; +use crate::usb::host_backend::host_backend_device_provider::HostBackendDeviceProvider; +use crate::utils::{Error as UtilsError, EventLoop, FailHandle}; use std::fmt::{self, Display}; use std::sync::Arc; use sync::Mutex; use sys_util::{EventFd, GuestAddress, GuestMemory}; -use usb::host_backend::host_backend_device_provider::HostBackendDeviceProvider; -use utils::{Error as UtilsError, EventLoop, FailHandle}; #[derive(Debug)] pub enum Error { diff --git a/devices/src/usb/xhci/xhci_backend_device_provider.rs b/devices/src/usb/xhci/xhci_backend_device_provider.rs index 9f186ecf65..c014d776cb 100644 --- a/devices/src/usb/xhci/xhci_backend_device_provider.rs +++ b/devices/src/usb/xhci/xhci_backend_device_provider.rs @@ -3,9 +3,9 @@ // found in the LICENSE file. use super::usb_hub::UsbHub; +use crate::utils::{EventLoop, FailHandle}; use std::os::unix::io::RawFd; use std::sync::Arc; -use utils::{EventLoop, FailHandle}; /// Xhci backend provider will run on an EventLoop and connect new devices to usb ports. pub trait XhciBackendDeviceProvider: Send { diff --git a/devices/src/usb/xhci/xhci_controller.rs b/devices/src/usb/xhci/xhci_controller.rs index 2c8ba581e8..66834b87b8 100644 --- a/devices/src/usb/xhci/xhci_controller.rs +++ b/devices/src/usb/xhci/xhci_controller.rs @@ -2,22 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -use pci::{ +use crate::pci::{ PciBarConfiguration, PciClassCode, PciConfiguration, PciDevice, PciDeviceError, PciHeaderType, PciInterruptPin, PciProgrammingInterface, PciSerialBusSubClass, }; -use register_space::{Register, RegisterSpace}; +use crate::register_space::{Register, RegisterSpace}; +use crate::usb::host_backend::host_backend_device_provider::HostBackendDeviceProvider; +use crate::usb::xhci::xhci::Xhci; +use crate::usb::xhci::xhci_backend_device_provider::XhciBackendDeviceProvider; +use crate::usb::xhci::xhci_regs::{init_xhci_mmio_space_and_regs, XhciRegs}; +use crate::utils::FailHandle; use resources::SystemAllocator; use std::mem; use std::os::unix::io::RawFd; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use sys_util::{EventFd, GuestMemory}; -use usb::host_backend::host_backend_device_provider::HostBackendDeviceProvider; -use usb::xhci::xhci::Xhci; -use usb::xhci::xhci_backend_device_provider::XhciBackendDeviceProvider; -use usb::xhci::xhci_regs::{init_xhci_mmio_space_and_regs, XhciRegs}; -use utils::FailHandle; const XHCI_BAR0_SIZE: u64 = 0x10000; diff --git a/devices/src/usb/xhci/xhci_regs.rs b/devices/src/usb/xhci/xhci_regs.rs index a5ea3b2c7b..810c44ea10 100644 --- a/devices/src/usb/xhci/xhci_regs.rs +++ b/devices/src/usb/xhci/xhci_regs.rs @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -use register_space::{Register, RegisterSpace}; +use crate::register_space::{Register, RegisterSpace}; /// Max interrupter number. pub const MAX_INTERRUPTER: u8 = 1; diff --git a/devices/src/usb/xhci/xhci_transfer.rs b/devices/src/usb/xhci/xhci_transfer.rs index 76454afe4b..eb504353a3 100644 --- a/devices/src/usb/xhci/xhci_transfer.rs +++ b/devices/src/usb/xhci/xhci_transfer.rs @@ -10,14 +10,14 @@ use super::xhci_abi::{ TrbCompletionCode, TrbType, }; use super::xhci_regs::MAX_INTERRUPTER; +use crate::usb::usb_util::types::UsbRequestSetup; +use crate::usb::usb_util::usb_transfer::TransferStatus; use std::cmp::min; use std::fmt::{self, Display}; use std::mem; use std::sync::{Arc, Weak}; use sync::Mutex; use sys_util::{Error as SysError, EventFd, GuestMemory}; -use usb::usb_util::types::UsbRequestSetup; -use usb::usb_util::usb_transfer::TransferStatus; #[derive(Debug)] pub enum Error { diff --git a/devices/src/virtio/gpu/backend.rs b/devices/src/virtio/gpu/backend.rs index 8d4d406c68..8dd6abfc25 100644 --- a/devices/src/virtio/gpu/backend.rs +++ b/devices/src/virtio/gpu/backend.rs @@ -807,8 +807,7 @@ impl Backend { offset: buffer.plane_offset(plane_index), }); } - let mut backed = - BackedBuffer::new_renderer_registered(buffer, res, image); + let backed = BackedBuffer::new_renderer_registered(buffer, res, image); slot.insert(Box::new(backed)); GpuResponse::OkResourcePlaneInfo { format_modifier, diff --git a/devices/src/virtio/gpu/mod.rs b/devices/src/virtio/gpu/mod.rs index c56b360c83..736314f1a2 100644 --- a/devices/src/virtio/gpu/mod.rs +++ b/devices/src/virtio/gpu/mod.rs @@ -36,7 +36,7 @@ use super::{ use self::backend::Backend; use self::protocol::*; -use pci::{PciBarConfiguration, PciBarPrefetchable, PciBarRegionType}; +use crate::pci::{PciBarConfiguration, PciBarPrefetchable, PciBarRegionType}; // First queue is for virtio gpu commands. Second queue is for cursor commands, which we expect // there to be fewer of. diff --git a/devices/src/virtio/input/event_source.rs b/devices/src/virtio/input/event_source.rs index 5e24f084da..48ed1922cc 100644 --- a/devices/src/virtio/input/event_source.rs +++ b/devices/src/virtio/input/event_source.rs @@ -335,14 +335,14 @@ where #[cfg(test)] mod tests { + use crate::virtio::input::event_source::input_event; + use crate::virtio::input::event_source::EventSourceImpl; + use crate::virtio::input::virtio_input_event; use data_model::{DataInit, Le16, Le32}; use std::cmp::min; use std::io::Read; use std::io::Write; use std::mem::size_of; - use virtio::input::event_source::input_event; - use virtio::input::event_source::EventSourceImpl; - use virtio::input::virtio_input_event; struct SourceMock { events: Vec, diff --git a/devices/src/virtio/virtio_pci_device.rs b/devices/src/virtio/virtio_pci_device.rs index 27ab5fb061..7c5b0d8eeb 100644 --- a/devices/src/virtio/virtio_pci_device.rs +++ b/devices/src/virtio/virtio_pci_device.rs @@ -354,7 +354,7 @@ impl PciDevice for VirtioPciDevice { resources: &mut SystemAllocator, ) -> std::result::Result, PciDeviceError> { let mut ranges = Vec::new(); - for mut config in self.device.get_device_bars() { + for config in self.device.get_device_bars() { let device_addr = resources .allocate_device_addresses(config.get_size()) .ok_or(PciDeviceError::IoAllocationFailed(config.get_size()))?;