[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>
This commit is contained in:
Michael Brown
2013-12-03 16:48:56 +00:00
parent a2638a8edd
commit 22001cb206
37 changed files with 620 additions and 573 deletions

View File

@@ -121,7 +121,7 @@ static struct interface_descriptor validator_job_desc =
*/
/** Cross-signed certificate source setting */
struct setting crosscert_setting __setting ( SETTING_CRYPTO ) = {
const struct setting crosscert_setting __setting ( SETTING_CRYPTO ) = {
.name = "crosscert",
.description = "Cross-signed certificate source",
.tag = DHCP_EB_CROSS_CERT,
@@ -232,14 +232,7 @@ static int validator_start_download ( struct validator *validator,
int rc;
/* Determine cross-signed certificate source */
len = fetch_string_setting_copy ( NULL, &crosscert_setting,
&crosscert_copy );
if ( len < 0 ) {
rc = len;
DBGC ( validator, "VALIDATOR %p could not fetch crosscert "
"setting: %s\n", validator, strerror ( rc ) );
goto err_fetch_crosscert;
}
fetch_string_setting_copy ( NULL, &crosscert_setting, &crosscert_copy );
crosscert = ( crosscert_copy ? crosscert_copy : crosscert_default );
/* Allocate URI string */
@@ -279,7 +272,6 @@ static int validator_start_download ( struct validator *validator,
free ( uri_string );
err_alloc_uri_string:
free ( crosscert_copy );
err_fetch_crosscert:
return rc;
}