dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0254-grub-core-disk-efi-efidisk.c-Handle-partitions-on-no.patch

f96e0b
From c7bee25f2d477017a38009140579ba89de3d27f4 Mon Sep 17 00:00:00 2001
f96e0b
From: Peter Jones <pjones@redhat.com>
f96e0b
Date: Thu, 4 Apr 2013 10:35:50 +0200
f96e0b
Subject: [PATCH 254/482] 	* grub-core/disk/efi/efidisk.c: Handle
f96e0b
 partitions on non-512B disks.
f96e0b
f96e0b
---
f96e0b
 ChangeLog                    |  5 +++++
f96e0b
 grub-core/disk/efi/efidisk.c | 20 ++++++++++++++------
f96e0b
 2 files changed, 19 insertions(+), 6 deletions(-)
f96e0b
f96e0b
diff --git a/ChangeLog b/ChangeLog
f96e0b
index bd9e903..400a071 100644
f96e0b
--- a/ChangeLog
f96e0b
+++ b/ChangeLog
f96e0b
@@ -1,4 +1,9 @@
f96e0b
 2013-04-04  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
+2013-04-04  Peter Jones <pjones@redhat.com>
f96e0b
+
f96e0b
+	* grub-core/disk/efi/efidisk.c: Handle partitions on non-512B disks.
f96e0b
+
f96e0b
+2013-04-04  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
 
f96e0b
 	Use TSC as a possible time source on i386-ieee1275.
f96e0b
 
f96e0b
diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
f96e0b
index c883b2c..0a364f1 100644
f96e0b
--- a/grub-core/disk/efi/efidisk.c
f96e0b
+++ b/grub-core/disk/efi/efidisk.c
f96e0b
@@ -658,10 +658,12 @@ grub_efidisk_get_device_handle (grub_disk_t disk)
f96e0b
 		 == GRUB_EFI_MEDIA_DEVICE_PATH_TYPE)
f96e0b
 		&& (GRUB_EFI_DEVICE_PATH_SUBTYPE (c->last_device_path)
f96e0b
 		    == GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE)
f96e0b
-		&& (grub_partition_get_start (disk->partition)
f96e0b
-		    == hd.partition_start)
f96e0b
+		&& (grub_partition_get_start (disk->partition) 
f96e0b
+		    == (hd.partition_start << (disk->log_sector_size
f96e0b
+					       - GRUB_DISK_SECTOR_BITS)))
f96e0b
 		&& (grub_partition_get_len (disk->partition)
f96e0b
-		    == hd.partition_size))
f96e0b
+		    == (hd.partition_size << (disk->log_sector_size
f96e0b
+					      - GRUB_DISK_SECTOR_BITS))))
f96e0b
 	      {
f96e0b
 		handle = c->handle;
f96e0b
 		break;
f96e0b
@@ -738,8 +740,12 @@ grub_efidisk_get_device_name_iter (grub_disk_t disk __attribute__ ((unused)),
f96e0b
 {
f96e0b
   struct grub_efidisk_get_device_name_ctx *ctx = data;
f96e0b
 
f96e0b
-  if (grub_partition_get_start (part) == ctx->hd.partition_start
f96e0b
-      && grub_partition_get_len (part) == ctx->hd.partition_size)
f96e0b
+  if (grub_partition_get_start (part)
f96e0b
+      == (ctx->hd.partition_start << (disk->log_sector_size
f96e0b
+				      - GRUB_DISK_SECTOR_BITS))
f96e0b
+      && grub_partition_get_len (part)
f96e0b
+      == (ctx->hd.partition_size << (disk->log_sector_size
f96e0b
+				     - GRUB_DISK_SECTOR_BITS)))
f96e0b
     {
f96e0b
       ctx->partition_name = grub_partition_get_name (part);
f96e0b
       return 1;
f96e0b
@@ -798,7 +804,9 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
f96e0b
       ctx.partition_name = NULL;
f96e0b
       grub_memcpy (&ctx.hd, ldp, sizeof (ctx.hd));
f96e0b
       if (ctx.hd.partition_start == 0
f96e0b
-	  && ctx.hd.partition_size == grub_disk_get_size (parent))
f96e0b
+	  && (ctx.hd.partition_size << (parent->log_sector_size
f96e0b
+					- GRUB_DISK_SECTOR_BITS))
f96e0b
+	      == grub_disk_get_size (parent))
f96e0b
 	{
f96e0b
 	  dev_name = grub_strdup (parent->name);
f96e0b
 	}
f96e0b
-- 
f96e0b
1.8.2.1
f96e0b