diff options
author | Stephen Barber <smbarber@chromium.org> | 2019-10-25 13:13:18 +0200 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-05 19:49:40 +0000 |
commit | 6cb2a930b54fd091e0e13d1e12389cc8165f5a00 (patch) | |
tree | 5431678b0abd6818eca3086fe5e18e45a1cb198c /net_util | |
parent | 34fa09918f206c92e5d3a1b3b0d2a7718e2a45d7 (diff) | |
download | crosvm-6cb2a930b54fd091e0e13d1e12389cc8165f5a00.tar crosvm-6cb2a930b54fd091e0e13d1e12389cc8165f5a00.tar.gz crosvm-6cb2a930b54fd091e0e13d1e12389cc8165f5a00.tar.bz2 crosvm-6cb2a930b54fd091e0e13d1e12389cc8165f5a00.tar.lz crosvm-6cb2a930b54fd091e0e13d1e12389cc8165f5a00.tar.xz crosvm-6cb2a930b54fd091e0e13d1e12389cc8165f5a00.tar.zst crosvm-6cb2a930b54fd091e0e13d1e12389cc8165f5a00.zip |
net_util: impl FileReadWriteVolatile for Tap
BUG=chromium:753630 TEST=cargo build Change-Id: I55e0d47c4afcb1bf01f4d7f738bda09022956898 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1881418 Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Stephen Barber <smbarber@chromium.org> Commit-Queue: Stephen Barber <smbarber@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Diffstat (limited to 'net_util')
-rw-r--r-- | net_util/Cargo.toml | 1 | ||||
-rw-r--r-- | net_util/src/lib.rs | 8 |
2 files changed, 7 insertions, 2 deletions
diff --git a/net_util/Cargo.toml b/net_util/Cargo.toml index bfa3bc8..c7f61b1 100644 --- a/net_util/Cargo.toml +++ b/net_util/Cargo.toml @@ -6,5 +6,6 @@ edition = "2018" [dependencies] libc = "*" +data_model = { path = "../data_model" } net_sys = { path = "../net_sys" } sys_util = { path = "../sys_util" } diff --git a/net_util/src/lib.rs b/net_util/src/lib.rs index 9508dcc..0243552 100644 --- a/net_util/src/lib.rs +++ b/net_util/src/lib.rs @@ -15,7 +15,8 @@ use std::str::FromStr; use libc::EPERM; use sys_util::Error as SysError; -use sys_util::{ioctl_with_mut_ref, ioctl_with_ref, ioctl_with_val}; +use sys_util::FileReadWriteVolatile; +use sys_util::{ioctl_with_mut_ref, ioctl_with_ref, ioctl_with_val, volatile_impl}; #[derive(Debug)] pub enum Error { @@ -189,7 +190,7 @@ impl Tap { } } -pub trait TapT: Read + Write + AsRawFd + Send + Sized { +pub trait TapT: FileReadWriteVolatile + Read + Write + AsRawFd + Send + Sized { /// Create a new tap interface. Set the `vnet_hdr` flag to true to allow offloading on this tap, /// which will add an extra 12 byte virtio net header to incoming frames. Offloading cannot /// be used if `vnet_hdr` is false. @@ -484,6 +485,8 @@ impl AsRawFd for Tap { } } +volatile_impl!(Tap); + pub mod fakes { use super::*; use std::fs::remove_file; @@ -580,6 +583,7 @@ pub mod fakes { self.tap_file.as_raw_fd() } } + volatile_impl!(FakeTap); } #[cfg(test)] |