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 <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: David Tolnay <dtolnay@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: David Tolnay <dtolnay@chromium.org>
This commit is contained in:
David Tolnay 2019-04-08 23:00:57 -07:00 committed by chrome-bot
parent 107edb3eec
commit 902e7c8450
30 changed files with 85 additions and 84 deletions

View file

@ -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.

View file

@ -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);

View file

@ -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)]

View file

@ -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<Register<$ty>> = 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,

View file

@ -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.

View file

@ -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 {

View file

@ -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;

View file

@ -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 {

View file

@ -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<UsbHub>,

View file

@ -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 {

View file

@ -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<T: UsbTransferBuffer>(

View file

@ -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 {

View file

@ -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 {

View file

@ -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};

View file

@ -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 {

View file

@ -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() {

View file

@ -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<i32>,

View file

@ -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.

View file

@ -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() {

View file

@ -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;

View file

@ -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;

View file

@ -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 {

View file

@ -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 {

View file

@ -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;

View file

@ -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;

View file

@ -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 {

View file

@ -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,

View file

@ -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.

View file

@ -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<u8>,

View file

@ -354,7 +354,7 @@ impl PciDevice for VirtioPciDevice {
resources: &mut SystemAllocator,
) -> std::result::Result<Vec<(u64, u64)>, 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()))?;