summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown2008-10-29 19:17:02 +0100
committerMichael Brown2008-10-30 22:47:14 +0100
commit0a6c66a83018c64d961ee4e8601ae8950cbee00b (patch)
treec4adb1baea7c87b4e0bbd9f7d1f9127e738065d5 /src/include
parent[romprefix] Further sanity checks for the PCI 3 runtime segment address (diff)
downloadipxe-0a6c66a83018c64d961ee4e8601ae8950cbee00b.tar.gz
ipxe-0a6c66a83018c64d961ee4e8601ae8950cbee00b.tar.xz
ipxe-0a6c66a83018c64d961ee4e8601ae8950cbee00b.zip
[settings] Add the notion of a "tag magic" to numbered settings
Settings can be constructed using a dotted-decimal notation, to allow for access to unnamed settings. The default interpretation is as a DHCP option number (with encapsulated options represented as "<encapsulating option>.<encapsulated option>". In several contexts (e.g. SMBIOS, Phantom CLP), it is useful to interpret the dotted-decimal notation as referring to non-DHCP options. In this case, it becomes necessary for these contexts to ignore standard DHCP options, otherwise we end up trying to, for example, retrieve the boot filename from SMBIOS. Allow settings blocks to specify a "tag magic". When dotted-decimal notation is used to construct a setting, the tag magic value of the originating settings block will be ORed in to the tag number. Store/fetch methods can then check for the magic number before interpreting arbitrarily-numbered settings.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gpxe/settings.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/include/gpxe/settings.h b/src/include/gpxe/settings.h
index ee7dacee3..37c01b058 100644
--- a/src/include/gpxe/settings.h
+++ b/src/include/gpxe/settings.h
@@ -72,6 +72,14 @@ struct settings {
struct refcnt *refcnt;
/** Name */
const char *name;
+ /** Tag magic
+ *
+ * This value will be ORed in to any numerical tags
+ * constructed by parse_setting_name(), and can be used to
+ * avoid e.g. attempting to retrieve the subnet mask from
+ * SMBIOS, or the system UUID from DHCP.
+ */
+ unsigned int tag_magic;
/** Parent settings block */
struct settings *parent;
/** Sibling settings blocks */
@@ -225,16 +233,19 @@ extern struct setting mac_setting __setting;
* @v op Settings block operations
* @v refcnt Containing object reference counter, or NULL
* @v name Settings block name
+ * @v tag_magic Tag magic
*/
static inline void settings_init ( struct settings *settings,
struct settings_operations *op,
struct refcnt *refcnt,
- const char *name ) {
+ const char *name,
+ unsigned int tag_magic ) {
INIT_LIST_HEAD ( &settings->siblings );
INIT_LIST_HEAD ( &settings->children );
settings->op = op;
settings->refcnt = refcnt;
settings->name = name;
+ settings->tag_magic = tag_magic;
}
/**
@@ -248,7 +259,7 @@ static inline void simple_settings_init ( struct simple_settings *simple,
struct refcnt *refcnt,
const char *name ) {
settings_init ( &simple->settings, &simple_settings_operations,
- refcnt, name );
+ refcnt, name, 0 );
}
/**