mirror of
https://src.fedoraproject.org/rpms/grub2.git
synced 2024-12-01 00:48:18 +00:00
f74b50e380
Signed-off-by: Peter Jones <pjones@redhat.com>
87 lines
2.3 KiB
Diff
87 lines
2.3 KiB
Diff
From 0e882e0c48a93f7e187fd403ffb32d3ad861ee77 Mon Sep 17 00:00:00 2001
|
|
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
|
|
Date: Mon, 15 Apr 2013 00:38:39 +0200
|
|
Subject: [PATCH 313/482] * grub-core/disk/ieee1275/ofdisk.c: Fix CD-ROM
|
|
and boot device detection.
|
|
|
|
---
|
|
ChangeLog | 5 +++++
|
|
grub-core/disk/ieee1275/ofdisk.c | 21 +++++++++++++++++++--
|
|
2 files changed, 24 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/ChangeLog b/ChangeLog
|
|
index a4d9555..b372668 100644
|
|
--- a/ChangeLog
|
|
+++ b/ChangeLog
|
|
@@ -1,3 +1,8 @@
|
|
+2013-04-15 Vladimir Serbinenko <phcoder@gmail.com>
|
|
+
|
|
+ * grub-core/disk/ieee1275/ofdisk.c: Fix CD-ROM and boot device
|
|
+ detection.
|
|
+
|
|
2013-04-14 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
|
* grub-core/lib/posix_wrap/sys/types.h: Make WORDS_BIGENDIAN definition
|
|
diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c
|
|
index bebf777..ec92c4d 100644
|
|
--- a/grub-core/disk/ieee1275/ofdisk.c
|
|
+++ b/grub-core/disk/ieee1275/ofdisk.c
|
|
@@ -32,6 +32,7 @@ struct ofdisk_hash_ent
|
|
{
|
|
char *devpath;
|
|
int is_boot;
|
|
+ int is_cdrom;
|
|
/* Pointer to shortest available name on nodes representing canonical names,
|
|
otherwise NULL. */
|
|
const char *shortest;
|
|
@@ -80,6 +81,18 @@ ofdisk_hash_add_real (char *devpath)
|
|
return p;
|
|
}
|
|
|
|
+static int
|
|
+check_string_cdrom (const char *str)
|
|
+{
|
|
+ const char *ptr = grub_strrchr (str, '/');
|
|
+
|
|
+ if (ptr)
|
|
+ ptr++;
|
|
+ else
|
|
+ ptr = str;
|
|
+ return (grub_strncmp (ptr, "cdrom", 5) == 0);
|
|
+}
|
|
+
|
|
static struct ofdisk_hash_ent *
|
|
ofdisk_hash_add (char *devpath, char *curcan)
|
|
{
|
|
@@ -92,6 +105,8 @@ ofdisk_hash_add (char *devpath, char *curcan)
|
|
if (!curcan)
|
|
{
|
|
p->shortest = devpath;
|
|
+ if (check_string_cdrom (devpath))
|
|
+ p->is_cdrom = 1;
|
|
return p;
|
|
}
|
|
|
|
@@ -101,6 +116,9 @@ ofdisk_hash_add (char *devpath, char *curcan)
|
|
else
|
|
grub_free (curcan);
|
|
|
|
+ if (check_string_cdrom (devpath) || check_string_cdrom (curcan))
|
|
+ pcan->is_cdrom = 1;
|
|
+
|
|
if (!pcan)
|
|
grub_errno = GRUB_ERR_NONE;
|
|
else
|
|
@@ -267,8 +285,7 @@ grub_ofdisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data,
|
|
}
|
|
}
|
|
|
|
- if (grub_strncmp (ent->shortest, "cdrom", 5) == 0
|
|
- || ent->is_boot)
|
|
+ if (!ent->is_boot && ent->is_cdrom)
|
|
continue;
|
|
|
|
{
|
|
--
|
|
1.8.2.1
|
|
|