Skip to content

Commit 2a62f21

Browse files
Alexandra Iordacheandreeaflorescu
authored andcommitted
refactor autogenerated files
Signed-off-by: Alexandra Iordache <aghecen@amazon.com>
1 parent 6f63411 commit 2a62f21

File tree

11 files changed

+58
-25
lines changed

11 files changed

+58
-25
lines changed

coverage_config_x86_64.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"coverage_score": 81,
2+
"coverage_score": 84.8,
33
"exclude_path": "",
4-
"crate_features": "bzimage,elf"
4+
"crate_features": "bzimage,elf",
5+
"exclude_path": "loader_gen"
56
}

src/configurator/x86_64/linux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl BootConfigurator for LinuxBootConfigurator {
124124
#[cfg(test)]
125125
mod tests {
126126
use super::*;
127-
use crate::loader::bootparam::boot_params;
127+
use crate::loader_gen::bootparam::boot_params;
128128
use std::mem;
129129
use vm_memory::{Address, GuestAddress, GuestMemoryMmap};
130130

src/configurator/x86_64/pvh.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use vm_memory::{ByteValued, Bytes, GuestMemory};
1616

1717
use crate::configurator::{BootConfigurator, BootParams, Error as BootConfiguratorError, Result};
18-
use crate::loader::elf::start_info::{hvm_memmap_table_entry, hvm_modlist_entry, hvm_start_info};
18+
use crate::loader_gen::start_info::{hvm_memmap_table_entry, hvm_modlist_entry, hvm_start_info};
1919

2020
use std::error::Error as StdError;
2121
use std::fmt;

src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,9 @@ pub mod cmdline;
9393
pub mod configurator;
9494
pub mod loader;
9595

96+
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
97+
mod loader_gen;
98+
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
99+
pub use loader_gen::*;
100+
96101
extern crate vm_memory;

src/loader/mod.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,8 @@ use std::io::{Read, Seek};
2828
use vm_memory::ByteValued;
2929
use vm_memory::{Address, Bytes, GuestAddress, GuestMemory, GuestUsize};
3030

31-
#[allow(dead_code)]
32-
#[allow(non_camel_case_types)]
33-
#[allow(non_snake_case)]
34-
#[allow(non_upper_case_globals)]
35-
#[allow(missing_docs)]
36-
#[cfg_attr(feature = "cargo-clippy", allow(clippy::all))]
3731
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
38-
// Hide the autogenerated documentation for bindgen'ed sources.
39-
#[doc(hidden)]
40-
pub mod bootparam;
32+
pub use crate::loader_gen::bootparam;
4133

4234
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
4335
mod x86_64;

src/loader/x86_64/elf/mod.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,9 @@ use std::mem;
1818

1919
use vm_memory::{Address, ByteValued, Bytes, GuestAddress, GuestMemory, GuestUsize};
2020

21-
use super::super::{Error as KernelLoaderError, KernelLoader, KernelLoaderResult, Result};
22-
23-
#[allow(dead_code)]
24-
#[allow(non_camel_case_types)]
25-
#[allow(non_snake_case)]
26-
#[allow(non_upper_case_globals)]
27-
#[cfg_attr(feature = "cargo-clippy", allow(clippy::all))]
28-
mod elf;
29-
30-
#[allow(missing_docs)]
31-
#[cfg_attr(feature = "cargo-clippy", allow(clippy::all))]
32-
pub mod start_info;
21+
use crate::loader::{Error as KernelLoaderError, KernelLoader, KernelLoaderResult, Result};
22+
use crate::loader_gen::elf;
23+
pub use crate::loader_gen::start_info;
3324

3425
unsafe impl ByteValued for elf::Elf64_Ehdr {}
3526
unsafe impl ByteValued for elf::Elf64_Nhdr {}

src/loader_gen/mod.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright (c) 2019 Intel Corporation. All rights reserved.
2+
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
//
4+
// Copyright 2017 The Chromium OS Authors. All rights reserved.
5+
// Use of this source code is governed by a BSD-style license that can be
6+
// found in the LICENSE-BSD-3-Clause file.
7+
//
8+
// SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
9+
10+
//! Bindgen autogenerated structs for boot parameters.
11+
12+
#![cfg(any(target_arch = "x86", target_arch = "x86_64"))]
13+
14+
mod x86_64;
15+
pub use x86_64::*;
File renamed without changes.
File renamed without changes.

src/loader_gen/x86_64/mod.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright (c) 2019 Intel Corporation. All rights reserved.
2+
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
//
4+
// Copyright 2017 The Chromium OS Authors. All rights reserved.
5+
// Use of this source code is governed by a BSD-style license that can be
6+
// found in the LICENSE-BSD-3-Clause file.
7+
//
8+
// SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
9+
10+
//! Bindgen autogenerated structs for `x86_64` boot parameters.
11+
12+
#![cfg(any(target_arch = "x86", target_arch = "x86_64"))]
13+
14+
#![cfg_attr(feature = "cargo-clippy", allow(clippy::all))]
15+
#![allow(dead_code)]
16+
#![allow(missing_docs)]
17+
#![allow(non_camel_case_types)]
18+
#![allow(non_snake_case)]
19+
#![allow(non_upper_case_globals)]
20+
21+
// Hide the autogenerated documentation for bindgen'ed sources.
22+
#[doc(hidden)]
23+
pub mod bootparam;
24+
25+
#[cfg(feature = "elf")]
26+
pub mod elf;
27+
28+
#[cfg(feature = "elf")]
29+
pub mod start_info;

0 commit comments

Comments
 (0)