diff options
author | Simon Rettberg | 2022-05-11 10:41:01 +0200 |
---|---|---|
committer | Simon Rettberg | 2022-05-11 10:41:01 +0200 |
commit | a12e3c379cf2e5946c7316259ef46736cdd5f222 (patch) | |
tree | 49638dad528a4490e293ea4a0f87e39ce862a75b /src/core/settings.c | |
parent | Local UEFI disk boot support (diff) | |
parent | [cloud] Allow aws-import script to run on Python 3.6 (diff) | |
download | ipxe-a12e3c379cf2e5946c7316259ef46736cdd5f222.tar.gz ipxe-a12e3c379cf2e5946c7316259ef46736cdd5f222.tar.xz ipxe-a12e3c379cf2e5946c7316259ef46736cdd5f222.zip |
Merge branch 'master' into openslx
Diffstat (limited to 'src/core/settings.c')
-rw-r--r-- | src/core/settings.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/core/settings.c b/src/core/settings.c index d6ab6b20..1037b06a 100644 --- a/src/core/settings.c +++ b/src/core/settings.c @@ -412,9 +412,8 @@ struct settings * find_settings ( const char *name ) { /** * Apply all settings * - * @ret rc Return status code */ -static int apply_settings ( void ) { +static void apply_settings ( void ) { struct settings_applicator *applicator; int rc; @@ -423,11 +422,9 @@ static int apply_settings ( void ) { if ( ( rc = applicator->apply() ) != 0 ) { DBG ( "Could not apply settings using applicator " "%p: %s\n", applicator, strerror ( rc ) ); - return rc; + /* Continue to apply remaining settings */ } } - - return 0; } /** @@ -645,8 +642,7 @@ int store_setting ( struct settings *settings, const struct setting *setting, */ for ( ; settings ; settings = settings->parent ) { if ( settings == &settings_root ) { - if ( ( rc = apply_settings() ) != 0 ) - return rc; + apply_settings(); break; } } @@ -2246,7 +2242,7 @@ const struct setting_type setting_type_base64 __setting_type = { }; /** - * Format UUID setting value + * Format UUID/GUID setting value * * @v type Setting type * @v raw Raw setting value @@ -2255,17 +2251,24 @@ const struct setting_type setting_type_base64 __setting_type = { * @v len Length of buffer * @ret len Length of formatted value, or negative error */ -static int format_uuid_setting ( const struct setting_type *type __unused, +static int format_uuid_setting ( const struct setting_type *type, const void *raw, size_t raw_len, char *buf, size_t len ) { - const union uuid *uuid = raw; + union uuid uuid; /* Range check */ - if ( raw_len != sizeof ( *uuid ) ) + if ( raw_len != sizeof ( uuid ) ) return -ERANGE; + /* Copy value */ + memcpy ( &uuid, raw, sizeof ( uuid ) ); + + /* Mangle GUID byte ordering */ + if ( type == &setting_type_guid ) + uuid_mangle ( &uuid ); + /* Format value */ - return snprintf ( buf, len, "%s", uuid_ntoa ( uuid ) ); + return snprintf ( buf, len, "%s", uuid_ntoa ( &uuid ) ); } /** UUID setting type */ @@ -2274,6 +2277,12 @@ const struct setting_type setting_type_uuid __setting_type = { .format = format_uuid_setting, }; +/** GUID setting type */ +const struct setting_type setting_type_guid __setting_type = { + .name = "guid", + .format = format_uuid_setting, +}; + /** * Format PCI bus:dev.fn setting value * |