driver settings: Add load_driver_settings_file()

Allows loading an already opened driver settings file (by FD).
This commit is contained in:
Ingo Weinhold 2013-11-19 15:06:30 +01:00
parent cf09345cf5
commit efe9df3791
2 changed files with 12 additions and 2 deletions

View File

@ -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);

View File

@ -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.