-
Notifications
You must be signed in to change notification settings - Fork 120
Implement MsrList and Msrs as FamStructWrappers #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Could we implement this in kvm-bindings crate? It should be simpler and natural to implement mechanism to access syscall related structs within the kvm-bindings crate. |
@jiangliu I don't think that implementing these traits in the kvm-bindings crate is a good idea at the moment. There are a few reasons for that:
While I believe that it's not the best thing now to move this functionality in kvm-bindings, we can discuss about it again once the rust-vmm components and their separation are more obvious. What do you say? |
|
After some thought, I agree that the FamWrappers over the kvm FAM structures belong in the same crate as the structs themselves (kvm-bindings). Doing that also simplifies the implementation since we can directly implement the external FamStructWrapper trait on a local struct. I've opened rust-vmm/kvm-bindings#8 that exemplifies how that'd look. |
Signed-off-by: Adrian Catangiu <[email protected]>
Use safe fam-wrapper over kvm_cpuid2 exported by the kvm-bindings crate instead of implementing our own. Coverage decreases by 0.1% because of the removed code. Signed-off-by: Adrian Catangiu <[email protected]>
Refactor the unsafe code concerning kvm_msr_list and kvm_msrs, to work with the safe fam-wrappers MsrList and Msrs. Signed-off-by: Adrian Catangiu <[email protected]>
The PR is updated to use the |
Description of changes
kvm_msr_list
andkvm_msrs
each contain a flexible array member and were forcing users ofkvm-ioctls
crate to work withunsafe
code.Use the
kvm-bindings
CpuId
,MsrList
andMsrs
safe wrappers over them and change our ioctl functions to use these safe wrappers.