42 #include <linux/kvm.h>
43 #include <sys/ioctl.h>
64 #ifdef KVM_GET_DEVICE_ATTR
65 struct kvm_device_attr dattr = {
69 reinterpret_cast<uint64_t
>(
data),
72 if (
ioctl(KVM_GET_DEVICE_ATTR, &dattr) == -1) {
73 panic(
"Failed to get attribute (group: %i, attr: %i, errno: %i)",
77 panic(
"Kernel headers don't support KVM_GET_DEVICE_ATTR\n");
84 #ifdef KVM_SET_DEVICE_ATTR
85 struct kvm_device_attr dattr = {
89 reinterpret_cast<uint64_t
>(
data),
92 if (
ioctl(KVM_SET_DEVICE_ATTR, &dattr) == -1) {
93 panic(
"Failed to set attribute (group: %i, attr: %i, errno: %i)",
97 panic(
"Kernel headers don't support KVM_GET_DEVICE_ATTR\n");
104 #ifdef KVM_HAS_DEVICE_ATTR
105 struct kvm_device_attr dattr = {
112 return ioctl(KVM_HAS_DEVICE_ATTR, &dattr) == 0;
114 panic(
"Kernel headers don't support KVM_HAS_DEVICE_ATTR\n");
123 return ::ioctl(
fd, request, p1);
void setAttrPtr(uint32_t group, uint64_t attr, const void *data) const
void getAttrPtr(uint32_t group, uint64_t attr, void *data) const
int ioctl(int request, long p1) const
bool hasAttr(uint32_t group, uint64_t attr) const
Check if a device attribute is valid.