vsock: reorder use declarations

Following the other crates, reorder the use declaration in 3 groups:
    1. standard library
    2. external crates
    3. local crates

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
This commit is contained in:
Stefano Garzarella 2022-10-12 13:51:09 +02:00
parent a76f9ebe16
commit e6a85ffd5e
7 changed files with 49 additions and 37 deletions

View File

@ -8,17 +8,19 @@ mod vhu_vsock;
mod vhu_vsock_thread;
mod vsock_conn;
use clap::Parser;
use log::{info, warn};
use std::{
convert::TryFrom,
sync::{Arc, RwLock},
};
use clap::Parser;
use log::{info, warn};
use vhost::{vhost_user, vhost_user::Listener};
use vhost_user_backend::VhostUserDaemon;
use vhu_vsock::{Error, Result, VhostUserVsockBackend, VsockConfig};
use vm_memory::{GuestMemoryAtomic, GuestMemoryMmap};
use crate::vhu_vsock::{Error, Result, VhostUserVsockBackend, VsockConfig};
#[derive(Parser, Debug)]
#[clap(version, about, long_about = None)]
struct VsockArgs {

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0 or BSD-3-Clause
use super::rxops::RxOps;
use crate::rxops::RxOps;
#[derive(Debug, Eq, PartialEq)]
pub(crate) struct RxQueue {

View File

@ -1,6 +1,18 @@
// SPDX-License-Identifier: Apache-2.0 or BSD-3-Clause
use super::{
use std::{
collections::{HashMap, HashSet, VecDeque},
os::unix::{
net::UnixStream,
prelude::{AsRawFd, FromRawFd, RawFd},
},
};
use log::{info, warn};
use virtio_vsock::packet::VsockPacket;
use vm_memory::bitmap::BitmapSlice;
use crate::{
rxops::*,
vhu_vsock::{
ConnMapKey, Error, Result, VSOCK_HOST_CID, VSOCK_OP_REQUEST, VSOCK_OP_RST,
@ -9,16 +21,6 @@ use super::{
vhu_vsock_thread::VhostUserVsockThread,
vsock_conn::*,
};
use log::{info, warn};
use std::{
collections::{HashMap, HashSet, VecDeque},
os::unix::{
net::UnixStream,
prelude::{AsRawFd, FromRawFd, RawFd},
},
};
use virtio_vsock::packet::VsockPacket;
use vm_memory::bitmap::BitmapSlice;
pub(crate) struct VsockThreadBackend {
/// Map of ConnMapKey objects indexed by raw file descriptors.

View File

@ -1,9 +1,11 @@
// SPDX-License-Identifier: Apache-2.0 or BSD-3-Clause
use super::vhu_vsock::{Error, Result, CONN_TX_BUF_SIZE};
use std::{io::Write, num::Wrapping};
use vm_memory::{bitmap::BitmapSlice, VolatileSlice};
use crate::vhu_vsock::{Error, Result, CONN_TX_BUF_SIZE};
#[derive(Debug)]
pub(crate) struct LocalTxBuf {
/// Buffer holding data to be forwarded to a host-side application

View File

@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0 or BSD-3-Clause
use super::vhu_vsock_thread::*;
use std::{io, result, sync::Mutex, u16, u32, u64, u8};
use thiserror::Error as ThisError;
use vhost::vhost_user::message::{VhostUserProtocolFeatures, VhostUserVirtioFeatures};
use vhost_user_backend::{VhostUserBackendMut, VringRwLock};
@ -15,6 +15,8 @@ use vmm_sys_util::{
eventfd::{EventFd, EFD_NONBLOCK},
};
use crate::vhu_vsock_thread::*;
const NUM_QUEUES: usize = 2;
const QUEUE_SIZE: usize = 256;

View File

@ -1,16 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 or BSD-3-Clause
use super::{
rxops::*,
thread_backend::*,
vhu_vsock::{
ConnMapKey, Error, Result, VhostUserVsockBackend, BACKEND_EVENT, CONN_TX_BUF_SIZE,
VSOCK_HOST_CID,
},
vsock_conn::*,
};
use futures::executor::{ThreadPool, ThreadPoolBuilder};
use log::warn;
use std::{
fs::File,
io,
@ -23,12 +12,25 @@ use std::{
},
sync::{Arc, RwLock},
};
use futures::executor::{ThreadPool, ThreadPoolBuilder};
use log::warn;
use vhost_user_backend::{VringEpollHandler, VringRwLock, VringT};
use virtio_queue::QueueOwnedT;
use virtio_vsock::packet::{VsockPacket, PKT_HEADER_SIZE};
use vm_memory::{GuestAddressSpace, GuestMemoryAtomic, GuestMemoryMmap};
use vmm_sys_util::epoll::EventSet;
use crate::{
rxops::*,
thread_backend::*,
vhu_vsock::{
ConnMapKey, Error, Result, VhostUserVsockBackend, BACKEND_EVENT, CONN_TX_BUF_SIZE,
VSOCK_HOST_CID,
},
vsock_conn::*,
};
type ArcVhostBknd = Arc<RwLock<VhostUserVsockBackend>>;
pub(crate) struct VhostUserVsockThread {

View File

@ -1,6 +1,16 @@
// SPDX-License-Identifier: Apache-2.0 or BSD-3-Clause
use super::{
use std::{
io::{ErrorKind, Read, Write},
num::Wrapping,
os::unix::prelude::{AsRawFd, RawFd},
};
use log::info;
use virtio_vsock::packet::{VsockPacket, PKT_HEADER_SIZE};
use vm_memory::{bitmap::BitmapSlice, Bytes, VolatileSlice};
use crate::{
rxops::*,
rxqueue::*,
txbuf::*,
@ -11,14 +21,6 @@ use super::{
},
vhu_vsock_thread::VhostUserVsockThread,
};
use log::info;
use std::{
io::{ErrorKind, Read, Write},
num::Wrapping,
os::unix::prelude::{AsRawFd, RawFd},
};
use virtio_vsock::packet::{VsockPacket, PKT_HEADER_SIZE};
use vm_memory::{bitmap::BitmapSlice, Bytes, VolatileSlice};
#[derive(Debug)]
pub(crate) struct VsockConnection<S> {