On Thu, Jun 17, 2021 at 01:29:22PM +0200, Paolo Bonzini wrote:
On 17/06/21 07:56, Greg KH wrote:
On Thu, Jun 17, 2021 at 04:41:44AM +0000, Jing Zhang wrote:
- struct kvm_stats_desc {
__u32 flags;
__s16 exponent;
__u16 size;
__u32 offset;
__u32 unused;
char name[0];
- };
<snip>
+The ``unused`` fields are reserved for future support for other types of +statistics data, like log/linear histogram.
you HAVE to set unused to 0 for now, otherwise userspace does not know it is unused, right?
Jing, I think you planned to use it with other flags that are unused for now? But please do check that it's zero in the testcase.
It is not a pointer, it is the data itself.
+string starts at the end of ``struct kvm_stats_desc``. +The maximum length (including trailing '\0') is indicated by ``name_size`` +in ``struct kvm_stats_header``.
I thought we were replacing [0] arrays with [], are you sure you should be declaring this as [0]? Same for all structures in this document (and code).
In C code [0] is a bit more flexible than []. I think in this particular case [] won't work due to how the structures are declared. In the documentation [] is certainly clearer.
Look at all of the patches that Gustavo has been doing all over the tree for this work, you do not want to make him do this again here.
Gustavo, is [0] ok for fields like these?
thanks,
greg k-h