MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / tap_device_name

Function tap_device_name

crates/openshell-driver-vm/src/gpu.rs:253–262  ·  view source on GitHub ↗

TAP device name from sandbox ID (fits `IFNAMSIZ=16`).

(sandbox_id: &str)

Source from the content-addressed store, hash-verified

251
252/// TAP device name from sandbox ID (fits `IFNAMSIZ=16`).
253pub fn tap_device_name(sandbox_id: &str) -> String {
254 let mut end = sandbox_id.len().min(8);
255 // Walk back to a UTF-8 char boundary (str::floor_char_boundary requires
256 // Rust 1.91 — we still build on older toolchains).
257 while end > 0 && !sandbox_id.is_char_boundary(end) {
258 end -= 1;
259 }
260 let prefix = &sandbox_id[..end];
261 format!("vmtap-{prefix}")
262}
263
264#[cfg(test)]
265mod tests {

Callers 3

build_vm_launch_planMethod · 0.85

Calls 1

lenMethod · 0.80

Tested by 1