summaryrefslogtreecommitdiffstats
path: root/src/core/settings.c
diff options
context:
space:
mode:
authorMichael Brown2006-12-12 16:49:46 +0100
committerMichael Brown2006-12-12 16:49:46 +0100
commit007ca97f25c20971ebfd2032db7e305351bac5d8 (patch)
tree97ecf77bf6bc539807270315db519e48c375bf3b /src/core/settings.c
parentCope with system(""). (diff)
downloadipxe-007ca97f25c20971ebfd2032db7e305351bac5d8.tar.gz
ipxe-007ca97f25c20971ebfd2032db7e305351bac5d8.tar.xz
ipxe-007ca97f25c20971ebfd2032db7e305351bac5d8.zip
Added clear_setting()
Diffstat (limited to 'src/core/settings.c')
-rw-r--r--src/core/settings.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/core/settings.c b/src/core/settings.c
index 650673be..3eface4b 100644
--- a/src/core/settings.c
+++ b/src/core/settings.c
@@ -115,7 +115,8 @@ find_or_build_config_setting ( const char *name,
return setting;
}
-/** Show value of setting
+/**
+ * Show value of setting
*
* @v context Configuration context
* @v name Configuration setting name
@@ -134,7 +135,8 @@ int show_setting ( struct config_context *context, const char *name,
return setting->type->show ( context, setting, buf, len );
}
-/** Set value of setting
+/**
+ * Set value of setting
*
* @v context Configuration context
* @v name Configuration setting name
@@ -153,6 +155,27 @@ int set_setting ( struct config_context *context, const char *name,
}
/**
+ * Clear setting
+ *
+ * @v context Configuration context
+ * @v name Configuration setting name
+ * @ret rc Return status code
+ */
+int clear_setting ( struct config_context *context, const char *name ) {
+ struct config_setting *setting;
+ struct config_setting tmp_setting;
+
+ setting = find_or_build_config_setting ( name, &tmp_setting );
+ if ( ! setting )
+ return -ENOENT;
+
+ /* All types of settings get cleared the same way */
+ delete_dhcp_option ( context->options, setting->tag );
+
+ return 0;
+}
+
+/**
* Show value of string setting
*
* @v context Configuration context