:: commit e2cda1d8218291c09d9464424a981650c03e2d21

mintsuki <mintsuki@protonmail.com> — 2025-02-15 13:26

parents: 6858bbf41c

protos/chainload_next: Drop protocol

diff --git a/CONFIG.md b/CONFIG.md
index 3df57d99..c6a36d3f 100644
--- a/CONFIG.md
+++ b/CONFIG.md
@@ -113,7 +113,7 @@ Editor control options:
 *Locally assignable (non protocol specific) options* are:
 
 * `comment` - An optional comment string that will be displayed by the bootloader on the menu when an entry is selected.
-* `protocol` - The boot protocol that will be used to boot the kernel/executable. Valid protocols are: `linux`, `limine`, `multiboot` (or `multiboot1`), `multiboot2`, `efi`, `bios`, and `chainload_next`.
+* `protocol` - The boot protocol that will be used to boot the kernel/executable. Valid protocols are: `linux`, `limine`, `multiboot` (or `multiboot1`), `multiboot2`, `efi`, and `bios`.
 * `cmdline` - The command line string to be passed to the kernel/executable. Can be omitted.
 * `kernel_cmdline` - Alias of `cmdline`.
 
diff --git a/common/menu.c b/common/menu.c
index 4d08a4cb..434932e6 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -17,7 +17,6 @@
 #include <drivers/vga_textmode.h>
 #include <protos/linux.h>
 #include <protos/chainload.h>
-#include <protos/chainload_next.h>
 #include <protos/multiboot1.h>
 #include <protos/multiboot2.h>
 #include <protos/limine.h>
@@ -1194,8 +1193,6 @@ noreturn void boot(char *config) {
         quiet = false;
         print("Multiboot 2 is not available on non-x86 architectures.\n\n");
 #endif
-    } else if (!strcmp(proto, "chainload_next")) {
-        chainload_next(config, cmdline);
 #if defined (BIOS)
     } else if (!strcmp(proto, "bios_chainload")
             || !strcmp(proto, "bios")) {
diff --git a/common/protos/chainload_next.c b/common/protos/chainload_next.c
deleted file mode 100644
index 09e39b39..00000000
--- a/common/protos/chainload_next.c
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <stddef.h>
-#include <stdint.h>
-#include <stdnoreturn.h>
-#include <protos/chainload_next.h>
-#include <protos/chainload.h>
-#include <lib/misc.h>
-#include <lib/print.h>
-#include <lib/part.h>
-
-#if defined (BIOS)
-static void try(char *config, char *cmdline, struct volume *v) {
-    (void)config;
-    (void)cmdline;
-    bios_chainload_volume(v);
-}
-#endif
-
-#if defined (UEFI)
-static void try(char *config, char *cmdline, struct volume *v) {
-    for (int i = 0; i <= v->max_partition + 1; i++) {
-        struct file_handle *image;
-        struct volume *p = volume_get_by_coord(v->is_optical, v->index, i);
-
-        bool old_cif = case_insensitive_fopen;
-        case_insensitive_fopen = true;
-        if ((image = fopen(p, "/EFI/BOOT/BOOTX64.EFI")) == NULL) {
-            case_insensitive_fopen = old_cif;
-            continue;
-        }
-        case_insensitive_fopen = old_cif;
-
-        efi_chainload_file(config, cmdline, image);
-    }
-}
-#endif
-
-noreturn void chainload_next(char *config, char *cmdline) {
-    bool wrap = false;
-    for (int i = boot_volume->is_optical ? 0 : (wrap = true, boot_volume->index + 1);
-         boot_volume->is_optical ? true : i != boot_volume->index; i++) {
-        struct volume *v = volume_get_by_coord(false, i, 0);
-        if (v == NULL) {
-            if (wrap) {
-                i = 0;
-                continue;
-            } else {
-                break;
-            }
-        }
-
-        try(config, cmdline, v);
-    }
-
-    wrap = false;
-    for (int i = boot_volume->is_optical ? (wrap = true, boot_volume->index + 1) : 0;
-         boot_volume->is_optical ? i != boot_volume->index : true; i++) {
-        struct volume *v = volume_get_by_coord(true, i, 0);
-        if (v == NULL) {
-            if (wrap) {
-                i = 0;
-                continue;
-            } else {
-                break;
-            }
-        }
-
-        try(config, cmdline, v);
-    }
-
-    panic(true, "chainload_next: No other bootable device");
-}
diff --git a/common/protos/chainload_next.h b/common/protos/chainload_next.h
deleted file mode 100644
index 4152857f..00000000
--- a/common/protos/chainload_next.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef PROTOS__CHAINLOAD_NEXT_H__
-#define PROTOS__CHAINLOAD_NEXT_H__
-
-#include <stdnoreturn.h>
-
-noreturn void chainload_next(char *config, char *cmdline);
-
-#endif
tab: 248 wrap: offon