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

Make KVM versions mutually exclusive #3

Closed
andreeaflorescu opened this issue Jan 7, 2019 · 2 comments
Closed

Make KVM versions mutually exclusive #3

andreeaflorescu opened this issue Jan 7, 2019 · 2 comments

Comments

@andreeaflorescu
Copy link
Member

Context

The Linux version is selected by using cargo features. If the client doesn't want to use the default bindings (at the moment generated from kernel version 4.20) other versions can be selected by using rust features.
For example, to select the kvm bindings generated from the linux version 4.14, you would need to write the following line in Cargo.toml:

kvm_wrapper = { version = "0.1.0", features = ["kvm_v4_14_0"]}

Problem

The problem is that nothing stops you from writing the following in your Cargo.toml file:

kvm_wrapper = { version = "0.1.0", features = ["kvm_v4_14_0", "kvm_v4_20_0"]}

If the user selects more than one version though cargo will try to export bindings for all the existing versions which results in unused warnings:

...
warning: constant item is never used: `kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_ITS`                                                                                                                                                                                                  
    --> src/x86/bindings_v4_20_0.rs:9589:1                                                                                                                                                                                                                                         
     |                                                                                                                                                                                                                                                                             
9589 | pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_ITS: kvm_device_type = 8;                                                                                                                                                                                                   
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                   
                                                                                                                                                                                                                                                                                   
warning: constant item is never used: `kvm_device_type_KVM_DEV_TYPE_MAX`                                                                                                                                                                                                           
    --> src/x86/bindings_v4_20_0.rs:9590:1                                                                                                                                                                                                                                         
     |                                                                                                                                                                                                                                                                             
9590 | pub const kvm_device_type_KVM_DEV_TYPE_MAX: kvm_device_type = 9;                                                                                                                                                                                                            
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                            
...

Nice to Have

It would be nice to make features mutually exclusive, but this is not currently possible out of the box. See cargo issue rust-lang/cargo#2980.

We should anyway find a hack to fix this.

@andreeaflorescu andreeaflorescu transferred this issue from rust-vmm/kvm_wrapper Jul 18, 2019
@rbradford
Copy link
Contributor

There is only one set of KVM bindings now so this issue is no longer relevant!

@lauralt
Copy link
Contributor

lauralt commented Mar 2, 2023

@rbradford thanks! I think we can close the issue.

@lauralt lauralt closed this as completed Mar 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants