Skip to content

Commit 1a4e68c

Browse files
committed
mshv-{bindings, ioctls}: add line breaks
Adding line breaks through out the project after each functions and definitions. Signed-off-by: Muminul Islam <muislam@microsoft.com>
1 parent 76bbc50 commit 1a4e68c

File tree

8 files changed

+78
-1
lines changed

8 files changed

+78
-1
lines changed

mshv-bindings/src/hvcall.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ pub struct RepInput<T> {
4747
size: usize,
4848
rep_count: usize,
4949
}
50+
5051
impl<T: Default> RepInput<T> {
5152
/// Create a RepInput<T> for a rep hypercall
5253
///

mshv-bindings/src/x86_64/regs.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ pub struct VcpuEvents {
389389
pub pending_event0: [u8; 16usize],
390390
pub pending_event1: [u8; 16usize],
391391
}
392+
392393
#[repr(C)]
393394
#[derive(Debug, Default, Copy, Clone, Eq, PartialEq, AsBytes, FromBytes, FromZeroes)]
394395
#[cfg_attr(feature = "with-serde", derive(Deserialize, Serialize))]
@@ -408,6 +409,7 @@ pub struct hv_cpuid_entry {
408409
pub edx: __u32,
409410
pub padding: [__u32; 3usize],
410411
}
412+
411413
#[repr(C)]
412414
#[derive(Debug, Default)]
413415
#[cfg_attr(feature = "with-serde", derive(Deserialize, Serialize))]
@@ -496,6 +498,7 @@ impl Drop for Buffer {
496498
pub struct LapicState {
497499
pub regs: [::std::os::raw::c_char; 1024usize],
498500
}
501+
499502
impl Default for LapicState {
500503
fn default() -> Self {
501504
unsafe { ::std::mem::zeroed() }
@@ -674,6 +677,7 @@ pub struct SuspendRegisters {
674677
pub explicit_register: u64,
675678
pub intercept_register: u64,
676679
}
680+
677681
#[repr(C)]
678682
#[derive(Debug, Default, Copy, Clone, Eq, PartialEq, AsBytes, FromBytes, FromZeroes)]
679683
#[cfg_attr(feature = "with-serde", derive(Deserialize, Serialize))]

mshv-bindings/src/x86_64/serializers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ mod tests {
9696
.zip(d_state.regs.iter())
9797
.all(|(a, b)| a == b));
9898
}
99+
99100
#[test]
100101
fn test_xsave_serialization_deserialization() {
101102
let mut xsave = XSave {

mshv-bindings/src/x86_64/unmarshal.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ impl hv_message {
2020
unsafe { std::ptr::read_unaligned(std::ptr::addr_of!(self.u.payload) as *const _) };
2121
Ok(ret)
2222
}
23+
2324
#[inline]
2425
pub fn to_memory_info(&self) -> Result<hv_x64_memory_intercept_message> {
2526
if self.header.message_type != hv_message_type_HVMSG_GPA_INTERCEPT
@@ -35,6 +36,7 @@ impl hv_message {
3536
unsafe { std::ptr::read_unaligned(std::ptr::addr_of!(self.u.payload) as *const _) };
3637
Ok(ret)
3738
}
39+
3840
#[inline]
3941
pub fn to_gpa_attribute_info(&self) -> Result<hv_x64_gpa_attribute_intercept_message> {
4042
if self.header.message_type != hv_message_type_HVMSG_GPA_ATTRIBUTE_INTERCEPT {
@@ -47,6 +49,7 @@ impl hv_message {
4749
unsafe { std::ptr::read_unaligned(std::ptr::addr_of!(self.u.payload) as *const _) };
4850
Ok(ret)
4951
}
52+
5053
#[inline]
5154
pub fn to_ioport_info(&self) -> Result<hv_x64_io_port_intercept_message> {
5255
if self.header.message_type != hv_message_type_HVMSG_X64_IO_PORT_INTERCEPT {
@@ -59,6 +62,7 @@ impl hv_message {
5962
unsafe { std::ptr::read_unaligned(std::ptr::addr_of!(self.u.payload) as *const _) };
6063
Ok(ret)
6164
}
65+
6266
#[inline]
6367
pub fn to_msr_info(&self) -> Result<hv_x64_msr_intercept_message> {
6468
if self.header.message_type != hv_message_type_HVMSG_X64_MSR_INTERCEPT {
@@ -71,6 +75,7 @@ impl hv_message {
7175
unsafe { std::ptr::read_unaligned(std::ptr::addr_of!(self.u.payload) as *const _) };
7276
Ok(ret)
7377
}
78+
7479
#[inline]
7580
pub fn to_exception_info(&self) -> Result<hv_x64_exception_intercept_message> {
7681
if self.header.message_type != hv_message_type_HVMSG_X64_EXCEPTION_INTERCEPT {
@@ -83,6 +88,7 @@ impl hv_message {
8388
unsafe { std::ptr::read_unaligned(std::ptr::addr_of!(self.u.payload) as *const _) };
8489
Ok(ret)
8590
}
91+
8692
#[inline]
8793
pub fn to_invalid_vp_register_info(&self) -> Result<hv_x64_invalid_vp_register_message> {
8894
if self.header.message_type != hv_message_type_HVMSG_INVALID_VP_REGISTER_VALUE {
@@ -95,6 +101,7 @@ impl hv_message {
95101
unsafe { std::ptr::read_unaligned(std::ptr::addr_of!(self.u.payload) as *const _) };
96102
Ok(ret)
97103
}
104+
98105
#[inline]
99106
pub fn to_unrecoverable_exception_info(
100107
&self,
@@ -109,6 +116,7 @@ impl hv_message {
109116
unsafe { std::ptr::read_unaligned(std::ptr::addr_of!(self.u.payload) as *const _) };
110117
Ok(ret)
111118
}
119+
112120
#[inline]
113121
pub fn to_interruption_deliverable_info(
114122
&self,
@@ -123,6 +131,7 @@ impl hv_message {
123131
unsafe { std::ptr::read_unaligned(std::ptr::addr_of!(self.u.payload) as *const _) };
124132
Ok(ret)
125133
}
134+
126135
#[inline]
127136
pub fn to_apic_eoi_info(&self) -> Result<hv_x64_apic_eoi_message> {
128137
if self.header.message_type != hv_message_type_HVMSG_X64_APIC_EOI {
@@ -135,6 +144,7 @@ impl hv_message {
135144
unsafe { std::ptr::read_unaligned(std::ptr::addr_of!(self.u.payload) as *const _) };
136145
Ok(ret)
137146
}
147+
138148
#[inline]
139149
pub fn to_hypercall_intercept_info(&self) -> Result<hv_x64_hypercall_intercept_message> {
140150
if self.header.message_type != hv_message_type_HVMSG_HYPERCALL_INTERCEPT {
@@ -147,6 +157,7 @@ impl hv_message {
147157
unsafe { std::ptr::read_unaligned(std::ptr::addr_of!(self.u.payload) as *const _) };
148158
Ok(ret)
149159
}
160+
150161
#[inline]
151162
pub fn to_sint_deliverable_info(&self) -> Result<hv_x64_sint_deliverable_message> {
152163
if self.header.message_type != hv_message_type_HVMSG_SYNIC_SINT_DELIVERABLE {
@@ -159,6 +170,7 @@ impl hv_message {
159170
unsafe { std::ptr::read_unaligned(std::ptr::addr_of!(self.u.payload) as *const _) };
160171
Ok(ret)
161172
}
173+
162174
#[inline]
163175
pub fn to_vmg_intercept_info(&self) -> Result<hv_x64_vmgexit_intercept_message> {
164176
if self.header.message_type != hv_message_type_HVMSG_X64_SEV_VMGEXIT_INTERCEPT {

mshv-ioctls/src/ioctls/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ impl MshvError {
5757
}
5858
error.into()
5959
}
60+
6061
/// Convert to error code. Analogous to errno::Error::errno()
6162
pub fn errno(self) -> i32 {
6263
errno::Error::from(self).errno()
@@ -130,6 +131,7 @@ mod tests {
130131
assert!(mshv_err == mshv_err_check);
131132
}
132133
}
134+
133135
#[test]
134136
fn test_errno_from_mshv_root_hvcall() {
135137
let args = mshv_root_hvcall {

mshv-ioctls/src/ioctls/system.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ pub struct MshvPartitionBuilder {
2525
mshv_partition: mshv_create_partition,
2626
}
2727

28+
/// Synthetic processor features
2829
#[derive(Debug)]
29-
///
3030
pub enum SyntheticProcessorFeature {
3131
/// Report a hypervisor is present.
3232
HypervisorPresent,
@@ -226,6 +226,7 @@ impl MshvPartitionBuilder {
226226
}
227227
self
228228
}
229+
229230
/// Builds the partition
230231
pub fn build(&self) -> mshv_create_partition {
231232
self.mshv_partition
@@ -242,6 +243,7 @@ impl Mshv {
242243
let ret = unsafe { Self::new_with_fd_number(fd) };
243244
Ok(ret)
244245
}
246+
245247
/// Creates a new Mshv object assuming `fd` represents an existing open file descriptor
246248
/// associated with `/dev/mshv`.
247249
///
@@ -408,6 +410,7 @@ impl Mshv {
408410
.unwrap())
409411
}
410412
}
413+
411414
#[allow(dead_code)]
412415
#[cfg(test)]
413416
mod tests {
@@ -421,6 +424,7 @@ mod tests {
421424
let vm = hv.create_vm();
422425
assert!(vm.is_ok());
423426
}
427+
424428
#[test]
425429
#[ignore]
426430
fn test_create_vm_with_default_config() {
@@ -429,6 +433,7 @@ mod tests {
429433
let vm = hv.create_vm_with_config(&pr);
430434
assert!(vm.is_ok());
431435
}
436+
432437
#[test]
433438
fn test_get_msr_index_list() {
434439
let hv = Mshv::new().unwrap();

mshv-ioctls/src/ioctls/vcpu.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,6 +1331,7 @@ mod tests {
13311331
assert!(g_sregs.apic_base == s_sregs.apic_base);
13321332
assert!(g_sregs.efer == s_sregs.efer);
13331333
}
1334+
13341335
#[test]
13351336
fn test_set_get_standardregisters() {
13361337
let hv = Mshv::new().unwrap();
@@ -1345,6 +1346,7 @@ mod tests {
13451346
assert!(g_regs.rcx == s_regs.rcx);
13461347
assert!(g_regs.rdx == s_regs.rdx);
13471348
}
1349+
13481350
#[test]
13491351
fn test_set_get_debug_gisters() {
13501352
let hv = Mshv::new().unwrap();
@@ -1361,6 +1363,7 @@ mod tests {
13611363
assert!(g_regs.dr6 == s_regs.dr6);
13621364
assert!(g_regs.dr7 == s_regs.dr7);
13631365
}
1366+
13641367
#[cfg(target_arch = "x86_64")]
13651368
#[test]
13661369
fn test_set_get_fpu() {
@@ -1389,6 +1392,7 @@ mod tests {
13891392
assert!(g_regs.last_dp == s_regs.last_dp);
13901393
assert!(g_regs.mxcsr == s_regs.mxcsr);
13911394
}
1395+
13921396
#[cfg(target_arch = "x86_64")]
13931397
#[test]
13941398
fn test_run_code() {
@@ -1537,6 +1541,7 @@ mod tests {
15371541
vm.unmap_user_memory(mem_region).unwrap();
15381542
unsafe { libc::munmap(load_addr as *mut c_void, mem_size) };
15391543
}
1544+
15401545
#[test]
15411546
fn test_set_get_msrs() {
15421547
let hv = Mshv::new().unwrap();
@@ -1573,6 +1578,7 @@ mod tests {
15731578
assert!(g_regs.as_slice()[0].data == s_regs.as_slice()[0].data);
15741579
assert!(g_regs.as_slice()[1].data == s_regs.as_slice()[1].data);
15751580
}
1581+
15761582
#[test]
15771583
fn test_set_get_vcpu_events() {
15781584
let hv = Mshv::new().unwrap();
@@ -1590,6 +1596,7 @@ mod tests {
15901596
assert!(g_regs.pending_event1[i] == s_regs.pending_event1[i]);
15911597
}
15921598
}
1599+
15931600
#[test]
15941601
fn test_set_get_xcrs() {
15951602
let hv = Mshv::new().unwrap();
@@ -1601,6 +1608,7 @@ mod tests {
16011608
let g_regs = vcpu.get_xcrs().unwrap();
16021609
assert!(g_regs.xcr0 == s_regs.xcr0);
16031610
}
1611+
16041612
#[test]
16051613
fn test_set_get_lapic() {
16061614
let hv = Mshv::new().unwrap();
@@ -1614,6 +1622,7 @@ mod tests {
16141622
assert!(state.regs[i] == g_state.regs[i]);
16151623
}
16161624
}
1625+
16171626
#[test]
16181627
fn test_set_registers_64() {
16191628
let hv = Mshv::new().unwrap();
@@ -1643,6 +1652,7 @@ mod tests {
16431652
assert!(get_regs[1].value.reg64 == 0x2);
16441653
}
16451654
}
1655+
16461656
#[test]
16471657
fn test_get_set_xsave() {
16481658
let hv = Mshv::new().unwrap();
@@ -1653,6 +1663,7 @@ mod tests {
16531663

16541664
vcpu.set_xsave(&state).unwrap();
16551665
}
1666+
16561667
#[test]
16571668
fn test_get_suspend_regs() {
16581669
let hv = Mshv::new().unwrap();
@@ -1664,6 +1675,7 @@ mod tests {
16641675
assert!(regs.explicit_register == 0x1);
16651676
assert!(regs.intercept_register == 0x0);
16661677
}
1678+
16671679
#[test]
16681680
fn test_set_get_misc_regs() {
16691681
let hv = Mshv::new().unwrap();
@@ -1675,6 +1687,7 @@ mod tests {
16751687
let g_regs = vcpu.get_misc_regs().unwrap();
16761688
assert!(g_regs.hypercall == s_regs.hypercall);
16771689
}
1690+
16781691
#[test]
16791692
fn test_get_cpuid_values() {
16801693
let hv = Mshv::new().unwrap();

0 commit comments

Comments
 (0)