Type Alias kvm_bindings::Xsave
source · pub type Xsave = FamStructWrapper<kvm_xsave2>;
fam-wrappers
and x86-64 only.Expand description
Wrapper over the post-5.17 kvm_xsave
structure.
In linux 5.17, kvm_xsave got turned into a FamStruct by adding the flexible “extra” member
to its definition. However, unlike all other such structs, it does not contain a “length”
field. Instead, the length of the flexible array member has to be determined by querying
the KVM_CAP_XSAVE2
capability. This requires access to a VM file descriptor, and thus
cannot happen in the FamStruct::len
trait method. To work around this, we define a wrapper
struct that caches the length of a previous KVM_CHECK_EXTENSION(KVM_CAP_XSAVE2)
call,
and implement FamStruct
for this wrapper. Then in kvm-ioctls, we can expose a function
that first queries KVM_CAP_XSAVE2
, then invokes [KVM_GET_XSAVE2
] to retrives the kvm_xsave
structure, and finally combine them into the kvm_xsave2
helper structure to be managed as a
FamStruct
.
Aliased Type§
struct Xsave { /* private fields */ }