summaryrefslogtreecommitdiffstats
path: root/src/core/nvo.c
diff options
context:
space:
mode:
authorMichael Brown2008-03-25 21:46:16 +0100
committerMichael Brown2008-03-25 21:46:16 +0100
commit92d15eff30410dcb0ec406e06b131fb7d9179ffd (patch)
tree191d29013372b541d353bbfa55114b8060dd557c /src/core/nvo.c
parent[PXEXT] Avoid returning a false EOF when we have an empty buffer queued (diff)
downloadipxe-92d15eff30410dcb0ec406e06b131fb7d9179ffd.tar.gz
ipxe-92d15eff30410dcb0ec406e06b131fb7d9179ffd.tar.xz
ipxe-92d15eff30410dcb0ec406e06b131fb7d9179ffd.zip
[Settings] Remove assumption that all settings have DHCP tag values
Allow for settings to be described by something other than a DHCP option tag if desirable. Currently used only for the MAC address setting. Separate out fake DHCP packet creation code from dhcp.c to fakedhcp.c. Remove notion of settings from dhcppkt.c. Rationalise dhcp.c to use settings API only for final registration of the DHCP options, rather than using {store,fetch}_setting throughout.
Diffstat (limited to 'src/core/nvo.c')
-rw-r--r--src/core/nvo.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/core/nvo.c b/src/core/nvo.c
index 951539f1..13078022 100644
--- a/src/core/nvo.c
+++ b/src/core/nvo.c
@@ -138,19 +138,20 @@ static void nvo_init_dhcpopts ( struct nvo_block *nvo ) {
* Store value of NVO setting
*
* @v settings Settings block
- * @v tag Setting tag number
+ * @v setting Setting to store
* @v data Setting data, or NULL to clear setting
* @v len Length of setting data
* @ret rc Return status code
*/
-static int nvo_store ( struct settings *settings, unsigned int tag,
+static int nvo_store ( struct settings *settings, struct setting *setting,
const void *data, size_t len ) {
struct nvo_block *nvo =
container_of ( settings, struct nvo_block, settings );
int rc;
/* Update stored options */
- if ( ( rc = dhcpopt_store ( &nvo->dhcpopts, tag, data, len ) ) != 0 ) {
+ if ( ( rc = dhcpopt_store ( &nvo->dhcpopts, setting->tag,
+ data, len ) ) != 0 ) {
DBGC ( nvo, "NVO %p could not store %zd bytes: %s\n",
nvo, len, strerror ( rc ) );
return rc;
@@ -167,7 +168,7 @@ static int nvo_store ( struct settings *settings, unsigned int tag,
* Fetch value of NVO setting
*
* @v settings Settings block
- * @v tag Setting tag number
+ * @v setting Setting to fetch
* @v data Buffer to fill with setting data
* @v len Length of buffer
* @ret len Length of setting data, or negative error
@@ -175,12 +176,12 @@ static int nvo_store ( struct settings *settings, unsigned int tag,
* The actual length of the setting will be returned even if
* the buffer was too small.
*/
-static int nvo_fetch ( struct settings *settings, unsigned int tag,
+static int nvo_fetch ( struct settings *settings, struct setting *setting,
void *data, size_t len ) {
struct nvo_block *nvo =
container_of ( settings, struct nvo_block, settings );
- return dhcpopt_fetch ( &nvo->dhcpopts, tag, data, len );
+ return dhcpopt_fetch ( &nvo->dhcpopts, setting->tag, data, len );
}
/** NVO settings operations */