This repository was archived by the owner on Nov 6, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +23
-2
lines changed Expand file tree Collapse file tree 4 files changed +23
-2
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 @@ -29,3 +29,18 @@ In the `kvm-bindings` crate each feature maps to exactly one Linux version
29
29
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
+ # Additional features
34
+ This crate also offers safe wrappers over FAM structs - FFI structs that have
35
+ a Flexible Array Member in their definition.
36
+ These safe wrappers can be used if the ` fam-wrappers ` feature is enabled for
37
+ this crate. Example:
38
+ ``` toml
39
+ kvm-bindings = { version = " 0.1" , features = [" kvm_v4_20_0" , " fam-wrappers" ]}
40
+ ```
41
+
42
+ # Dependencies
43
+ This crate has no external dependencies when used with ` default ` features.
44
+
45
+ When enabling the ` fam-wrappers ` feature, this crate will take a dependency on
46
+ the [ vmm-sys-util] ( https://crates.io/crates/vmm-sys-util ) crate.
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