From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42266) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1aiD-0007Qr-4m for qemu-devel@nongnu.org; Wed, 25 Nov 2015 09:06:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1ai9-0002Jl-TL for qemu-devel@nongnu.org; Wed, 25 Nov 2015 09:06:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45623) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1ai9-0002Jg-LO for qemu-devel@nongnu.org; Wed, 25 Nov 2015 09:06:17 -0500 References: <1448391424-32360-1-git-send-email-eblake@redhat.com> <5654B5D3.60809@redhat.com> <878u5mijm8.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <5655C057.7000401@redhat.com> Date: Wed, 25 Nov 2015 07:06:15 -0700 MIME-Version: 1.0 In-Reply-To: <878u5mijm8.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="qM48MlA0oKLmrkBgUGEfiEBrVRPCIvMjh" 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: Markus Armbruster Cc: mlureau@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --qM48MlA0oKLmrkBgUGEfiEBrVRPCIvMjh Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/25/2015 01:11 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> 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 =3D g_strdup_printf("{'execute': 'guest-file-seek'," >> " 'arguments': { 'handle': %" PRId64 ", " >> " 'offset': %d, 'whence': %d } }", >> - id, 6, SEEK_SET); >> + id, 6, 0); >> ret =3D qmp_fd(fixture->fd, cmd); >> qmp_assert_no_error(ret); >> val =3D qdict_get_qdict(ret, "return"); >=20 > Loss in readability, I'm afraid. >=20 > I think defining and using the obvious enum QGA_SEEK would help. Okay, I'll do that for v2. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --qM48MlA0oKLmrkBgUGEfiEBrVRPCIvMjh Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWVcBXAAoJEKeha0olJ0NqQEcIAJdLmG/Nvr348ltZ5klktyZY xINEWhVLFWoBBMJK7QMfb2B25hlmKcPdEhUddw9WCw3fT/011Z8fkh174mUTdcln LBY0iSUAogKXTV7C3MvBUplqVR4DGwxPxqyDjGvRiQm7h5gWXlCTGDJD2OI643pl bT29nudQyoBgGKFsGagCFAAEfBRVGrLvZPSNlHnkCLrXNL5l3fB+9JiopzqhCjBC mrsRaG6YaJycizrwu6GeSjHWZbBaFULsVgGdFQ/7GELprvuxngRyf+FQ8GE/mwyt WebheUkOQyp0fFqFF6O/nWg/IWWR19oixkigRE5cHfx1iaj//smgpi2NiPVmkdc= =x+vt -----END PGP SIGNATURE----- --qM48MlA0oKLmrkBgUGEfiEBrVRPCIvMjh--