use crate::utility::macros::macros::call_function;
use crate::VboxError;
use log::{debug, error};
use vbox_raw::sys_lib::IGuest;
mod implementation;
#[derive(Debug)]
pub struct Guest {
object: *mut IGuest,
}
impl Guest {
pub(crate) fn new(object: *mut IGuest) -> Self {
Self { object }
}
fn release(&self) -> Result<i32, VboxError> {
call_function!(self.object, Release)
}
}
impl Drop for Guest {
fn drop(&mut self) {
match self.release() {
Ok(count) => {
debug!("Guest refcount: {}", count)
}
Err(err) => {
error!("Failed drop Guest. Error: {:?}", err)
}
}
}
}
#[derive(Debug)]
pub struct GuestInternalGetStatistics {
pub cpu_user: u32,
pub cpu_kernel: u32,
pub cpu_idle: u32,
pub mem_total: u32,
pub mem_free: u32,
pub mem_balloon: u32,
pub mem_shared: u32,
pub mem_cache: u32,
pub paged_total: u32,
pub mem_alloc_total: u32,
pub mem_free_total: u32,
pub mem_balloon_total: u32,
pub mem_shared_total: u32,
}