david/ipxe
Archived
1
0

[settings] Clarify usage of the term "named setting"

There are currently two conflicting usages of the term "named setting"
within iPXE: one refers to predefined settings (such as show up in the
"config" UI), the other refers to settings identified by a name (such
as "net0.dhcp/ip").

Split these usages into the term "predefined setting" and "named
setting" to avoid ambiguity.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2013-07-18 13:35:19 +01:00
parent ca319873bf
commit 063645118c
4 changed files with 16 additions and 17 deletions

View File

@ -58,7 +58,7 @@ static int guestinfo_fetch_type ( struct settings *settings,
strlen ( parent_name ) + 1 /* "." */ + strlen ( parent_name ) + 1 /* "." */ +
strlen ( setting->name ) + 1 /* "." */ + strlen ( setting->name ) + 1 /* "." */ +
( type ? strlen ( type->name ) : 0 ) + 1 /* NUL */ ]; ( type ? strlen ( type->name ) : 0 ) + 1 /* NUL */ ];
struct setting *named_setting; struct setting *predefined;
char *info; char *info;
int info_len; int info_len;
int check_len; int check_len;
@ -82,9 +82,8 @@ static int guestinfo_fetch_type ( struct settings *settings,
/* Determine default type if necessary */ /* Determine default type if necessary */
if ( ! type ) { if ( ! type ) {
named_setting = find_setting ( setting->name ); predefined = find_setting ( setting->name );
type = ( named_setting ? type = ( predefined ? predefined->type : &setting_type_string );
named_setting->type : &setting_type_string );
} }
assert ( type != NULL ); assert ( type != NULL );

View File

@ -262,7 +262,7 @@ static void autovivified_settings_free ( struct refcnt *refcnt ) {
} }
/** /**
* Find child named settings block * Find child settings block
* *
* @v parent Parent settings block * @v parent Parent settings block
* @v name Name within this parent * @v name Name within this parent
@ -289,7 +289,7 @@ struct settings * find_child_settings ( struct settings *parent,
} }
/** /**
* Find or create child named settings block * Find or create child settings block
* *
* @v parent Parent settings block * @v parent Parent settings block
* @v name Name within this parent * @v name Name within this parent
@ -383,7 +383,7 @@ parse_settings_name ( const char *name,
} }
/** /**
* Find named settings block * Find settings block
* *
* @v name Name * @v name Name
* @ret settings Settings block, or NULL * @ret settings Settings block, or NULL
@ -1113,10 +1113,10 @@ int storef_setting ( struct settings *settings, struct setting *setting,
*/ */
/** /**
* Find named setting * Find predefined setting
* *
* @v name Name * @v name Name
* @ret setting Named setting, or NULL * @ret setting Setting, or NULL
*/ */
struct setting * find_setting ( const char *name ) { struct setting * find_setting ( const char *name ) {
struct setting *setting; struct setting *setting;
@ -1192,7 +1192,7 @@ parse_setting_name ( const char *name,
char *settings_name; char *settings_name;
char *setting_name; char *setting_name;
char *type_name; char *type_name;
struct setting *named_setting; struct setting *predefined;
/* Set defaults */ /* Set defaults */
*settings = &settings_root; *settings = &settings_root;
@ -1226,10 +1226,10 @@ parse_setting_name ( const char *name,
setting->tag = parse_setting_tag ( setting_name ); setting->tag = parse_setting_tag ( setting_name );
setting->scope = (*settings)->default_scope; setting->scope = (*settings)->default_scope;
setting->name = setting_name; setting->name = setting_name;
for_each_table_entry ( named_setting, SETTINGS ) { for_each_table_entry ( predefined, SETTINGS ) {
/* Matches a defined named setting; use that setting */ /* Matches a predefined setting; use that setting */
if ( setting_cmp ( named_setting, setting ) == 0 ) { if ( setting_cmp ( predefined, setting ) == 0 ) {
memcpy ( setting, named_setting, sizeof ( *setting ) ); memcpy ( setting, predefined, sizeof ( *setting ) );
break; break;
} }
} }

View File

@ -197,8 +197,8 @@ struct setting uuid_setting __setting ( SETTING_HOST ) = {
.scope = &smbios_settings_scope, .scope = &smbios_settings_scope,
}; };
/** Other SMBIOS named settings */ /** Other SMBIOS predefined settings */
struct setting smbios_named_settings[] __setting ( SETTING_HOST_EXTRA ) = { struct setting smbios_predefined_settings[] __setting ( SETTING_HOST_EXTRA ) = {
{ {
.name = "manufacturer", .name = "manufacturer",
.description = "Manufacturer", .description = "Manufacturer",

View File

@ -35,7 +35,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
* *
*/ */
/** Network device named settings */ /** Network device predefined settings */
struct setting mac_setting __setting ( SETTING_NETDEV ) = { struct setting mac_setting __setting ( SETTING_NETDEV ) = {
.name = "mac", .name = "mac",
.description = "MAC address", .description = "MAC address",