config: Drop support for legacy config format
diff --git a/common/entry.s3.c b/common/entry.s3.c
index c080599b..2b873446 100644
--- a/common/entry.s3.c
+++ b/common/entry.s3.c
@@ -109,14 +109,8 @@ could_not_match:
goto opened;
}
- if ((f = fopen(volume_index[i], "/limine.cfg")) == NULL
- && (f = fopen(volume_index[i], "/limine/limine.cfg")) == NULL
- && (f = fopen(volume_index[i], "/boot/limine.cfg")) == NULL
- && (f = fopen(volume_index[i], "/boot/limine/limine.cfg")) == NULL
- && (f = fopen(volume_index[i], "/EFI/BOOT/limine.cfg")) == NULL) {
- case_insensitive_fopen = old_cif;
- continue;
- }
+ case_insensitive_fopen = old_cif;
+ continue;
opened:
case_insensitive_fopen = old_cif;
diff --git a/common/lib/config.c b/common/lib/config.c
index ab36f00c..4aa6d461 100644
--- a/common/lib/config.c
+++ b/common/lib/config.c
@@ -27,8 +27,6 @@ no_unwind bool bad_config = false;
static char *config_addr;
-bool config_format_old = false;
-
int init_config_disk(struct volume *part) {
struct file_handle *f;
@@ -42,16 +40,8 @@ int init_config_disk(struct volume *part) {
goto opened;
}
- if ((f = fopen(part, "/limine.cfg")) == NULL
- && (f = fopen(part, "/limine/limine.cfg")) == NULL
- && (f = fopen(part, "/boot/limine.cfg")) == NULL
- && (f = fopen(part, "/boot/limine/limine.cfg")) == NULL
- && (f = fopen(part, "/EFI/BOOT/limine.cfg")) == NULL) {
- case_insensitive_fopen = old_cif;
- return -1;
- }
-
- config_format_old = true;
+ case_insensitive_fopen = old_cif;
+ return -1;
opened:
case_insensitive_fopen = old_cif;
@@ -137,9 +127,9 @@ static int is_child(char *buf, size_t limit,
if (strlen(buf) < current_depth + 1)
return NOT_CHILD;
for (size_t j = 0; j < current_depth; j++)
- if (buf[j] != (config_format_old ? ':' : '/'))
+ if (buf[j] != '/')
return NOT_CHILD;
- if (buf[current_depth] == (config_format_old ? ':' : '/'))
+ if (buf[current_depth] == '/')
return INDIRECT_CHILD;
return DIRECT_CHILD;
}
@@ -437,7 +427,7 @@ overflow:
size_t s;
char *c = config_get_entry(&s, 0);
if (c != NULL) {
- while (*c != (config_format_old ? ':' : '/')) {
+ while (*c != '/') {
c--;
}
if (c > config_addr) {
@@ -455,7 +445,7 @@ static bool config_get_entry_name(char *ret, size_t index, size_t limit) {
char *p = config_addr;
for (size_t i = 0; i <= index; i++) {
- while (*p != (config_format_old ? ':' : '/')) {
+ while (*p != '/') {
if (!*p)
return false;
p++;
@@ -486,7 +476,7 @@ static char *config_get_entry(size_t *size, size_t index) {
char *p = config_addr;
for (size_t i = 0; i <= index; i++) {
- while (*p != (config_format_old ? ':' : '/')) {
+ while (*p != '/') {
if (!*p)
return NULL;
p++;
@@ -503,7 +493,7 @@ static char *config_get_entry(size_t *size, size_t index) {
ret = p;
cont:
- while (*p != (config_format_old ? ':' : '/') && *p)
+ while (*p != '/' && *p)
p++;
if (*p && *(p - 1) != '\n') {
@@ -554,16 +544,14 @@ char *config_get_value(const char *config, size_t index, const char *key) {
size_t key_len = strlen(key);
for (size_t i = 0; config[i]; i++) {
- if (!(config_format_old ? strncmp : strncasecmp)(&config[i], key, key_len) && config[i + key_len] == (config_format_old ? '=' : ':')) {
+ if (!strncasecmp(&config[i], key, key_len) && config[i + key_len] == ':') {
if (i && config[i - 1] != SEPARATOR)
continue;
if (index--)
continue;
i += key_len + 1;
- if (!config_format_old) {
- while (config[i] == ' ' || config[i] == '\t') {
- i++;
- }
+ while (config[i] == ' ' || config[i] == '\t') {
+ i++;
}
size_t value_len;
for (value_len = 0;
diff --git a/common/lib/config.h b/common/lib/config.h
index 4921d563..00c8094c 100644
--- a/common/lib/config.h
+++ b/common/lib/config.h
@@ -23,7 +23,6 @@ struct conf_tuple {
char *value2;
};
-extern bool config_format_old;
extern struct menu_entry *menu_tree;
int init_config_disk(struct volume *part);
diff --git a/common/lib/uri.c b/common/lib/uri.c
index 9ffff653..2d0296d9 100644
--- a/common/lib/uri.c
+++ b/common/lib/uri.c
@@ -25,26 +25,26 @@ bool uri_resolve(char *uri, char **resource, char **root, char **path, char **ha
// Get resource
for (size_t i = 0; ; i++) {
- if (strlen(uri + i) < (config_format_old ? 3 : 1))
+ if (strlen(uri + i) < 1)
return false;
- if (!memcmp(uri + i, (config_format_old ? "://" : "("), (config_format_old ? 3 : 1))) {
+ if (!memcmp(uri + i, "(", 1)) {
*resource = uri;
uri[i] = 0;
- uri += i + (config_format_old ? 3 : 1);
+ uri += i + 1;
break;
}
}
// Get root
for (size_t i = 0; ; i++) {
- if (strlen(uri + i) < (config_format_old ? 1 : 3))
+ if (strlen(uri + i) < 3)
return false;
- if (!memcmp(uri + i, (config_format_old ? "/" : "):/"), (config_format_old ? 1 : 3))) {
+ if (!memcmp(uri + i, "):/", 3)) {
*root = uri;
uri[i] = 0;
- uri += i + (config_format_old ? 1 : 3);
+ uri += i + 3;
break;
}
}
diff --git a/common/menu.c b/common/menu.c
index fd623691..7aa900fa 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -132,18 +132,18 @@ static int validate_line(const char *buffer) {
char keybuf[64];
size_t i;
for (i = 0; buffer[i] && i < 64; i++) {
- if (buffer[i] == (config_format_old ? '=' : ':')) goto found_equals;
+ if (buffer[i] == ':') goto found_equals;
keybuf[i] = buffer[i];
}
fail:
if (i < 64) keybuf[i] = 0;
- if (keybuf[0] == '\n' || (!keybuf[0] && buffer[0] != (config_format_old ? '=' : ':'))) return TOK_KEY; // blank line is valid
+ if (keybuf[0] == '\n' || (!keybuf[0] && buffer[0] != ':')) return TOK_KEY; // blank line is valid
invalid_syntax = true;
return TOK_BADKEY;
found_equals:
if (i < 64) keybuf[i] = 0;
for (i = 0; VALID_KEYS[i]; i++) {
- if (!(config_format_old ? strcmp : strcasecmp)(keybuf, VALID_KEYS[i])) {
+ if (!strcasecmp(keybuf, VALID_KEYS[i])) {
return TOK_KEY;
}
}
@@ -307,7 +307,7 @@ refresh:
}
// switch to token type 1 if equals sign
- if (token_type == TOK_KEY && buffer[i] == (config_format_old ? '=' : ':')) token_type = TOK_EQUALS;
+ if (token_type == TOK_KEY && buffer[i] == ':') token_type = TOK_EQUALS;
tab_part:
if (buffer[i] != 0 && line_offset % line_size == line_size - 1) {
@@ -883,21 +883,6 @@ noreturn void _menu(bool first_run) {
skip_timeout = true;
}
- if (first_run && config_format_old) {
- quiet = false;
- print("The format of the config file has changed in Limine version 8.x.\n");
- print("\n");
- print("If the config file is named limine.cfg, Limine will still support the old\n");
- print("configuration format for the time being, but this warning and associated 20\n");
- print("second timeout will persist.\n");
- print("\n");
- print("To get rid of this warning, please update the config to the new format and\n");
- print("rename it to limine.conf instead.\n");
- print("\n");
- print("[press a key to dismiss this warning]\n");
- pit_sleep_and_quit_on_keypress(20);
- }
-
if (!skip_timeout && !timeout) {
if (max_entries == 0 || selected_menu_entry->sub != NULL) {
quiet = false;
diff --git a/common/protos/limine.c b/common/protos/limine.c
index c3e7cd92..7c870881 100644
--- a/common/protos/limine.c
+++ b/common/protos/limine.c
@@ -1146,14 +1146,12 @@ FEAT_START
}
strcpy(module_path_abs_p, k_resource);
module_path_abs_p += strlen(k_resource);
- strcpy(module_path_abs_p, (config_format_old ? "://" : "("));
- module_path_abs_p += (config_format_old ? 3 : 1);
+ strcpy(module_path_abs_p, "(");
+ module_path_abs_p += 1;
strcpy(module_path_abs_p, k_root);
module_path_abs_p += strlen(k_root);
- if (!config_format_old) {
- strcpy(module_path_abs_p, "):");
- module_path_abs_p += 2;
- }
+ strcpy(module_path_abs_p, "):");
+ module_path_abs_p += 2;
get_absolute_path(module_path_abs_p, module_path, k_path);
module_path = module_path_abs;
