Skip to content

Commit

Permalink
Made multiple uneccessary pub items private
Browse files Browse the repository at this point in the history
  • Loading branch information
jounathaen committed Jan 28, 2025
1 parent b1a1600 commit 96d9b54
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 22 deletions.
14 changes: 6 additions & 8 deletions src/arch/x86_64/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
pub mod paging;
pub mod registers;
mod paging;
pub(crate) mod registers;

use paging::initialize_pagetables;
use uhyve_interface::{GuestPhysAddr, GuestVirtAddr};
use x86_64::structures::paging::{
page_table::{FrameError, PageTableEntry},
PageTable, PageTableIndex,
};

use crate::{arch::paging::initialize_pagetables, mem::MmapMemory, paging::PagetableError};
use crate::{mem::MmapMemory, paging::PagetableError};

pub const RAM_START: GuestPhysAddr = GuestPhysAddr::new(0x00);

Expand Down Expand Up @@ -62,10 +63,7 @@ mod tests {
use x86_64::structures::paging::PageTableFlags;

use super::*;
use crate::{
arch::paging::MIN_PHYSMEM_SIZE,
consts::{BOOT_PDE, BOOT_PDPTE, BOOT_PML4},
};
use crate::consts::{BOOT_PDE, BOOT_PDPTE, BOOT_PML4};

#[test]
fn test_virt_to_phys() {
Expand All @@ -76,7 +74,7 @@ mod tests {

let mem = MmapMemory::new(
0,
align_up!(MIN_PHYSMEM_SIZE * 2, 0x20_0000),
align_up!(paging::MIN_PHYSMEM_SIZE * 2, 0x20_0000),
GuestPhysAddr::zero(),
true,
true,
Expand Down
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ mod fdt;
#[cfg(target_os = "linux")]
pub mod linux;
#[cfg(target_os = "linux")]
pub use linux as os;
use linux as os;
#[cfg(target_os = "macos")]
pub mod macos;
#[cfg(target_os = "macos")]
pub use macos as os;
use macos as os;
mod hypercall;
mod isolation;
pub mod mem;
pub mod paging;
pub(crate) mod paging;
pub mod params;
mod serial;
pub mod stats;
mod vcpu;
pub mod virtio;
pub mod virtqueue;
mod virtio;
mod virtqueue;
pub mod vm;

pub use arch::*;
Expand Down
4 changes: 2 additions & 2 deletions src/linux/gdb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use crate::{
HypervisorError, HypervisorResult,
};

pub struct GdbUhyve {
pub(crate) struct GdbUhyve {
pub(crate) vm: UhyveVm<KvmVm>,
hw_breakpoints: HwBreakpoints,
sw_breakpoints: SwBreakpoints,
Expand Down Expand Up @@ -191,7 +191,7 @@ impl target::ext::base::singlethread::SingleThreadSingleStep for GdbUhyve {
}
}

pub enum UhyveGdbEventLoop {}
pub(crate) enum UhyveGdbEventLoop {}

impl run_blocking::BlockingEventLoop for UhyveGdbEventLoop {
type Target = GdbUhyve;
Expand Down
4 changes: 2 additions & 2 deletions src/linux/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#[cfg(target_arch = "x86_64")]
pub mod x86_64;

pub mod gdb;
pub(crate) mod gdb;

pub type DebugExitInfo = kvm_bindings::kvm_debug_exit_arch;
pub(crate) type DebugExitInfo = kvm_bindings::kvm_debug_exit_arch;

use std::{
io,
Expand Down
4 changes: 2 additions & 2 deletions src/linux/x86_64/kvm_cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,11 @@ impl KvmCpu {
println!("{name} {seg:?}");
}

pub fn get_vcpu(&self) -> &VcpuFd {
pub(crate) fn get_vcpu(&self) -> &VcpuFd {
&self.vcpu
}

pub fn get_vcpu_mut(&mut self) -> &mut VcpuFd {
pub(crate) fn get_vcpu_mut(&mut self) -> &mut VcpuFd {
&mut self.vcpu
}

Expand Down
2 changes: 1 addition & 1 deletion src/macos/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl KickSignal {
}
}

pub type DebugExitInfo = ();
type DebugExitInfo = ();

impl UhyveVm<XhyveVm> {
/// Runs the VM.
Expand Down
1 change: 0 additions & 1 deletion src/virtio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ macro_rules! write_u16 {
};
}

#[macro_export]
macro_rules! read_u32 {
($registers:expr, $address:expr) => {
($registers[$address] as u32)
Expand Down
2 changes: 1 addition & 1 deletion src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub enum LoadKernelError {
InsufficientMemory,
}

pub type LoadKernelResult<T> = Result<T, LoadKernelError>;
type LoadKernelResult<T> = Result<T, LoadKernelError>;

#[cfg(target_os = "linux")]
pub type DefaultBackend = crate::linux::x86_64::kvm_cpu::KvmVm;
Expand Down

0 comments on commit 96d9b54

Please sign in to comment.