mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-03 13:11:31 +00:00
introduce xencl for high-level interaction with xen
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
use crate::bus::{XsdBusError, XsdSocket};
|
||||
use crate::sys::{
|
||||
XSD_DIRECTORY, XSD_MKDIR, XSD_READ, XSD_RM, XSD_TRANSACTION_END, XSD_TRANSACTION_START,
|
||||
XSD_WRITE,
|
||||
XSD_DIRECTORY, XSD_GET_DOMAIN_PATH, XSD_MKDIR, XSD_READ, XSD_RM, XSD_TRANSACTION_END,
|
||||
XSD_TRANSACTION_START, XSD_WRITE,
|
||||
};
|
||||
use std::ffi::CString;
|
||||
|
||||
@ -18,7 +18,7 @@ pub trait XsdInterface {
|
||||
}
|
||||
|
||||
impl XsdClient {
|
||||
pub fn new() -> Result<XsdClient, XsdBusError> {
|
||||
pub fn open() -> Result<XsdClient, XsdBusError> {
|
||||
let socket = XsdSocket::dial()?;
|
||||
Ok(XsdClient { socket })
|
||||
}
|
||||
@ -55,6 +55,13 @@ impl XsdClient {
|
||||
let tx = response.parse_string()?.parse::<u32>()?;
|
||||
Ok(XsdTransaction { client: self, tx })
|
||||
}
|
||||
|
||||
pub fn get_domain_path(&mut self, domid: u32) -> Result<String, XsdBusError> {
|
||||
let response =
|
||||
self.socket
|
||||
.send_single(0, XSD_GET_DOMAIN_PATH, domid.to_string().as_str())?;
|
||||
response.parse_string()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct XsdTransaction<'a> {
|
||||
|
Reference in New Issue
Block a user