diff --git a/arch/src/lib.rs b/arch/src/lib.rs index 1ef62e025..a91f7da1b 100644 --- a/arch/src/lib.rs +++ b/arch/src/lib.rs @@ -8,25 +8,11 @@ //! Supported platforms: x86_64, aarch64. #![allow(clippy::transmute_ptr_to_ptr, clippy::redundant_static_lifetimes)] -extern crate anyhow; -extern crate byteorder; -extern crate hypervisor; -extern crate libc; #[macro_use] extern crate log; -#[cfg(feature = "acpi")] -extern crate acpi_tables; -extern crate linux_loader; -extern crate serde; -#[cfg(target_arch = "aarch64")] -extern crate vm_fdt; -extern crate vm_memory; -extern crate vm_migration; #[cfg(target_arch = "aarch64")] #[macro_use] extern crate serde_derive; -extern crate serde_json; -extern crate thiserror; use std::fmt; use std::result; diff --git a/arch/src/x86_64/regs.rs b/arch/src/x86_64/regs.rs index a9822cd43..a63d115c3 100644 --- a/arch/src/x86_64/regs.rs +++ b/arch/src/x86_64/regs.rs @@ -162,8 +162,6 @@ pub fn configure_segments_and_sregs( #[cfg(test)] mod tests { - extern crate vm_memory; - use super::*; use vm_memory::{GuestAddress, GuestMemoryMmap}; diff --git a/devices/src/acpi.rs b/devices/src/acpi.rs index 2e626dfa6..9f7603e35 100644 --- a/devices/src/acpi.rs +++ b/devices/src/acpi.rs @@ -52,7 +52,6 @@ impl BusDevice for AcpiShutdownDevice { const SLEEP_VALUE_BIT: u8 = 2; if data[0] == (S5_SLEEP_VALUE << SLEEP_VALUE_BIT) | (1 << SLEEP_STATUS_EN_BIT) { debug!("ACPI Shutdown signalled"); - extern crate bitflags; if let Err(e) = self.exit_evt.write(1) { error!("Error triggering ACPI shutdown event: {}", e); } diff --git a/devices/src/lib.rs b/devices/src/lib.rs index 7f78718d3..432a1da39 100644 --- a/devices/src/lib.rs +++ b/devices/src/lib.rs @@ -6,20 +6,11 @@ // found in the LICENSE-BSD-3-Clause file. //! Emulates virtual and hardware devices. -extern crate anyhow; + #[macro_use] extern crate bitflags; -extern crate byteorder; -extern crate epoll; -extern crate libc; #[macro_use] extern crate log; -#[cfg(feature = "acpi")] -extern crate acpi_tables; -extern crate vm_device; -extern crate vm_memory; -extern crate vm_migration; -extern crate vmm_sys_util; #[cfg(feature = "acpi")] pub mod acpi; diff --git a/hypervisor/src/arch/emulator/mod.rs b/hypervisor/src/arch/emulator/mod.rs index 9725ac831..2c02de89c 100644 --- a/hypervisor/src/arch/emulator/mod.rs +++ b/hypervisor/src/arch/emulator/mod.rs @@ -4,8 +4,6 @@ // SPDX-License-Identifier: Apache-2.0 // -extern crate thiserror; - use core::fmt::Debug; use std::fmt::{self, Display}; use thiserror::Error; diff --git a/hypervisor/src/arch/x86/emulator/instructions/cmp.rs b/hypervisor/src/arch/x86/emulator/instructions/cmp.rs index 058e31658..1bd5fdac8 100644 --- a/hypervisor/src/arch/x86/emulator/instructions/cmp.rs +++ b/hypervisor/src/arch/x86/emulator/instructions/cmp.rs @@ -10,8 +10,6 @@ // CMP-Compare Two Operands // -extern crate iced_x86; - use crate::arch::emulator::{EmulationError, PlatformEmulator}; use crate::arch::x86::emulator::instructions::*; use crate::arch::x86::regs::*; diff --git a/hypervisor/src/arch/x86/emulator/instructions/mod.rs b/hypervisor/src/arch/x86/emulator/instructions/mod.rs index 5e7f17b70..a40530d4b 100644 --- a/hypervisor/src/arch/x86/emulator/instructions/mod.rs +++ b/hypervisor/src/arch/x86/emulator/instructions/mod.rs @@ -4,8 +4,6 @@ // SPDX-License-Identifier: Apache-2.0 // -extern crate iced_x86; - use crate::arch::emulator::{EmulationError, PlatformEmulator, PlatformError}; use crate::arch::x86::emulator::CpuStateManager; use crate::arch::x86::Exception; diff --git a/hypervisor/src/arch/x86/emulator/instructions/mov.rs b/hypervisor/src/arch/x86/emulator/instructions/mov.rs index c2fe19e9e..7ea908686 100644 --- a/hypervisor/src/arch/x86/emulator/instructions/mov.rs +++ b/hypervisor/src/arch/x86/emulator/instructions/mov.rs @@ -12,8 +12,6 @@ // Copies the second operand (source operand) to the first operand (destination operand). // -extern crate iced_x86; - use crate::arch::emulator::{EmulationError, PlatformEmulator}; use crate::arch::x86::emulator::instructions::*; use crate::arch::x86::Exception; diff --git a/hypervisor/src/arch/x86/emulator/instructions/movs.rs b/hypervisor/src/arch/x86/emulator/instructions/movs.rs index 3c9e9281c..23fd04972 100644 --- a/hypervisor/src/arch/x86/emulator/instructions/movs.rs +++ b/hypervisor/src/arch/x86/emulator/instructions/movs.rs @@ -10,8 +10,6 @@ // MOVS - Move Data from String to String // -extern crate iced_x86; - use crate::arch::emulator::{EmulationError, PlatformEmulator}; use crate::arch::x86::emulator::instructions::*; use crate::arch::x86::regs::DF; diff --git a/hypervisor/src/arch/x86/emulator/mod.rs b/hypervisor/src/arch/x86/emulator/mod.rs index 92e4c61cb..662bd6cfe 100644 --- a/hypervisor/src/arch/x86/emulator/mod.rs +++ b/hypervisor/src/arch/x86/emulator/mod.rs @@ -4,8 +4,6 @@ // SPDX-License-Identifier: Apache-2.0 // -extern crate iced_x86; - use crate::arch::emulator::{EmulationError, EmulationResult, PlatformEmulator, PlatformError}; use crate::arch::x86::emulator::instructions::*; use crate::arch::x86::regs::*; @@ -640,8 +638,6 @@ impl<'a, T: CpuStateManager> Emulator<'a, T> { mod mock_vmm { #![allow(unused_mut)] - extern crate env_logger; - use super::*; use crate::arch::emulator::{EmulationError, PlatformEmulator}; use crate::arch::x86::emulator::{Emulator, EmulatorCpuState as CpuState}; diff --git a/hypervisor/src/lib.rs b/hypervisor/src/lib.rs index e7e62d959..a64c68c44 100644 --- a/hypervisor/src/lib.rs +++ b/hypervisor/src/lib.rs @@ -23,10 +23,6 @@ extern crate anyhow; #[cfg(target_arch = "x86_64")] #[macro_use] extern crate log; -extern crate serde; -extern crate serde_derive; -extern crate serde_json; -extern crate thiserror; /// Architecture specific definitions #[macro_use] diff --git a/net_util/src/lib.rs b/net_util/src/lib.rs index 603d9f265..c9cc08dbe 100644 --- a/net_util/src/lib.rs +++ b/net_util/src/lib.rs @@ -10,16 +10,8 @@ #[cfg(test)] #[macro_use] extern crate lazy_static; -extern crate libc; #[macro_use] extern crate log; -extern crate net_gen; -extern crate rate_limiter; -extern crate serde; -extern crate virtio_bindings; -extern crate vm_memory; -extern crate vm_virtio; -extern crate vmm_sys_util; mod mac; mod open_tap; diff --git a/net_util/src/mac.rs b/net_util/src/mac.rs index ff01e49a9..5fb8517c5 100644 --- a/net_util/src/mac.rs +++ b/net_util/src/mac.rs @@ -152,8 +152,6 @@ impl FromStr for MacAddr { #[cfg(test)] mod tests { - extern crate serde_json; - use super::*; #[test] diff --git a/pci/src/lib.rs b/pci/src/lib.rs index 8e237bb36..d1c4caf31 100644 --- a/pci/src/lib.rs +++ b/pci/src/lib.rs @@ -5,12 +5,8 @@ //! Implements pci devices and busses. #[macro_use] extern crate log; -extern crate hypervisor; -extern crate serde; #[macro_use] extern crate serde_derive; -extern crate serde_json; -extern crate vm_memory; mod bus; mod configuration; diff --git a/pci/src/msi.rs b/pci/src/msi.rs index 61f7c09d7..20dac594a 100644 --- a/pci/src/msi.rs +++ b/pci/src/msi.rs @@ -3,9 +3,6 @@ // SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause // -extern crate byteorder; -extern crate vm_memory; - use byteorder::{ByteOrder, LittleEndian}; use std::sync::Arc; use vm_device::interrupt::{ diff --git a/pci/src/msix.rs b/pci/src/msix.rs index 9ee660128..819934d7a 100644 --- a/pci/src/msix.rs +++ b/pci/src/msix.rs @@ -3,9 +3,6 @@ // SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause // -extern crate byteorder; -extern crate vm_memory; - use crate::{PciCapability, PciCapabilityId}; use anyhow::anyhow; use byteorder::{ByteOrder, LittleEndian}; diff --git a/pci/src/vfio.rs b/pci/src/vfio.rs index 7b253bcae..50f70ef99 100644 --- a/pci/src/vfio.rs +++ b/pci/src/vfio.rs @@ -3,8 +3,6 @@ // SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause // -extern crate vm_allocator; - use crate::{ msi_num_enabled_vectors, BarReprogrammingParams, MsiConfig, MsixCap, MsixConfig, PciBarConfiguration, PciBarRegionType, PciCapabilityId, PciClassCode, PciConfiguration, diff --git a/src/bin/ch-remote.rs b/src/bin/ch-remote.rs index 46e36ecb7..6b2c1c5be 100644 --- a/src/bin/ch-remote.rs +++ b/src/bin/ch-remote.rs @@ -5,9 +5,6 @@ #[macro_use(crate_authors)] extern crate clap; -extern crate api_client; -extern crate serde_json; -extern crate vmm; use api_client::simple_api_command; use api_client::Error as ApiClientError; diff --git a/src/main.rs b/src/main.rs index 2a5c34e67..f2661cf74 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,14 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 // -extern crate anyhow; -extern crate signal_hook; -extern crate vmm; -extern crate vmm_sys_util; - #[macro_use(crate_authors)] extern crate clap; - #[macro_use] extern crate event_monitor; diff --git a/vhost_user_block/src/lib.rs b/vhost_user_block/src/lib.rs index b01ca2b5a..e96056664 100644 --- a/vhost_user_block/src/lib.rs +++ b/vhost_user_block/src/lib.rs @@ -8,11 +8,6 @@ // // SPDX-License-Identifier: (Apache-2.0 AND BSD-3-Clause) -extern crate block_util; -extern crate log; -extern crate vhost; -extern crate vhost_user_backend; - use block_util::{build_disk_image_id, Request, VirtioBlockConfig}; use libc::EFD_NONBLOCK; use log::*; diff --git a/vhost_user_net/src/lib.rs b/vhost_user_net/src/lib.rs index 80716059b..bc2ce662d 100644 --- a/vhost_user_net/src/lib.rs +++ b/vhost_user_net/src/lib.rs @@ -6,11 +6,6 @@ // // SPDX-License-Identifier: (Apache-2.0 AND BSD-3-Clause) -extern crate log; -extern crate net_util; -extern crate vhost; -extern crate vhost_user_backend; - use libc::{self, EFD_NONBLOCK}; use log::*; use net_util::{ diff --git a/vhost_user_net/src/main.rs b/vhost_user_net/src/main.rs index 7d26aeb1c..e5457b388 100644 --- a/vhost_user_net/src/main.rs +++ b/vhost_user_net/src/main.rs @@ -8,7 +8,6 @@ #[macro_use(crate_version, crate_authors)] extern crate clap; -extern crate vhost_user_net; use clap::{App, Arg}; use vhost_user_net::start_net_backend; diff --git a/virtio-devices/src/balloon.rs b/virtio-devices/src/balloon.rs index 6a9db34a7..7d9a71d8e 100644 --- a/virtio-devices/src/balloon.rs +++ b/virtio-devices/src/balloon.rs @@ -17,7 +17,6 @@ use super::{ VirtioCommon, VirtioDevice, VirtioDeviceType, EPOLL_HELPER_EVENT_LAST, VIRTIO_F_VERSION_1, }; use crate::seccomp_filters::{get_seccomp_filter, Thread}; -use crate::vm_memory::GuestMemory; use crate::{VirtioInterrupt, VirtioInterruptType}; use libc::EFD_NONBLOCK; use seccomp::{SeccompAction, SeccompFilter}; @@ -29,6 +28,7 @@ use std::sync::atomic::{AtomicBool, AtomicU64, Ordering}; use std::sync::mpsc; use std::sync::{Arc, Barrier, Mutex}; use std::thread; +use vm_memory::GuestMemory; use vm_memory::{ Address, ByteValued, Bytes, GuestAddress, GuestAddressSpace, GuestMemoryAtomic, GuestMemoryError, GuestMemoryMmap, diff --git a/virtio-devices/src/lib.rs b/virtio-devices/src/lib.rs index 749e1c2b8..ed31b6c06 100644 --- a/virtio-devices/src/lib.rs +++ b/virtio-devices/src/lib.rs @@ -10,21 +10,12 @@ //! Implements virtio devices, queues, and transport mechanisms. -extern crate arc_swap; -extern crate epoll; #[macro_use] extern crate event_monitor; #[macro_use] extern crate log; -extern crate pci; -extern crate serde; #[macro_use] extern crate serde_derive; -extern crate serde_json; -extern crate vhost; -extern crate virtio_bindings; -extern crate vm_device; -extern crate vm_memory; use std::convert::TryInto; use std::io; diff --git a/virtio-devices/src/transport/pci_common_config.rs b/virtio-devices/src/transport/pci_common_config.rs index 6c9ab2685..d5cec30e0 100644 --- a/virtio-devices/src/transport/pci_common_config.rs +++ b/virtio-devices/src/transport/pci_common_config.rs @@ -5,7 +5,6 @@ // Copyright © 2019 Intel Corporation // // SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause -extern crate byteorder; use crate::{Queue, VirtioDevice}; use byteorder::{ByteOrder, LittleEndian}; diff --git a/virtio-devices/src/transport/pci_device.rs b/virtio-devices/src/transport/pci_device.rs index 01ec03300..50bfc47b8 100644 --- a/virtio-devices/src/transport/pci_device.rs +++ b/virtio-devices/src/transport/pci_device.rs @@ -6,11 +6,6 @@ // // SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause -extern crate pci; -extern crate vm_allocator; -extern crate vm_memory; -extern crate vmm_sys_util; - use super::VirtioPciCommonConfig; use crate::transport::VirtioTransport; use crate::{ diff --git a/virtio-devices/src/vhost_user/mod.rs b/virtio-devices/src/vhost_user/mod.rs index 343a19a39..e29179aaf 100644 --- a/virtio-devices/src/vhost_user/mod.rs +++ b/virtio-devices/src/vhost_user/mod.rs @@ -1,12 +1,6 @@ // Copyright 2019 Intel Corporation. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -extern crate epoll; -extern crate net_util; -extern crate vhost; -extern crate virtio_bindings; -extern crate vm_memory; - use std::io; use vhost::Error as VhostError; use vm_memory::Error as MmapError; diff --git a/vm-allocator/src/lib.rs b/vm-allocator/src/lib.rs index 484b6e338..f7bf5ff22 100644 --- a/vm-allocator/src/lib.rs +++ b/vm-allocator/src/lib.rs @@ -10,9 +10,6 @@ //! Manages system resources that can be allocated to VMs and their devices. -extern crate libc; -extern crate vm_memory; - mod address; mod gsi; mod system; diff --git a/vm-device/src/lib.rs b/vm-device/src/lib.rs index 315f5b04b..77d19b986 100644 --- a/vm-device/src/lib.rs +++ b/vm-device/src/lib.rs @@ -5,7 +5,6 @@ #[macro_use] extern crate serde_derive; -extern crate vm_memory; mod bus; pub mod dma_mapping; diff --git a/vm-migration/src/lib.rs b/vm-migration/src/lib.rs index b233df2c4..994f02b0d 100644 --- a/vm-migration/src/lib.rs +++ b/vm-migration/src/lib.rs @@ -3,11 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause // -extern crate serde; -extern crate thiserror; #[macro_use] extern crate serde_derive; -extern crate vm_memory; use anyhow::anyhow; use serde::{Deserialize, Serialize}; diff --git a/vm-virtio/src/queue.rs b/vm-virtio/src/queue.rs index 353b15bae..9a1801d8e 100644 --- a/vm-virtio/src/queue.rs +++ b/vm-virtio/src/queue.rs @@ -966,8 +966,6 @@ pub mod testing { #[cfg(test)] pub mod tests { - extern crate vm_memory; - use super::testing::*; pub use super::*; use vm_memory::{GuestAddress, GuestMemoryMmap}; diff --git a/vmm/src/api/mod.rs b/vmm/src/api/mod.rs index 79dd26d19..0109a7bf5 100644 --- a/vmm/src/api/mod.rs +++ b/vmm/src/api/mod.rs @@ -28,9 +28,6 @@ //! response channel Receiver. //! 5. The thread handles the response and forwards potential errors. -extern crate vm_device; -extern crate vmm_sys_util; - pub use self::http::start_http_fd_thread; pub use self::http::start_http_path_thread; diff --git a/vmm/src/lib.rs b/vmm/src/lib.rs index 8d7f664d9..12095bd3d 100644 --- a/vmm/src/lib.rs +++ b/vmm/src/lib.rs @@ -3,21 +3,14 @@ // SPDX-License-Identifier: Apache-2.0 // -extern crate anyhow; -extern crate arc_swap; #[macro_use] extern crate event_monitor; -extern crate hypervisor; -extern crate option_parser; #[macro_use] extern crate lazy_static; #[macro_use] extern crate log; -extern crate serde; #[macro_use] extern crate serde_derive; -extern crate serde_json; -extern crate vmm_sys_util; #[cfg(test)] #[macro_use] extern crate credibility; diff --git a/vmm/src/memory_manager.rs b/vmm/src/memory_manager.rs index 8566dca81..a60b3d171 100644 --- a/vmm/src/memory_manager.rs +++ b/vmm/src/memory_manager.rs @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: Apache-2.0 // -extern crate hypervisor; #[cfg(target_arch = "x86_64")] use crate::config::SgxEpcConfig; use crate::config::{HotplugMethod, MemoryConfig, MemoryZoneConfig}; diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index 6b719ec46..4a4297c65 100644 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -11,17 +11,6 @@ // SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause // -extern crate arch; -extern crate devices; -extern crate epoll; -extern crate hypervisor; -extern crate libc; -extern crate linux_loader; -extern crate net_util; -extern crate signal_hook; -extern crate vm_allocator; -extern crate vm_memory; - #[cfg(feature = "acpi")] use crate::config::NumaConfig; use crate::config::{