Skip to content

Commit

Permalink
derive debug for all exported structs & enums
Browse files Browse the repository at this point in the history
This is helping with debugging in the VMM. Because the exported
structures from here are not deriving Debug, deriving it in the VMM is
cumbersome.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
  • Loading branch information
andreeaflorescu authored and lauralt committed Dec 14, 2021
1 parent d22ef1f commit d12f577
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion coverage_config_x86_64.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"coverage_score": 87.9,
"coverage_score": 85.9,
"exclude_path": "",
"crate_features": ""
}
1 change: 1 addition & 0 deletions src/ioctls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub type Result<T> = std::result::Result<T, errno::Error>;
///
/// The wrapper is needed for sending the pointer to `kvm_run` between
/// threads as raw pointers do not implement `Send` and `Sync`.
#[derive(Debug)]
pub struct KvmRunWrapper {
kvm_run_ptr: *mut u8,
// This field is need so we can `munmap` the memory mapped to hold `kvm_run`.
Expand Down
1 change: 1 addition & 0 deletions src/ioctls/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use vmm_sys_util::ioctl::ioctl_with_mut_ptr;
use vmm_sys_util::ioctl::{ioctl, ioctl_with_val};

/// Wrapper over KVM system ioctls.
#[derive(Debug)]
pub struct Kvm {
kvm: File,
}
Expand Down
1 change: 1 addition & 0 deletions src/ioctls/vcpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ pub enum VcpuExit<'a> {
}

/// Wrapper over KVM vCPU ioctls.
#[derive(Debug)]
pub struct VcpuFd {
vcpu: File,
kvm_run_ptr: KvmRunWrapper,
Expand Down
3 changes: 3 additions & 0 deletions src/ioctls/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use vmm_sys_util::ioctl::{ioctl, ioctl_with_mut_ref, ioctl_with_ref, ioctl_with_
///
/// The `IoEventAddress` is used for specifying the type when registering an event
/// in [register_ioevent](struct.VmFd.html#method.register_ioevent).
#[derive(Debug)]
pub enum IoEventAddress {
/// Representation of an programmable I/O address.
Pio(u64),
Expand All @@ -41,6 +42,7 @@ pub enum IoEventAddress {
/// [`register_ioevent`](struct.VmFd.html#method.register_ioevent)
/// to disable filtering of events based on the datamatch flag. For details check the
/// [KVM API documentation](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt).
#[derive(Debug)]
pub struct NoDatamatch;
impl From<NoDatamatch> for u64 {
fn from(_: NoDatamatch) -> u64 {
Expand All @@ -49,6 +51,7 @@ impl From<NoDatamatch> for u64 {
}

/// Wrapper over KVM VM ioctls.
#[derive(Debug)]
pub struct VmFd {
vm: File,
run_size: usize,
Expand Down

0 comments on commit d12f577

Please sign in to comment.