Make config allocation dynamic

This commit is contained in:
mintsuki 2020-05-11 19:50:55 +02:00
parent 736085120c
commit 5738dc0691
1 changed files with 2 additions and 7 deletions

View File

@ -5,7 +5,6 @@
#include <fs/file.h> #include <fs/file.h>
#define SEPARATOR '\n' #define SEPARATOR '\n'
#define MAX_CONFIG_SIZE 4096
static char *config_addr; static char *config_addr;
@ -18,12 +17,8 @@ int init_config(int drive, int part) {
} }
} }
if (f.size >= MAX_CONFIG_SIZE) { config_addr = balloc(f.size + 1);
panic("Config file is too big."); memset(config_addr, 0, f.size + 1);
}
config_addr = balloc(MAX_CONFIG_SIZE);
memset(config_addr, 0, MAX_CONFIG_SIZE);
fread(&f, config_addr, 0, f.size); fread(&f, config_addr, 0, f.size);