feat(xen): update xenclient and xenplatform to the latest structure (#433)

This commit is contained in:
Alex Zenla
2024-12-14 18:16:10 -05:00
committed by GitHub
parent f9d4508149
commit 3adf9b5e88
24 changed files with 2152 additions and 1098 deletions

View File

@ -0,0 +1,21 @@
use crate::error::{Error, Result};
pub fn vbd_blkidx_to_disk_name(blkid: u32) -> Result<String> {
let mut name = "xvd".to_string();
let mut suffix = String::new();
let mut n = blkid;
loop {
let c = (n % 26) as u8;
let c = b'a' + c;
let c = char::from_u32(c as u32).ok_or(Error::InvalidBlockIdx)?;
suffix.push(c);
if n >= 26 {
n = (n / 26) - 1;
continue;
} else {
break;
}
}
name.push_str(&suffix.chars().rev().collect::<String>());
Ok(name)
}