diff options
author | Michael Brown | 2013-12-03 17:48:56 +0100 |
---|---|---|
committer | Michael Brown | 2013-12-05 01:37:02 +0100 |
commit | 22001cb206c1320aee27f679a63d2171d35e99c5 (patch) | |
tree | a972bb914371a68d4925dcc007238dcb836546ba /src/drivers/block/ibft.c | |
parent | [fbcon] Add support for displaying a cursor (diff) | |
download | ipxe-22001cb206c1320aee27f679a63d2171d35e99c5.tar.gz ipxe-22001cb206c1320aee27f679a63d2171d35e99c5.tar.xz ipxe-22001cb206c1320aee27f679a63d2171d35e99c5.zip |
[settings] Explicitly separate the concept of a completed fetched setting
The fetch_setting() family of functions may currently modify the
definition of the specified setting (e.g. to add missing type
information). Clean up this interface by requiring callers to provide
an explicit buffer to contain the completed definition of the fetched
setting, if required.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/block/ibft.c')
-rw-r--r-- | src/drivers/block/ibft.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/drivers/block/ibft.c b/src/drivers/block/ibft.c index 75ca51a9..0700f8c4 100644 --- a/src/drivers/block/ibft.c +++ b/src/drivers/block/ibft.c @@ -107,7 +107,7 @@ static void ibft_set_ipaddr ( struct ibft_ipaddr *ipaddr, struct in_addr in ) { * @v count Maximum number of IP addresses */ static void ibft_set_ipaddr_setting ( struct ibft_ipaddr *ipaddr, - struct setting *setting, + const struct setting *setting, unsigned int count ) { struct in_addr in[count]; unsigned int i; @@ -183,11 +183,13 @@ static int ibft_set_string ( struct ibft_strings *strings, */ static int ibft_set_string_setting ( struct ibft_strings *strings, struct ibft_string *string, - struct setting *setting ) { + const struct setting *setting ) { + struct settings *origin; + struct setting fetched; int len; char *dest; - len = fetch_setting_len ( NULL, setting ); + len = fetch_setting ( NULL, setting, &origin, &fetched, NULL, 0 ); if ( len < 0 ) { string->offset = 0; string->len = 0; @@ -197,7 +199,7 @@ static int ibft_set_string_setting ( struct ibft_strings *strings, dest = ibft_alloc_string ( strings, string, len ); if ( ! dest ) return -ENOBUFS; - fetch_string_setting ( NULL, setting, dest, ( len + 1 ) ); + fetch_string_setting ( origin, &fetched, dest, ( len + 1 )); return 0; } |