From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UNSyS-0007WW-U1 for mharc-grub-devel@gnu.org; Wed, 03 Apr 2013 15:03:56 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44837) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNSyQ-0007Vr-3O for grub-devel@gnu.org; Wed, 03 Apr 2013 15:03:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNSyP-0000F2-8N for grub-devel@gnu.org; Wed, 03 Apr 2013 15:03:54 -0400 Received: from mail-lb0-f175.google.com ([209.85.217.175]:39530) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNSyP-0000Dp-0u for grub-devel@gnu.org; Wed, 03 Apr 2013 15:03:53 -0400 Received: by mail-lb0-f175.google.com with SMTP id o10so1931669lbi.20 for ; Wed, 03 Apr 2013 12:03:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:subject:message-id:in-reply-to:references :x-mailer:mime-version:content-type:content-transfer-encoding; bh=h8xb2lVaYCVNE4SeRK9MJJEWOaPOoyl7++5Bz92x15s=; b=HlBzx4vDRVDq2I8sdgPDJqqzflejg7aIdPl1jAxsjAn00riVkt859ZHoguaL+MNV+L JY+jVUgnv05M0IXluLtumsFTGFlBMc0VdhxtRmE7TSevg+tBt0H5yD2U91YV3D1Tvadd uGkq0M/KzPDWO2wO1EYMjwrmF9LJllap1tsZU8I8Eqncdc+LnWpLyxMJJB2bM14oXqG8 ms4uwJqXtGBuR0aREtcrA/jyB5o8fv2sDMjrQwh5WsFwM44etpYO1v9DPh1Wubq8Y5ep oWeHYjW0R11EcupJ1MinXBKUJpo5QbWEHfv6v/gFh5OS6TXGlt26sOYpsGrnzkYUvfP2 rpzQ== X-Received: by 10.112.26.202 with SMTP id n10mr1776088lbg.15.1365015830767; Wed, 03 Apr 2013 12:03:50 -0700 (PDT) Received: from opensuse.site ([94.29.72.160]) by mx.google.com with ESMTPS id x9sm2802816lbi.15.2013.04.03.12.03.49 (version=SSLv3 cipher=RC4-SHA bits=128/128); Wed, 03 Apr 2013 12:03:50 -0700 (PDT) Date: Wed, 3 Apr 2013 23:03:46 +0400 From: Andrey Borzenkov To: grub-devel@gnu.org Subject: Re: [PATCH] Make grub_efidisk_get_device_name() work on 4K native disks. Message-ID: <20130403230346.01b981c2@opensuse.site> In-Reply-To: <1365004386-24760-1-git-send-email-pjones@redhat.com> References: <1365004386-24760-1-git-send-email-pjones@redhat.com> X-Mailer: Claws Mail 3.9.0 (GTK+ 2.24.14; x86_64-suse-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.217.175 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Apr 2013 19:03:55 -0000 В Wed, 3 Apr 2013 11:53:06 -0400 Peter Jones пишет: > When we have 4kB sectors instead of 512b sectors, hd.partition_start and > grub_partition_get_start() won't match - the latter assumes 512-byte > sectors, and the former gives us the correct number based on the > physical media's sector size. So when we have to compare them, we need > to compensate. > > Signed-off-by: Peter Jones > --- > grub-core/disk/efi/efidisk.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c > index 77ab5b0..a905b52 100644 > --- a/grub-core/disk/efi/efidisk.c > +++ b/grub-core/disk/efi/efidisk.c > @@ -791,11 +791,13 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle) > auto int find_partition (grub_disk_t disk, const grub_partition_t part); > You need to rebase to current trunk which does not use nested functions anymore. Also in current trunk there is second use of grub_partition_get_start() which looks like it has the same issue. > /* Find the identical partition. */ > - int find_partition (grub_disk_t disk __attribute__ ((unused)), > - const grub_partition_t part) > + int find_partition (grub_disk_t disk, const grub_partition_t part) > { > - if (grub_partition_get_start (part) == hd.partition_start > - && grub_partition_get_len (part) == hd.partition_size) > + struct grub_efidisk_data *d = disk->data; > + grub_efi_block_io_media_t *m = d->block_io->media; > + > + if (grub_partition_get_start (part) / (m->block_size / 512) == hd.partition_start > + && grub_partition_get_len (part) / (m->block_size / 512) == hd.partition_size) > { > partition_name = grub_partition_get_name (part); > return 1;