[settings] Make built-in settings a linker table

Allow for configurable provision of built-in settings by placing them
in a linker table rather than an array.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2013-08-27 13:46:12 +01:00
parent 6d72b498c2
commit 3e975ecf3f
2 changed files with 68 additions and 46 deletions

View File

@@ -253,6 +253,28 @@ struct settings_applicator {
/** Declare a settings applicator */
#define __settings_applicator __table_entry ( SETTINGS_APPLICATORS, 01 )
/** A built-in setting */
struct builtin_setting {
/** Setting */
struct setting *setting;
/** Fetch setting value
*
* @v data Buffer to fill with setting data
* @v len Length of buffer
* @ret len Length of setting data, or negative error
*/
int ( * fetch ) ( void *data, size_t len );
};
/** Built-in settings table */
#define BUILTIN_SETTINGS __table ( struct builtin_setting, "builtin_settings" )
/** Declare a built-in setting */
#define __builtin_setting __table_entry ( BUILTIN_SETTINGS, 01 )
/** Built-in setting scope */
extern struct settings_scope builtin_scope;
/**
* A generic settings block
*