* Cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32683 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
03e8d9bdf3
commit
f8ebd1a328
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2008, Rene Gollent, rene@gollent.com. All rights reserved.
|
||||
* Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
* Copyright 2005-2009, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@ -22,7 +22,8 @@
|
||||
static driver_settings_file*
|
||||
find_driver_settings_file(const char* name)
|
||||
{
|
||||
for (driver_settings_file *file = gKernelArgs.driver_settings; file != NULL; file = file->next) {
|
||||
for (driver_settings_file* file = gKernelArgs.driver_settings; file != NULL;
|
||||
file = file->next) {
|
||||
if (!strcmp(file->name, name))
|
||||
return file;
|
||||
}
|
||||
@ -48,7 +49,8 @@ load_driver_settings_file(Directory *directory, const char *name)
|
||||
if (read(fd, buffer, stat.st_size) != stat.st_size)
|
||||
return B_IO_ERROR;
|
||||
|
||||
driver_settings_file *file = (driver_settings_file *)kernel_args_malloc(sizeof(driver_settings_file));
|
||||
driver_settings_file* file = (driver_settings_file*)kernel_args_malloc(
|
||||
sizeof(driver_settings_file));
|
||||
if (file == NULL) {
|
||||
kernel_args_free(buffer);
|
||||
return B_NO_MEMORY;
|
||||
@ -69,6 +71,9 @@ load_driver_settings_file(Directory *directory, const char *name)
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
status_t
|
||||
load_driver_settings(stage2_args* /*args*/, Directory* volume)
|
||||
{
|
||||
@ -95,7 +100,7 @@ load_driver_settings(stage2_args */*args*/, Directory *volume)
|
||||
settings->Close(cookie);
|
||||
}
|
||||
|
||||
// check if a kernel settings file exists
|
||||
// Check if a kernel settings file exists
|
||||
// if it does, prepend it to the safe mode settings. This allows the
|
||||
// settings from the kernel file to take effect while still allowing
|
||||
// overrides by safe mode since the settings are searched
|
||||
@ -103,27 +108,24 @@ load_driver_settings(stage2_args */*args*/, Directory *volume)
|
||||
// disable_smp
|
||||
driver_settings_file* kernelFile = find_driver_settings_file("kernel");
|
||||
if (kernelFile != NULL) {
|
||||
driver_settings_file *safemodeFile =
|
||||
find_driver_settings_file(B_SAFEMODE_DRIVER_SETTINGS);
|
||||
driver_settings_file* safemodeFile
|
||||
= find_driver_settings_file(B_SAFEMODE_DRIVER_SETTINGS);
|
||||
if (safemodeFile != NULL) {
|
||||
char* buffer = (char*)kernel_args_malloc(
|
||||
safemodeFile->size + kernelFile->size + 2);
|
||||
if (buffer != NULL) {
|
||||
memcpy(buffer, kernelFile->buffer,
|
||||
kernelFile->size);
|
||||
memcpy(buffer, kernelFile->buffer, kernelFile->size);
|
||||
|
||||
// insert a newline just in case the kernel settings file
|
||||
// doesn't end with one
|
||||
buffer[kernelFile->size] = '\n';
|
||||
|
||||
memcpy(buffer + kernelFile->size + 1,
|
||||
safemodeFile->buffer,
|
||||
memcpy(buffer + kernelFile->size + 1, safemodeFile->buffer,
|
||||
safemodeFile->size);
|
||||
|
||||
kernel_args_free(safemodeFile->buffer);
|
||||
safemodeFile->buffer = buffer;
|
||||
safemodeFile->size = safemodeFile->size +
|
||||
kernelFile->size + 1;
|
||||
safemodeFile->size = safemodeFile->size + kernelFile->size + 1;
|
||||
buffer[safemodeFile->size] = '\0';
|
||||
}
|
||||
} else
|
||||
@ -137,11 +139,11 @@ load_driver_settings(stage2_args */*args*/, Directory *volume)
|
||||
status_t
|
||||
add_stage2_driver_settings(stage2_args* args)
|
||||
{
|
||||
const char **p = args->arguments;
|
||||
// TODO: split more intelligently
|
||||
for (; p && *p; p++) {
|
||||
dprintf("adding args: '%s'\n", *p);
|
||||
add_safe_mode_settings((char *)*p);
|
||||
for (const char** arg = args->arguments;
|
||||
arg != NULL && arg[0] != NULL; arg++) {
|
||||
dprintf("adding args: '%s'\n", arg[0]);
|
||||
add_safe_mode_settings((char*)arg[0]);
|
||||
}
|
||||
return B_OK;
|
||||
}
|
||||
@ -158,7 +160,8 @@ add_safe_mode_settings(char *settings)
|
||||
if (buffer == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
driver_settings_file *file = (driver_settings_file *)kernel_args_malloc(sizeof(driver_settings_file));
|
||||
driver_settings_file* file = (driver_settings_file*)kernel_args_malloc(
|
||||
sizeof(driver_settings_file));
|
||||
if (file == NULL) {
|
||||
kernel_args_free(buffer);
|
||||
return B_NO_MEMORY;
|
||||
@ -175,4 +178,3 @@ add_safe_mode_settings(char *settings)
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user