From efe9df37915b8fe394c273e13042681d7015e682 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 19 Nov 2013 15:06:30 +0100 Subject: [PATCH] driver settings: Add load_driver_settings_file() Allows loading an already opened driver settings file (by FD). --- headers/os/drivers/driver_settings.h | 1 + src/system/libroot/os/driver_settings.cpp | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/headers/os/drivers/driver_settings.h b/headers/os/drivers/driver_settings.h index 69e8ea1deb..219d18fee9 100644 --- a/headers/os/drivers/driver_settings.h +++ b/headers/os/drivers/driver_settings.h @@ -24,6 +24,7 @@ extern "C" { #endif extern void *load_driver_settings(const char *driverName); +extern void *load_driver_settings_file(int fd); extern status_t unload_driver_settings(void *handle); extern void *parse_driver_settings_string(const char *settingsString); diff --git a/src/system/libroot/os/driver_settings.cpp b/src/system/libroot/os/driver_settings.cpp index 56c4692994..5f7130d72f 100644 --- a/src/system/libroot/os/driver_settings.cpp +++ b/src/system/libroot/os/driver_settings.cpp @@ -409,8 +409,10 @@ new_settings(char *buffer, const char *driverName) handle->text = buffer; #ifdef _KERNEL_MODE - handle->ref_count = 1; - strlcpy(handle->name, driverName, sizeof(handle->name)); + if (driverName != NULL) { + handle->ref_count = 1; + strlcpy(handle->name, driverName, sizeof(handle->name)); + } #endif if (parse_settings(handle) == B_OK) @@ -801,6 +803,13 @@ load_driver_settings(const char *driverName) } +void* +load_driver_settings_file(int fd) +{ + return load_driver_settings_from_file(fd, NULL); +} + + /*! Returns a new driver_settings handle that has the parsed contents of the passed string.