[libvirt] [PATCHv3 5/8] qemu: bulk stats: implement interface group
Eric Blake
eblake at redhat.com
Thu Sep 11 18:00:58 UTC 2014
On 09/11/2014 11:16 AM, Peter Krempa wrote:
>> struct _virDomainInterfaceStats {
>> long long rx_bytes;
>> long long rx_packets;
>> long long rx_errs;
>> long long rx_drop;
>> long long tx_bytes;
>> long long tx_packets;
>> long long tx_errs;
>> long long tx_drop;
>> };
>>
>> But I don't have any problem to cast them as unsigned, with something like:
>
> That will be fine with me as long as:
>>
>> #define QEMU_ADD_NET_PARAM(record, maxparams, num, name, value) \
>> do { \
>> char param_name[VIR_TYPED_PARAM_FIELD_LENGTH]; \
>> snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, \
>> "net.%u.%s", num, name); \
>> if (virTypedParamsAddULLong(&(record)->params, \
>
> ... you don't add the param if value is < 0. Thus rather than expressing
> the missing information via -1 just omit the parameter.
>
>> &(record)->nparams, \
>> maxparams, \
>> param_name, \
>> (unsigned long long)value) < 0) \
The cast is spurious; the C compiler does the right thing if you already
filter on value < 0 before calling this function to add the positive
values as unsigned long long.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 539 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140911/1579bec8/attachment-0001.sig>
More information about the libvir-list
mailing list