Skip to content

Commit e857141

Browse files
committed
call it passt
Signed-off-by: aerosouund <aerosound161@gmail.com>
1 parent d395de6 commit e857141

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/vmm/src/devices/virtio/net/device.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use crate::devices::virtio::iovec::{
3030
IoVecBuffer, IoVecBufferMut, IoVecError, ParsedDescriptorChain,
3131
};
3232
use crate::devices::virtio::net::metrics::{NetDeviceMetrics, NetMetricsPerDevice};
33-
use crate::devices::virtio::net::tap::{NetDevBackend, SocketBacked, Tap};
33+
use crate::devices::virtio::net::tap::{NetDevBackend, PasstBackend, Tap};
3434
use crate::devices::virtio::net::{
3535
MAX_BUFFER_SIZE, NET_QUEUE_SIZES, NetError, NetQueue, RX_INDEX, TX_INDEX, generated,
3636
};
@@ -65,8 +65,8 @@ const fn frame_hdr_len() -> usize {
6565
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)]
6666
#[serde(rename_all = "snake_case")]
6767
pub enum NetDevBackendType {
68-
Socket(String), // the string denotes the socket path
69-
Tap(String), // denotes the tap device name
68+
Passt(String), // the string denotes the socket path
69+
Tap(String), // denotes the tap device name
7070
}
7171

7272
// Frames being sent/received through the network device model have a VNET header. This
@@ -342,9 +342,9 @@ impl Net {
342342
let vnet_hdr_size = i32::try_from(vnet_hdr_len()).unwrap();
343343
let backend: Box<dyn NetDevBackend> = match backend_type {
344344
// ammar: use something other than io error as the return of socket backend creation
345-
NetDevBackendType::Socket(path) => {
345+
NetDevBackendType::Passt(path) => {
346346
// id is passed as the socket path in the case of socket backend
347-
Box::new(SocketBacked::new(path).map_err(|_| NetError::SocketOpen())?)
347+
Box::new(PasstBackend::new(path).map_err(|_| NetError::SocketOpen())?)
348348
}
349349
NetDevBackendType::Tap(tap_if_name) => {
350350
let mut tap = Tap::open_named(&tap_if_name).map_err(NetError::TapOpen)?;

src/vmm/src/devices/virtio/net/tap.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,32 +138,32 @@ pub trait NetDevBackend: Debug + Send + Sync + AsRawFd {
138138
}
139139

140140
#[derive(Debug)]
141-
pub struct SocketBacked {
141+
pub struct PasstBackend {
142142
fd: UnixStream,
143143
hdr_size: c_int,
144144
path: PathBuf,
145145
}
146146

147-
impl SocketBacked {
147+
impl PasstBackend {
148148
pub fn new(path: String) -> Result<Self, IoError> {
149149
// open a socket and set its path to path
150150
let stream = UnixStream::connect(path.clone())?;
151151
stream.set_nonblocking(true)?;
152-
Ok(SocketBacked {
152+
Ok(PasstBackend {
153153
fd: stream,
154154
hdr_size: 0,
155155
path: PathBuf::from(&path),
156156
})
157157
}
158158
}
159159

160-
impl AsRawFd for SocketBacked {
160+
impl AsRawFd for PasstBackend {
161161
fn as_raw_fd(&self) -> RawFd {
162162
self.fd.as_raw_fd()
163163
}
164164
}
165165

166-
impl NetDevBackend for SocketBacked {
166+
impl NetDevBackend for PasstBackend {
167167
fn read_iovec(&mut self, buffer: &mut [libc::iovec]) -> Result<usize, IoError> {
168168
let iov = buffer.as_mut_ptr();
169169

@@ -240,7 +240,7 @@ impl NetDevBackend for SocketBacked {
240240
}
241241

242242
fn save(&self) -> NetDevBackendType {
243-
NetDevBackendType::Socket(self.path.to_str().unwrap().to_string())
243+
NetDevBackendType::Passt(self.path.to_str().unwrap().to_string())
244244
}
245245
fn set_offload(&self, flags: c_uint) -> Result<(), TapError> {
246246
panic!(

0 commit comments

Comments
 (0)