misc: virtio-devices: drop extern crate, use modern rust
This commit is part of a series of similar commits. Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de> On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
parent
adb7cfd72c
commit
2157f1a1f2
24 changed files with 43 additions and 9 deletions
|
|
@ -22,6 +22,8 @@ use std::sync::atomic::AtomicBool;
|
|||
use std::sync::{Arc, Barrier};
|
||||
|
||||
use anyhow::anyhow;
|
||||
use event_monitor::event;
|
||||
use log::{error, info};
|
||||
use seccompiler::SeccompAction;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use thiserror::Error;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ use block::fcntl::{LockError, LockGranularity, LockType, get_lock_state};
|
|||
use block::{
|
||||
ExecuteAsync, ExecuteError, Request, RequestType, VirtioBlockConfig, build_serial, fcntl,
|
||||
};
|
||||
use event_monitor::event;
|
||||
use log::{debug, error, info, warn};
|
||||
use rate_limiter::TokenType;
|
||||
use rate_limiter::group::{RateLimiterGroup, RateLimiterGroupHandle};
|
||||
use seccompiler::SeccompAction;
|
||||
|
|
@ -795,7 +797,7 @@ impl Block {
|
|||
false => LockType::Write,
|
||||
};
|
||||
let granularity = self.lock_granularity();
|
||||
log::debug!(
|
||||
debug!(
|
||||
"Attempting to acquire {lock_type:?} lock for disk image: id={},path={},granularity={granularity:?}",
|
||||
self.id,
|
||||
self.disk_path.display()
|
||||
|
|
@ -806,9 +808,9 @@ impl Block {
|
|||
// Don't propagate the error to the outside, as it is not useful at all. Instead,
|
||||
// we try to log additional help to the user.
|
||||
if let Ok(current_lock) = current_lock {
|
||||
log::error!("Can't get {lock_type:?} lock for {} as there is already a {current_lock:?} lock", self.disk_path.display());
|
||||
error!("Can't get {lock_type:?} lock for {} as there is already a {current_lock:?} lock", self.disk_path.display());
|
||||
} else {
|
||||
log::error!("Can't get {lock_type:?} lock for {}, but also can't determine the current lock state", self.disk_path.display());
|
||||
error!("Can't get {lock_type:?} lock for {}, but also can't determine the current lock state", self.disk_path.display());
|
||||
}
|
||||
Error::LockDiskImage {
|
||||
path: self.disk_path.clone(),
|
||||
|
|
@ -816,7 +818,7 @@ impl Block {
|
|||
lock_type,
|
||||
}
|
||||
})?;
|
||||
log::info!(
|
||||
info!(
|
||||
"Acquired {lock_type:?} lock for disk image id={},path={}",
|
||||
self.id,
|
||||
self.disk_path.display()
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@ use std::sync::{Arc, Barrier, Mutex};
|
|||
use std::{cmp, io, result};
|
||||
|
||||
use anyhow::anyhow;
|
||||
use event_monitor::event;
|
||||
use libc::{EFD_NONBLOCK, TIOCGWINSZ};
|
||||
use log::{error, info};
|
||||
use seccompiler::SeccompAction;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serial_buffer::SerialBuffer;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use std::sync::{Arc, Barrier};
|
|||
use std::thread;
|
||||
|
||||
use libc::EFD_NONBLOCK;
|
||||
use log::{error, info, warn};
|
||||
use virtio_queue::Queue;
|
||||
use vm_device::UserspaceMapping;
|
||||
use vm_memory::{GuestAddress, GuestMemoryAtomic};
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
|
|||
use std::sync::{Arc, Barrier};
|
||||
use std::thread;
|
||||
|
||||
use log::info;
|
||||
use thiserror::Error;
|
||||
use vmm_sys_util::eventfd::EventFd;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ use std::sync::{Arc, Barrier, Mutex, RwLock};
|
|||
use std::{io, result};
|
||||
|
||||
use anyhow::anyhow;
|
||||
use event_monitor::event;
|
||||
use log::{debug, error, info};
|
||||
use seccompiler::SeccompAction;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use thiserror::Error;
|
||||
|
|
|
|||
|
|
@ -10,11 +10,6 @@
|
|||
|
||||
//! Implements virtio devices, queues, and transport mechanisms.
|
||||
|
||||
#[macro_use]
|
||||
extern crate event_monitor;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
use std::io;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ use std::sync::{Arc, Barrier, Mutex, mpsc};
|
|||
use std::{io, result};
|
||||
|
||||
use anyhow::anyhow;
|
||||
use event_monitor::event;
|
||||
use log::{error, info};
|
||||
use seccompiler::SeccompAction;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use thiserror::Error;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ use std::sync::{Arc, Barrier};
|
|||
use std::{result, thread};
|
||||
|
||||
use anyhow::anyhow;
|
||||
use event_monitor::event;
|
||||
use log::{debug, error, info};
|
||||
#[cfg(not(fuzzing))]
|
||||
use net_util::virtio_features_to_tap_offload;
|
||||
use net_util::{
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ use std::sync::{Arc, Barrier};
|
|||
use std::{io, result};
|
||||
|
||||
use anyhow::anyhow;
|
||||
use event_monitor::event;
|
||||
use log::{error, info};
|
||||
use seccompiler::SeccompAction;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use thiserror::Error;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ use std::sync::{Arc, Barrier};
|
|||
use std::{io, result};
|
||||
|
||||
use anyhow::anyhow;
|
||||
use event_monitor::event;
|
||||
use log::{error, info};
|
||||
use seccompiler::SeccompAction;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use thiserror::Error;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
use std::panic::AssertUnwindSafe;
|
||||
use std::thread::{self, JoinHandle};
|
||||
|
||||
use log::error;
|
||||
use seccompiler::{SeccompAction, apply_filter};
|
||||
use vmm_sys_util::eventfd::EventFd;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use std::sync::atomic::{AtomicU16, Ordering};
|
|||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use byteorder::{ByteOrder, LittleEndian};
|
||||
use log::{debug, error, warn};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use virtio_queue::{Queue, QueueT};
|
||||
use vm_migration::{MigratableError, Pausable, Snapshot, Snapshottable};
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ use std::sync::{Arc, Barrier, Mutex};
|
|||
|
||||
use anyhow::anyhow;
|
||||
use libc::EFD_NONBLOCK;
|
||||
use log::{error, info};
|
||||
use pci::{
|
||||
BarReprogrammingParams, MsixCap, MsixConfig, PciBarConfiguration, PciBarRegionType,
|
||||
PciCapability, PciCapabilityId, PciClassCode, PciConfiguration, PciDevice, PciDeviceError,
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ use std::sync::{Arc, Mutex};
|
|||
use std::{io, result};
|
||||
|
||||
use anyhow::anyhow;
|
||||
use event_monitor::event;
|
||||
use log::{debug, error, info};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use thiserror::Error;
|
||||
use vhost::vdpa::{VhostVdpa, VhostVdpaIovaRange};
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ use std::sync::{Arc, Barrier, Mutex};
|
|||
use std::{mem, result, thread};
|
||||
|
||||
use block::VirtioBlockConfig;
|
||||
use event_monitor::event;
|
||||
use log::{error, info};
|
||||
use seccompiler::SeccompAction;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use vhost::vhost_user::message::{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ use std::sync::atomic::AtomicBool;
|
|||
use std::sync::{Arc, Barrier, Mutex};
|
||||
use std::{result, thread};
|
||||
|
||||
use event_monitor::event;
|
||||
use log::{error, info};
|
||||
use seccompiler::SeccompAction;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::{Bytes, serde_as};
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use std::sync::atomic::AtomicBool;
|
|||
use std::sync::{Arc, Barrier, Mutex};
|
||||
|
||||
use anyhow::anyhow;
|
||||
use log::error;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use thiserror::Error;
|
||||
use vhost::Error as VhostError;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ use std::sync::atomic::AtomicBool;
|
|||
use std::sync::{Arc, Barrier, Mutex};
|
||||
use std::{result, thread};
|
||||
|
||||
use event_monitor::event;
|
||||
use log::{error, info};
|
||||
use net_util::{CtrlQueue, MacAddr, VirtioNetConfig, build_net_config_space};
|
||||
use seccompiler::SeccompAction;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use std::sync::atomic::Ordering;
|
|||
use std::thread::sleep;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use log::{error, info};
|
||||
use vhost::vhost_kern::vhost_binding::{VHOST_F_LOG_ALL, VHOST_VRING_F_LOG};
|
||||
use vhost::vhost_user::message::{
|
||||
VhostUserHeaderFlag, VhostUserInflight, VhostUserProtocolFeatures, VhostUserVirtioFeatures,
|
||||
|
|
|
|||
|
|
@ -85,6 +85,8 @@ use std::num::Wrapping;
|
|||
use std::os::unix::io::{AsRawFd, RawFd};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use log::{debug, error, info, warn};
|
||||
|
||||
use super::super::defs::uapi;
|
||||
use super::super::packet::VsockPacket;
|
||||
use super::super::{Result as VsockResult, VsockChannel, VsockEpollListener, VsockError};
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ use std::{io, result};
|
|||
|
||||
use anyhow::anyhow;
|
||||
use byteorder::{ByteOrder, LittleEndian};
|
||||
use event_monitor::event;
|
||||
use log::{debug, error, info, warn};
|
||||
use seccompiler::SeccompAction;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use virtio_queue::{Queue, QueueOwnedT, QueueT};
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ use std::io::{self, ErrorKind, Read};
|
|||
use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};
|
||||
use std::os::unix::net::{UnixListener, UnixStream};
|
||||
|
||||
use log::{debug, error, info, warn};
|
||||
|
||||
use super::super::csm::ConnState;
|
||||
use super::super::defs::uapi;
|
||||
use super::super::packet::VsockPacket;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ use std::sync::{Arc, Barrier, Mutex};
|
|||
use std::time::Instant;
|
||||
|
||||
use anyhow::anyhow;
|
||||
use event_monitor::event;
|
||||
use log::{error, info};
|
||||
use seccompiler::SeccompAction;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use thiserror::Error;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue