mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
net_util: tap: remove needless copy
One can call `to_vec()` anyway if one needs an owned copy. This change further helps to prevent needless copies in upcoming changes. Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de> On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
committed by
Rob Bradford
parent
3864230430
commit
b8be33dff7
@@ -135,7 +135,7 @@ pub fn open_tap(
|
||||
// same device.
|
||||
tap = open_tap_rx_q_0(if_name, ip_addr, netmask, host_mac, mtu, num_rx_q, flags)?;
|
||||
// Set the name of the tap device we open in subsequent iterations.
|
||||
ifname = String::from_utf8(tap.get_if_name()).unwrap();
|
||||
ifname = String::from_utf8(tap.get_if_name().to_vec()).unwrap();
|
||||
} else {
|
||||
tap = Tap::open_named(ifname.as_str(), num_rx_q, flags).map_err(Error::TapOpen)?;
|
||||
|
||||
|
||||
@@ -481,8 +481,8 @@ impl Tap {
|
||||
ifreq
|
||||
}
|
||||
|
||||
pub fn get_if_name(&self) -> Vec<u8> {
|
||||
self.if_name.clone()
|
||||
pub fn get_if_name(&self) -> &[u8] {
|
||||
&self.if_name
|
||||
}
|
||||
|
||||
#[cfg(fuzzing)]
|
||||
|
||||
Reference in New Issue
Block a user