summaryrefslogtreecommitdiffstats
path: root/src/core/settings.c
diff options
context:
space:
mode:
authorMichael Brown2010-12-01 17:34:23 +0100
committerMichael Brown2010-12-01 17:35:00 +0100
commit67b45186a572fb051e73fd88d4fc580a0d4d2f6b (patch)
tree9c1b23f9ceab3f9e9bf3ca0563103bc6230c0ee5 /src/core/settings.c
parent[iscsi] Disambiguate the common EINVAL cases (diff)
downloadipxe-67b45186a572fb051e73fd88d4fc580a0d4d2f6b.tar.gz
ipxe-67b45186a572fb051e73fd88d4fc580a0d4d2f6b.tar.xz
ipxe-67b45186a572fb051e73fd88d4fc580a0d4d2f6b.zip
[settings] Apply settings block name in register_settings()
Pass the settings block name as a parameter to register_settings(), rather than defining it with settings_init() (and then possibly changing it by directly manipulating settings->name). Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/settings.c')
-rw-r--r--src/core/settings.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/core/settings.c b/src/core/settings.c
index 8a3660ef..816ae141 100644
--- a/src/core/settings.c
+++ b/src/core/settings.c
@@ -281,9 +281,9 @@ static struct settings * autovivify_child_settings ( struct settings *parent,
return NULL;
}
memcpy ( new_child->name, name, sizeof ( new_child->name ) );
- generic_settings_init ( &new_child->generic, NULL, new_child->name );
+ generic_settings_init ( &new_child->generic, NULL );
settings = &new_child->generic.settings;
- register_settings ( settings, parent );
+ register_settings ( settings, parent, new_child->name );
return settings;
}
@@ -422,9 +422,11 @@ static void reprioritise_settings ( struct settings *settings ) {
*
* @v settings Settings block
* @v parent Parent settings block, or NULL
+ * @v name Settings block name
* @ret rc Return status code
*/
-int register_settings ( struct settings *settings, struct settings *parent ) {
+int register_settings ( struct settings *settings, struct settings *parent,
+ const char *name ) {
struct settings *old_settings;
/* NULL parent => add to settings root */
@@ -432,6 +434,9 @@ int register_settings ( struct settings *settings, struct settings *parent ) {
if ( parent == NULL )
parent = &settings_root;
+ /* Apply settings block name */
+ settings->name = name;
+
/* Remove any existing settings with the same name */
if ( ( old_settings = find_child_settings ( parent, settings->name ) ))
unregister_settings ( old_settings );