Skip to content

Commit

Permalink
[settings] Clarify usage of the term "named setting"
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mcb30 committed Jul 18, 2013
1 parent ca31987 commit 0636451
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
7 changes: 3 additions & 4 deletions src/arch/i386/interface/vmware/guestinfo.c
Expand Up @@ -58,7 +58,7 @@ static int guestinfo_fetch_type ( struct settings *settings,
strlen ( parent_name ) + 1 /* "." */ +
strlen ( setting->name ) + 1 /* "." */ +
( type ? strlen ( type->name ) : 0 ) + 1 /* NUL */ ];
struct setting *named_setting;
struct setting *predefined;
char *info;
int info_len;
int check_len;
Expand All @@ -82,9 +82,8 @@ static int guestinfo_fetch_type ( struct settings *settings,

/* Determine default type if necessary */
if ( ! type ) {
named_setting = find_setting ( setting->name );
type = ( named_setting ?
named_setting->type : &setting_type_string );
predefined = find_setting ( setting->name );
type = ( predefined ? predefined->type : &setting_type_string );
}
assert ( type != NULL );

Expand Down
20 changes: 10 additions & 10 deletions src/core/settings.c
Expand Up @@ -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 name Name within this parent
Expand All @@ -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 name Name within this parent
Expand Down Expand Up @@ -383,7 +383,7 @@ parse_settings_name ( const char *name,
}

/**
* Find named settings block
* Find settings block
*
* @v name Name
* @ret settings Settings block, or NULL
Expand Down Expand Up @@ -1113,10 +1113,10 @@ int storef_setting ( struct settings *settings, struct setting *setting,
*/

/**
* Find named setting
* Find predefined setting
*
* @v name Name
* @ret setting Named setting, or NULL
* @ret setting Setting, or NULL
*/
struct setting * find_setting ( const char *name ) {
struct setting *setting;
Expand Down Expand Up @@ -1192,7 +1192,7 @@ parse_setting_name ( const char *name,
char *settings_name;
char *setting_name;
char *type_name;
struct setting *named_setting;
struct setting *predefined;

/* Set defaults */
*settings = &settings_root;
Expand Down Expand Up @@ -1226,10 +1226,10 @@ parse_setting_name ( const char *name,
setting->tag = parse_setting_tag ( setting_name );
setting->scope = (*settings)->default_scope;
setting->name = setting_name;
for_each_table_entry ( named_setting, SETTINGS ) {
/* Matches a defined named setting; use that setting */
if ( setting_cmp ( named_setting, setting ) == 0 ) {
memcpy ( setting, named_setting, sizeof ( *setting ) );
for_each_table_entry ( predefined, SETTINGS ) {
/* Matches a predefined setting; use that setting */
if ( setting_cmp ( predefined, setting ) == 0 ) {
memcpy ( setting, predefined, sizeof ( *setting ) );
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/interface/smbios/smbios_settings.c
Expand Up @@ -197,8 +197,8 @@ struct setting uuid_setting __setting ( SETTING_HOST ) = {
.scope = &smbios_settings_scope,
};

/** Other SMBIOS named settings */
struct setting smbios_named_settings[] __setting ( SETTING_HOST_EXTRA ) = {
/** Other SMBIOS predefined settings */
struct setting smbios_predefined_settings[] __setting ( SETTING_HOST_EXTRA ) = {
{
.name = "manufacturer",
.description = "Manufacturer",
Expand Down
2 changes: 1 addition & 1 deletion src/net/netdev_settings.c
Expand Up @@ -35,7 +35,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
*
*/

/** Network device named settings */
/** Network device predefined settings */
struct setting mac_setting __setting ( SETTING_NETDEV ) = {
.name = "mac",
.description = "MAC address",
Expand Down

0 comments on commit 0636451

Please sign in to comment.