MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / new

Method new

vhost_user_net/src/lib.rs:86–106  ·  view source on GitHub ↗

Create a new virtio network device with the given TAP interface.

(tap: Tap)

Source from the content-addressed store, hash-verified

84impl VhostUserNetThread {
85 /// Create a new virtio network device with the given TAP interface.
86 fn new(tap: Tap) -> Result<Self> {
87 Ok(VhostUserNetThread {
88 kill_evt: EventFd::new(EFD_NONBLOCK).map_err(Error::CreateKillEventFd)?,
89 net: NetQueuePair {
90 tap_for_write_epoll: tap.clone(),
91 tap,
92 rx: RxVirtio::new(),
93 tx: TxVirtio::new(),
94 rx_tap_listening: false,
95 tx_tap_listening: false,
96 epoll_fd: None,
97 counters: NetCounters::default(),
98 tap_rx_event_id: 3,
99 tap_tx_event_id: 4,
100 rx_desc_avail: false,
101 rx_rate_limiter: None,
102 tx_rate_limiter: None,
103 access_platform: None,
104 },
105 })
106 }
107
108 pub fn set_epoll_fd(&mut self, fd: RawFd) {
109 self.net.epoll_fd = Some(fd);

Callers

nothing calls this directly

Calls 4

newFunction · 0.85
open_tapFunction · 0.85
cloneMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected