Skip to content

Commit e4ee241

Browse files
xuejun-xjroypat
authored andcommitted
vcpu: export reg_size as a public method
For better use of set_one_reg/get_one_reg on arm, it's useful to export the helper method, reg_size, to be used outside of the crate. fixes #234 Signed-off-by: xuejun-xj <jiyunxue@linux.alibaba.com>
1 parent 1bae7cd commit e4ee241

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
## Added
44

55
## Changed
6+
- [[#234](https://github.com/rust-vmm/kvm-ioctls/issues/234)] vcpu: export
7+
reg_size as a public method.
68

79
# v0.15.0
810

src/ioctls/vcpu.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use vmm_sys_util::ioctl::{ioctl_with_mut_ptr, ioctl_with_ptr, ioctl_with_val};
2121

2222
/// Helper method to obtain the size of the register through its id
2323
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
24-
fn reg_size(reg_id: u64) -> usize {
24+
pub fn reg_size(reg_id: u64) -> usize {
2525
2_usize.pow(((reg_id & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT) as u32)
2626
}
2727

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ mod ioctls;
217217
pub use cap::Cap;
218218
pub use ioctls::device::DeviceFd;
219219
pub use ioctls::system::Kvm;
220+
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
221+
pub use ioctls::vcpu::reg_size;
220222
pub use ioctls::vcpu::{VcpuExit, VcpuFd};
221223

222224
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]

0 commit comments

Comments
 (0)