|
|
89b6575 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
89b6575 |
From: Javier Martinez Canillas <javierm@redhat.com>
|
|
|
89b6575 |
Date: Fri, 22 Mar 2019 11:14:26 +0100
|
|
|
89b6575 |
Subject: [PATCH] blscfg: don't use grub_list_t and the GRUB_AS_LIST() macro
|
|
|
89b6575 |
|
|
|
89b6575 |
We are not using GRUB's list functions anyways since we want to add new
|
|
|
89b6575 |
items in the middle ot the list but GRUB's grub_list_push() only allows
|
|
|
89b6575 |
to add new items at the beginning of the list. So don't use grub_list_t
|
|
|
89b6575 |
and GRUB_AS_LIST() macro and just reference struct bls_entry * directly.
|
|
|
89b6575 |
|
|
|
89b6575 |
We can't change GRUB lists API because we want the blscfg module to not
|
|
|
89b6575 |
need external symbols so it can be updated without updating GRUB's core.
|
|
|
89b6575 |
|
|
|
89b6575 |
This also solves a bug where the struct bls_entry .next field wasn't set
|
|
|
89b6575 |
correctly which caused some entries to not be populated in the grub menu.
|
|
|
89b6575 |
|
|
|
89b6575 |
Resolves: rhbz#1691232
|
|
|
89b6575 |
|
|
|
89b6575 |
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
|
|
89b6575 |
---
|
|
|
89b6575 |
grub-core/commands/blscfg.c | 10 +++++-----
|
|
|
89b6575 |
include/grub/menu.h | 2 +-
|
|
|
89b6575 |
2 files changed, 6 insertions(+), 6 deletions(-)
|
|
|
89b6575 |
|
|
|
89b6575 |
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
|
|
|
89b6575 |
index 5635066e3eb..bb93b7f4904 100644
|
|
|
89b6575 |
--- a/grub-core/commands/blscfg.c
|
|
|
89b6575 |
+++ b/grub-core/commands/blscfg.c
|
|
|
89b6575 |
@@ -350,13 +350,13 @@ static int bls_cmp(const struct bls_entry *e0, const struct bls_entry *e1)
|
|
|
89b6575 |
return r;
|
|
|
89b6575 |
}
|
|
|
89b6575 |
|
|
|
89b6575 |
-static void list_add_tail(grub_list_t head, grub_list_t item)
|
|
|
89b6575 |
+static void list_add_tail(struct bls_entry *head, struct bls_entry *item)
|
|
|
89b6575 |
{
|
|
|
89b6575 |
item->next = head;
|
|
|
89b6575 |
if (head->prev)
|
|
|
89b6575 |
- (*head->prev)->next = item;
|
|
|
89b6575 |
+ head->prev->next = item;
|
|
|
89b6575 |
item->prev = head->prev;
|
|
|
89b6575 |
- head->prev = &ite;;
|
|
|
89b6575 |
+ head->prev = item;
|
|
|
89b6575 |
}
|
|
|
89b6575 |
|
|
|
89b6575 |
static int bls_add_entry(struct bls_entry *entry)
|
|
|
89b6575 |
@@ -378,7 +378,7 @@ static int bls_add_entry(struct bls_entry *entry)
|
|
|
89b6575 |
|
|
|
89b6575 |
if (rc == 1) {
|
|
|
89b6575 |
grub_dprintf ("blscfg", "Add entry with id \"%s\"\n", entry->filename);
|
|
|
89b6575 |
- list_add_tail (GRUB_AS_LIST (e), GRUB_AS_LIST (entry));
|
|
|
89b6575 |
+ list_add_tail (e, entry);
|
|
|
89b6575 |
if (e == entries) {
|
|
|
89b6575 |
entries = entry;
|
|
|
89b6575 |
entry->prev = NULL;
|
|
|
89b6575 |
@@ -391,7 +391,7 @@ static int bls_add_entry(struct bls_entry *entry)
|
|
|
89b6575 |
if (last) {
|
|
|
89b6575 |
grub_dprintf ("blscfg", "Add entry with id \"%s\"\n", entry->filename);
|
|
|
89b6575 |
last->next = entry;
|
|
|
89b6575 |
- entry->prev = &las;;
|
|
|
89b6575 |
+ entry->prev = last;
|
|
|
89b6575 |
}
|
|
|
89b6575 |
|
|
|
89b6575 |
return 0;
|
|
|
89b6575 |
diff --git a/include/grub/menu.h b/include/grub/menu.h
|
|
|
89b6575 |
index eea493f74b1..0acdc2aa6bf 100644
|
|
|
89b6575 |
--- a/include/grub/menu.h
|
|
|
89b6575 |
+++ b/include/grub/menu.h
|
|
|
89b6575 |
@@ -23,7 +23,7 @@
|
|
|
89b6575 |
struct bls_entry
|
|
|
89b6575 |
{
|
|
|
89b6575 |
struct bls_entry *next;
|
|
|
89b6575 |
- struct bls_entry **prev;
|
|
|
89b6575 |
+ struct bls_entry *prev;
|
|
|
89b6575 |
struct keyval **keyvals;
|
|
|
89b6575 |
int nkeyvals;
|
|
|
89b6575 |
char *filename;
|