From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UNQ01-0006Aw-Vu for mharc-grub-devel@gnu.org; Wed, 03 Apr 2013 11:53:21 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48991) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNPzy-0006Ao-Uo for grub-devel@gnu.org; Wed, 03 Apr 2013 11:53:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNPzw-0004Sp-9K for grub-devel@gnu.org; Wed, 03 Apr 2013 11:53:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2165) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNPzw-0004Sh-1G for grub-devel@gnu.org; Wed, 03 Apr 2013 11:53:16 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r33FrEja013489 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 3 Apr 2013 11:53:15 -0400 Received: from fenchurch.internal.datastacks.com.com ([10.3.113.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r33FrEL2031867; Wed, 3 Apr 2013 11:53:14 -0400 From: Peter Jones To: grub-devel@gnu.org Subject: [PATCH] Make grub_efidisk_get_device_name() work on 4K native disks. Date: Wed, 3 Apr 2013 11:53:06 -0400 Message-Id: <1365004386-24760-1-git-send-email-pjones@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 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 15:53:20 -0000 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); /* 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; -- 1.8.1.4