]> xenbits.xensource.com Git - xen-guest-agent.git/commitdiff
Drop unix_helper
authorYann Dirson <yann.dirson@vates.fr>
Wed, 22 Nov 2023 16:11:57 +0000 (17:11 +0100)
committerYann Dirson <yann.dirson@vates.fr>
Fri, 8 Dec 2023 09:59:46 +0000 (10:59 +0100)
We finally don't have a need for separately querying for an interface name
from its index, since we don't need to fetch this information every time a
packet arrives, netlink already gives us everything we need.

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
src/main.rs
src/unix_helpers.rs [deleted file]

index 5adf922bab7dcd0b6e07a8a1aac97e04dee43e9e..58ec8668a4020b748ebb81d6a0ba2c4211c61ce9 100644 (file)
@@ -1,6 +1,4 @@
 mod datastructs;
-#[cfg(unix)]
-mod unix_helpers;
 
 #[cfg_attr(feature = "xenstore", path = "publisher_xenstore.rs")]
 mod publisher;
diff --git a/src/unix_helpers.rs b/src/unix_helpers.rs
deleted file mode 100644 (file)
index 4ebe760..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-use std::ffi::CStr;
-
-// just wraps libc's if_indextoname() - likely suboptimal
-pub fn interface_name(index: u32) -> String {
-    let mut c_buf: [libc::c_char; libc::IF_NAMESIZE] = [0; libc::IF_NAMESIZE];
-    let ret = unsafe { libc::if_indextoname(index, c_buf.as_mut_ptr()) };
-    if ret.is_null() {
-        return "".to_string();
-    }
-    let c_str: &CStr = unsafe { CStr::from_ptr(c_buf.as_ptr()) };
-
-    c_str.to_str().unwrap().to_owned()
-}