qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH for-2.5] qga: Better mapping of SEEK_* in guest-


From: Marc-André Lureau
Subject: Re: [Qemu-devel] [PATCH for-2.5] qga: Better mapping of SEEK_* in guest-file-seek
Date: Tue, 24 Nov 2015 21:01:15 +0100

Hi

On Tue, Nov 24, 2015 at 8:09 PM, Eric Blake <address@hidden> wrote:
> On 11/24/2015 11:57 AM, Eric Blake wrote:
>> Exposing OS-specific SEEK_ constants in our qapi was a mistake
>> (if the host has SEEK_CUR as 1, but the guest has it as 2, then
>> the semantics are unclear what should happen); if we had a time
>> machine, we would instead expose only a symbolic enum.  It's too
>> late to change the fact that we have an integer in qapi, but we
>> can at least document what mapping we want to enforce for all
>> qga clients (and luckily, it happens to be the mapping that both
>> Linux and Windows use), then fix the code to match that mapping.
>> It also helps us filter out unsupported SEEK_DATA and SEEK_HOLE.
>>
>> Signed-off-by: Eric Blake <address@hidden>
>> ---
>>  qga/commands-posix.c | 19 ++++++++++++++++++-
>>  qga/commands-win32.c | 20 +++++++++++++++++++-
>>  qga/qapi-schema.json |  4 ++--
>>  3 files changed, 39 insertions(+), 4 deletions(-)
>
> Hmm, we probably ought to squash in:
>
> diff --git i/tests/test-qga.c w/tests/test-qga.c
> index 6473846..642dcb5 100644
> --- i/tests/test-qga.c
> +++ w/tests/test-qga.c
> @@ -457,7 +457,7 @@ static void test_qga_file_ops(gconstpointer fix)
>      cmd = g_strdup_printf("{'execute': 'guest-file-seek',"
>                            " 'arguments': { 'handle': %" PRId64 ", "
>                            " 'offset': %d, 'whence': %d } }",
> -                          id, 6, SEEK_SET);
> +                          id, 6, 0);
>      ret = qmp_fd(fixture->fd, cmd);
>      qmp_assert_no_error(ret);
>      val = qdict_get_qdict(ret, "return");
>
>

With that fix,

Reviewed-by: Marc-André Lureau <address@hidden>

thanks

-- 
Marc-André Lureau



reply via email to

[Prev in Thread] Current Thread [Next in Thread]