From 902e7c8450978ddf800b5a311f570aa982ff2ba4 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 8 Apr 2019 23:00:57 -0700 Subject: 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/usb/host_backend/context.rs | 8 ++++---- devices/src/usb/host_backend/error.rs | 8 ++++---- .../host_backend/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 +++++----- devices/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 +- devices/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 +- devices/src/usb/xhci/transfer_ring_controller.rs | 8 ++++---- devices/src/usb/xhci/usb_hub.rs | 2 +- devices/src/usb/xhci/xhci.rs | 4 ++-- .../src/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 ++-- 22 files changed, 67 insertions(+), 67 deletions(-) (limited to 'devices/src/usb') diff --git a/devices/src/usb/host_backend/context.rs b/devices/src/usb/host_backend/context.rs index dc35a9f..5d8b689 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 b414c97..c9906ca 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 6aca696..de80521 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 ca00da8..8a47037 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 218402a..8abcfd6 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 ba1d359..7678b88 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 60e29d7..9805f39 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 0796250..ea34ca0 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 6f4e8f3..b9bb1ac 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 2e0089b..e850eb2 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 d4faa71..1eb11a6 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 37afe17..bd17395 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 36387fc..f375178 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 8608601..b1cb6e8 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 1dc3ee2..c05afd5 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 f5eb4c0..dec2108 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 37c59fb..d5c532e 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 0ede18a..0b66197 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 9f186ec..c014d77 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 2c8ba58..66834b8 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 a5ea3b2..810c44e 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 76454af..eb50435 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 { -- cgit 1.4.1