Received: from eggs.gnu.org ([2001:4830:134:3::10]:43948) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1VAs-0004Mb-Hv for qemu-devel@nongnu.org; Wed, 25 Nov 2015 03:11:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1VAo-0007mq-HT for qemu-devel@nongnu.org; Wed, 25 Nov 2015 03:11:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39363) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1VAo-0007mm-Bp for qemu-devel@nongnu.org; Wed, 25 Nov 2015 03:11:30 -0500 From: Markus Armbruster References: <1448391424-32360-1-git-send-email-eblake@redhat.com> <5654B5D3.60809@redhat.com> Date: Wed, 25 Nov 2015 09:11:27 +0100 In-Reply-To: <5654B5D3.60809@redhat.com> (Eric Blake's message of "Tue, 24 Nov 2015 12:09:07 -0700") Message-ID: <878u5mijm8.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH for-2.5] qga: Better mapping of SEEK_* in guest-file-seek List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: mlureau@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com Eric Blake writes: > 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 >> --- >> 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"); Loss in readability, I'm afraid. I think defining and using the obvious enum QGA_SEEK would help.