This repository was archived by the owner on Nov 6, 2024. It is now read-only.
File tree 4 files changed +23
-4
lines changed
4 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ license = "Apache-2.0"
11
11
[features ]
12
12
kvm-v4_14_0 = []
13
13
kvm-v4_20_0 = []
14
+ fam-wrappers = [" vmm-sys-util" ]
14
15
15
16
[dependencies ]
16
- vmm-sys-util = " >=0.2.0"
17
+ vmm-sys-util = { version = " >=0.2.0" , optional = true }
Original file line number Diff line number Diff line change 25
25
``` toml
26
26
kvm-bindings = { version = " 0.1" , features = [" kvm_v4_20_0" ]}
27
27
```
28
- In the ` kvm-bindings ` crate each feature maps to exactly one Linux version
29
- as follows:
28
+ Bindings are generated for each specific Linux kernel version based on the enabled
29
+ crate features as follows:
30
30
- ` kvm_v4_14_0 ` contains the bindings for the Linux kernel version 4.14
31
31
- ` kvm_v4_20_0 ` contains the bindings for the Linux kernel version 4.20
32
+
33
+ This crate also offers safe wrappers over FAM structs - FFI structs that have
34
+ a Flexible Array Member in their definition.
35
+ These safe wrappers can be used if the ` fam-wrappers ` feature is enabled for
36
+ this crate. Example:
37
+ ``` toml
38
+ kvm-bindings = { version = " 0.1" , features = [" kvm_v4_20_0" , " fam-wrappers" ]}
39
+ ```
40
+
41
+ # Dependencies
42
+ The crate has an ` optional ` dependency to
43
+ [ vmm-sys-util] ( https://crates.io/crates/vmm-sys-util ) when enabling the
44
+ ` fam-wrappers ` feature.
Original file line number Diff line number Diff line change 6
6
#![ allow( non_snake_case) ]
7
7
8
8
#[ macro_use]
9
- #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
9
+ #[ cfg( all(
10
+ feature = "fam-wrappers" ,
11
+ any( target_arch = "x86" , target_arch = "x86_64" )
12
+ ) ) ]
10
13
extern crate vmm_sys_util;
11
14
12
15
#[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
Original file line number Diff line number Diff line change 1
1
// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
// SPDX-License-Identifier: Apache-2.0
3
3
4
+ #[ cfg( feature = "fam-wrappers" ) ]
4
5
mod fam_wrappers;
5
6
6
7
#[ cfg( feature = "kvm-v4_14_0" ) ]
@@ -24,5 +25,6 @@ pub mod bindings {
24
25
#[ cfg( all( not( feature = "kvm-v4_14_0" ) , not( feature = "kvm-v4_20_0" ) ) ) ]
25
26
pub use super :: bindings_v4_20_0:: * ;
26
27
28
+ #[ cfg( feature = "fam-wrappers" ) ]
27
29
pub use super :: fam_wrappers:: * ;
28
30
}
You can’t perform that action at this time.
0 commit comments