Remove KVM's internal pseudo-overlay of kvm_stats_desc, which subtly aliases the flexible name[] in the uAPI definition with a fixed-size array of the same name. The unusual embedded structure results in compiler warnings due to -Wflex-array-member-not-at-end, and also necessitates an extra level of dereferencing in KVM. To avoid the "overlay", define the uAPI structure to have a fixed-size name when building for the kernel. Opportunistically clean up the indentation for the stats macros, and replace spaces with tabs. No functional change intended.
Showing the changes to include/uapi (1 of 14 files). Show all
Unified · Split
| @@ -14,6 +14,10 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <linux/ioctl.h> |
| 15 | 15 | #include <asm/kvm.h> |
| 16 | 16 | |
| 17 | +#ifdef __KERNEL__ | |
| 18 | +#include <linux/kvm_types.h> | |
| 19 | +#endif | |
| 20 | + | |
| 17 | 21 | #define KVM_API_VERSION 12 |
| 18 | 22 | |
| 19 | 23 | /* |
| @@ -1579,7 +1583,11 @@ struct kvm_stats_desc { · 1559 unmodified lines | ||
| 1579 | 1583 | __u16 size; |
| 1580 | 1584 | __u32 offset; |
| 1581 | 1585 | __u32 bucket_size; |
| 1586 | +#ifdef __KERNEL__ | |
| 1587 | + char name[KVM_STATS_NAME_SIZE]; | |
| 1588 | +#else | |
| 1582 | 1589 | char name[]; |
| 1590 | +#endif | |
| 1583 | 1591 | }; |
| 1584 | 1592 | |
| 1585 | 1593 | #define KVM_GET_STATS_FD _IO(KVMIO, 0xce) |