[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 04/21] qobject: add quint type
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 04/21] qobject: add quint type |
Date: |
Tue, 21 Mar 2017 12:06:33 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
On 03/21/2017 11:49 AM, Markus Armbruster wrote:
>
> QMP clients that work around the "large positive integers are rejected"
> bugs by sending large negative ones instead may well exist. Fixing the
> interface would break them. Depressing. Eric, could you have a peek at
> libvirt?
Yes, libvirt is such a client already. From
util/virjson.c:virJSONValueObjectAddVArgs():
* Adds the key-value pairs supplied as variable argument list to @obj.
*
* Keys look like s:name the first letter is a type code:
...
* U: unsigned long integer value (see below for quirks)
* P: unsigned long integer value, omitted if zero
...
case 'P':
case 'U': {
/* qemu silently truncates numbers larger than LLONG_MAX,
* so passing the full range of unsigned 64 bit integers
* is not safe here. Pass them as signed 64 bit integers
* instead.
*/
long long val = va_arg(args, long long);
if (!val && type == 'P')
continue;
rc = virJSONValueObjectAppendNumberLong(obj, key, val);
} break;
So if we "fix" QMP to reject negative values in place of large unsigned
values, we'll need to also fix libvirt to have a way to introspect the
difference and cope accordingly. (I'm thinking that we'll have to keep
the negative parsing indefinitely, and can merely improve the parser to
also parse large positive - but that we can still reject values <
INT64_MIN that would have a weird wraparound).
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH 02/21] pci-host: use more specific type names, (continued)
- [Qemu-devel] [PATCH 02/21] pci-host: use more specific type names, Marc-André Lureau, 2017/03/11
- [Qemu-devel] [PATCH 03/21] object: fix potential leak in getters, Marc-André Lureau, 2017/03/11
- [Qemu-devel] [PATCH 04/21] qobject: add quint type, Marc-André Lureau, 2017/03/11
- Re: [Qemu-devel] [PATCH 04/21] qobject: add quint type, Eric Blake, 2017/03/11
- Re: [Qemu-devel] [PATCH 04/21] qobject: add quint type, Markus Armbruster, 2017/03/13
- Re: [Qemu-devel] [PATCH 04/21] qobject: add quint type, Eric Blake, 2017/03/13
- Re: [Qemu-devel] [PATCH 04/21] qobject: add quint type, Marc-André Lureau, 2017/03/13
- Re: [Qemu-devel] [PATCH 04/21] qobject: add quint type, Marc-André Lureau, 2017/03/21
- Re: [Qemu-devel] [PATCH 04/21] qobject: add quint type, Markus Armbruster, 2017/03/21
- Re: [Qemu-devel] [PATCH 04/21] qobject: add quint type,
Eric Blake <=
- Re: [Qemu-devel] [PATCH 04/21] qobject: add quint type, Marc-André Lureau, 2017/03/21
[Qemu-devel] [PATCH 05/21] qapi: update the qobject visitor to use QUInt, Marc-André Lureau, 2017/03/11
[Qemu-devel] [PATCH 06/21] json: learn to parse uint64 numbers, Marc-André Lureau, 2017/03/11
[Qemu-devel] [PATCH 07/21] object: add uint property setter/getter, Marc-André Lureau, 2017/03/11
[Qemu-devel] [PATCH 09/21] qdev: use appropriate type, Marc-André Lureau, 2017/03/11
[Qemu-devel] [PATCH 08/21] qdev: use int and uint properties, Marc-André Lureau, 2017/03/11
[Qemu-devel] [PATCH 10/21] Use uint property getter/setter where appropriate, Marc-André Lureau, 2017/03/11
[Qemu-devel] [PATCH 11/21] qdict: learn to lookup quint, Marc-André Lureau, 2017/03/11
[Qemu-devel] [PATCH 12/21] test-qga: drop everything until guest-sync, Marc-André Lureau, 2017/03/11