On 11/24/2015 10:58 AM, Marc-André Lureau wrote:

>>> +    cmd = g_strdup_printf("{'execute': 'guest-file-seek',"
>>> +                          " 'arguments': { 'handle': %" PRId64 ", "
>>> +                          " 'offset': %d, 'whence': %d } }",
>>> +                          id, 0, SEEK_SET);
>>
>> EWWWW.  We seriously released this interface as taking an integer for
>> whence?  SEEK_SET is not required to be the same value on every
>> platform.  Which is a severe problem if the guest and the host are on
>> different OS with different choices of values for the constants (if
>> SEEK_CUR on my host is 1, but 1 maps to SEEK_END on my guest OS, what
>> behavior am I going to get?).
>>
>> It would be worth a patch to qga to document the actual integer values
>> that we have hard-coded (0 for set, 1 for cur, 2 for end; even if that
>> differs from the guest's local definition of the SEEK_ constants),
>> and/or to fix the interface to take symbolic names rather than integers
>> for the whence argument.
>>
>> Our whole guest-file-* API is lousy.
> 
> Are you going to send a patch for this?

Sure, now that you've asked. For 2.5, it will just be documentation and
mapping integers to the correct constants (any magic of using a qapi
alternate type to support symbolic names would be 2.6 territory).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to