summaryrefslogtreecommitdiffstats
path: root/src/core/settings.c
diff options
context:
space:
mode:
authorMichael Brown2008-03-21 00:42:11 +0100
committerMichael Brown2008-03-21 00:42:11 +0100
commiteae6ac3d0bdb5f25193af9584db4eec9dd5226c9 (patch)
tree054766fb4978ee8ef4ea2dc7ad985f92a0689be6 /src/core/settings.c
parent[Settings] Introduce settings applicators. (diff)
downloadipxe-eae6ac3d0bdb5f25193af9584db4eec9dd5226c9.tar.gz
ipxe-eae6ac3d0bdb5f25193af9584db4eec9dd5226c9.tar.xz
ipxe-eae6ac3d0bdb5f25193af9584db4eec9dd5226c9.zip
[Settings] Convert code in src/usr to use settings API.
Diffstat (limited to 'src/core/settings.c')
-rw-r--r--src/core/settings.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/src/core/settings.c b/src/core/settings.c
index 458ba111..3f961bcd 100644
--- a/src/core/settings.c
+++ b/src/core/settings.c
@@ -156,16 +156,14 @@ static void reprioritise_settings ( struct settings *settings ) {
return;
/* Read priority, if present */
- priority = 0;
- fetch_int_setting ( settings, DHCP_EB_PRIORITY, &priority );
+ priority = fetch_intz_setting ( settings, DHCP_EB_PRIORITY );
/* Remove from siblings list */
list_del ( &settings->siblings );
/* Reinsert after any existing blocks which have a higher priority */
list_for_each_entry ( tmp, &parent->children, siblings ) {
- tmp_priority = 0;
- fetch_int_setting ( tmp, DHCP_EB_PRIORITY, &tmp_priority );
+ tmp_priority = fetch_intz_setting ( tmp, DHCP_EB_PRIORITY );
if ( priority > tmp_priority )
break;
}
@@ -441,6 +439,35 @@ int fetch_uint_setting ( struct settings *settings, unsigned int tag,
return len;
}
+/**
+ * Fetch value of signed integer setting, or zero
+ *
+ * @v settings Settings block, or NULL to search all blocks
+ * @v tag Setting tag number
+ * @ret value Setting value, or zero
+ */
+long fetch_intz_setting ( struct settings *settings, unsigned int tag ) {
+ long value = 0;
+
+ fetch_int_setting ( settings, tag, &value );
+ return value;
+}
+
+/**
+ * Fetch value of unsigned integer setting, or zero
+ *
+ * @v settings Settings block, or NULL to search all blocks
+ * @v tag Setting tag number
+ * @ret value Setting value, or zero
+ */
+unsigned long fetch_uintz_setting ( struct settings *settings,
+ unsigned int tag ) {
+ unsigned long value = 0;
+
+ fetch_uint_setting ( settings, tag, &value );
+ return value;
+}
+
/******************************************************************************
*
* Named and typed setting routines