From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41399) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SmiBF-0003Nd-5j for qemu-devel@nongnu.org; Thu, 05 Jul 2012 05:17:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SmiB9-0005z7-0u for qemu-devel@nongnu.org; Thu, 05 Jul 2012 05:16:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3947) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SmiB8-0005z3-P8 for qemu-devel@nongnu.org; Thu, 05 Jul 2012 05:16:50 -0400 Message-ID: <4FF55B7C.6020004@redhat.com> Date: Thu, 05 Jul 2012 11:16:44 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <1340984094-5451-1-git-send-email-armbru@redhat.com> <1340984094-5451-14-git-send-email-armbru@redhat.com> In-Reply-To: <1340984094-5451-14-git-send-email-armbru@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 13/32] hd-geometry: Clean up confusing use of prior translation hint List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: pbonzini@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org, stefanha@linux.vnet.ibm.com Am 29.06.2012 17:34, schrieb Markus Armbruster: > When hd_geometry_guess() picks a geometry, it also picks the > appropriate translation, but only when the prior translation hint is > BIOS_ATA_TRANSLATION_AUTO. Looks wrong, because such a prior > translation would be passed to the BIOS whether it's suitable for the > geometry or not. > > Fortunately, that can't happen. There are just two ways to for the s/to// > translation hint to get set to something other than > BIOS_ATA_TRANSLATION_AUTO: drive_init() on behalf of -drive trans=..., > and hd_geometry_guess(). Both set it only when they also set a valid > geometry hint, i.e. one with a non-zero number of cylinders. > > Since hd_geometry_guess() returns right away when it finds a valid > geometry hint, translation can only be BIOS_ATA_TRANSLATION_AUTO in > the remainder of the function. > > Assert this, and simplify accordingly. > > Signed-off-by: Markus Armbruster > --- > hw/hd-geometry.c | 17 +++++++---------- > 1 files changed, 7 insertions(+), 10 deletions(-) Kevin