Skip to content
This repository was archived by the owner on Nov 6, 2024. It is now read-only.

Commit 190dbaa

Browse files
andreeaflorescuSamuel Ortiz
authored andcommitted
make kernel bindings mutually exclusive
When the crate is built with --all-features we have a bunch of errors because we are not excluding the 4.14 and 4.20 bindings. Whenever all features is specified now, the 4.20 bindings are going to be used. This change is required for switching to rust-vmm-ci where the tests are run using --all-features flag. Signed-off-by: Andreea Florescu <fandree@amazon.com>
1 parent 7b1ddde commit 190dbaa

File tree

3 files changed

+39
-36
lines changed

3 files changed

+39
-36
lines changed

src/arm/mod.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
#[cfg(feature = "kvm-v4_14_0")]
4+
// Export 4.14 bindings when the feature kvm-v4_20_0 is not specified.
5+
#[cfg(all(feature = "kvm-v4_14_0", not(feature = "kvm-v4_20_0")))]
56
mod bindings_v4_14_0;
6-
#[cfg(feature = "kvm-v4_20_0")]
7-
mod bindings_v4_20_0;
87

9-
// Major hack to have a default version in case no feature is specified:
10-
// If no version is specified by using the features, just use the latest one
11-
// which currently is 4.20.
12-
#[cfg(all(not(feature = "kvm-v4_14_0"), not(feature = "kvm-v4_20_0")))]
8+
// Export 4.20 bindings when kvm-v4_20_0 is specified or no kernel version
9+
// related features are specified.
10+
#[cfg(any(
11+
feature = "kvm-v4_20_0",
12+
all(not(feature = "kvm-v4_14_0"), not(feature = "kvm-v4_20_0"))
13+
))]
1314
mod bindings_v4_20_0;
1415

1516
pub mod bindings {
16-
#[cfg(feature = "kvm-v4_14_0")]
17+
#[cfg(all(feature = "kvm-v4_14_0", not(feature = "kvm-v4_20_0")))]
1718
pub use super::bindings_v4_14_0::*;
1819

19-
#[cfg(feature = "kvm-v4_20_0")]
20-
pub use super::bindings_v4_20_0::*;
21-
22-
#[cfg(all(not(feature = "kvm-v4_14_0"), not(feature = "kvm-v4_20_0")))]
20+
#[cfg(any(
21+
feature = "kvm-v4_20_0",
22+
all(not(feature = "kvm-v4_14_0"), not(feature = "kvm-v4_20_0"))
23+
))]
2324
pub use super::bindings_v4_20_0::*;
2425
}

src/arm64/mod.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
#[cfg(feature = "kvm-v4_14_0")]
4+
// Export 4.14 bindings when the feature kvm-v4_20_0 is not specified.
5+
#[cfg(all(feature = "kvm-v4_14_0", not(feature = "kvm-v4_20_0")))]
56
mod bindings_v4_14_0;
6-
#[cfg(feature = "kvm-v4_20_0")]
7-
mod bindings_v4_20_0;
87

9-
// Major hack to have a default version in case no feature is specified:
10-
// If no version is specified by using the features, just use the latest one
11-
// which currently is 4.20.
12-
#[cfg(all(not(feature = "kvm-v4_14_0"), not(feature = "kvm-v4_20_0")))]
8+
// Export 4.20 bindings when kvm-v4_20_0 is specified or no kernel version
9+
// related features are specified.
10+
#[cfg(any(
11+
feature = "kvm-v4_20_0",
12+
all(not(feature = "kvm-v4_14_0"), not(feature = "kvm-v4_20_0"))
13+
))]
1314
mod bindings_v4_20_0;
1415

1516
pub mod bindings {
16-
#[cfg(feature = "kvm-v4_14_0")]
17+
#[cfg(all(feature = "kvm-v4_14_0", not(feature = "kvm-v4_20_0")))]
1718
pub use super::bindings_v4_14_0::*;
1819

19-
#[cfg(feature = "kvm-v4_20_0")]
20-
pub use super::bindings_v4_20_0::*;
21-
22-
#[cfg(all(not(feature = "kvm-v4_14_0"), not(feature = "kvm-v4_20_0")))]
20+
#[cfg(any(
21+
feature = "kvm-v4_20_0",
22+
all(not(feature = "kvm-v4_14_0"), not(feature = "kvm-v4_20_0"))
23+
))]
2324
pub use super::bindings_v4_20_0::*;
2425
}

src/x86/mod.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,26 @@
44
#[cfg(feature = "fam-wrappers")]
55
mod fam_wrappers;
66

7-
#[cfg(feature = "kvm-v4_14_0")]
7+
// Export 4.14 bindings when the feature kvm-v4_20_0 is not specified.
8+
#[cfg(all(feature = "kvm-v4_14_0", not(feature = "kvm-v4_20_0")))]
89
mod bindings_v4_14_0;
9-
#[cfg(feature = "kvm-v4_20_0")]
10-
mod bindings_v4_20_0;
1110

12-
// Major hack to have a default version in case no feature is specified:
13-
// If no version is specified by using the features, just use the latest one
14-
// which currently is 4.20.
15-
#[cfg(all(not(feature = "kvm-v4_14_0"), not(feature = "kvm-v4_20_0")))]
11+
// Export 4.20 bindings when kvm-v4_20_0 is specified or no kernel version
12+
// related features are specified.
13+
#[cfg(any(
14+
feature = "kvm-v4_20_0",
15+
all(not(feature = "kvm-v4_14_0"), not(feature = "kvm-v4_20_0"))
16+
))]
1617
mod bindings_v4_20_0;
1718

1819
pub mod bindings {
19-
#[cfg(feature = "kvm-v4_14_0")]
20+
#[cfg(all(feature = "kvm-v4_14_0", not(feature = "kvm-v4_20_0")))]
2021
pub use super::bindings_v4_14_0::*;
2122

22-
#[cfg(feature = "kvm-v4_20_0")]
23-
pub use super::bindings_v4_20_0::*;
24-
25-
#[cfg(all(not(feature = "kvm-v4_14_0"), not(feature = "kvm-v4_20_0")))]
23+
#[cfg(any(
24+
feature = "kvm-v4_20_0",
25+
all(not(feature = "kvm-v4_14_0"), not(feature = "kvm-v4_20_0"))
26+
))]
2627
pub use super::bindings_v4_20_0::*;
2728

2829
#[cfg(feature = "fam-wrappers")]

0 commit comments

Comments
 (0)