diff options
author | H. Peter Anvin <hpa@zytor.com> | 2010-02-02 22:41:00 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-02-02 22:41:00 -0800 |
commit | 702c7fbe7342403472e887508716add0c58c385c (patch) | |
tree | 639050b522cea25f4475d48da54380d61c7d10f3 /gpxe/src/include/gpxe/settings.h | |
parent | 1e96e9cc1c3549c86dbf4e7caf880477e16e93e0 (diff) | |
download | syslinux-702c7fbe7342403472e887508716add0c58c385c.tar.gz |
Update gPXE to version 1.0.0
Diffstat (limited to 'gpxe/src/include/gpxe/settings.h')
-rw-r--r-- | gpxe/src/include/gpxe/settings.h | 64 |
1 files changed, 40 insertions, 24 deletions
diff --git a/gpxe/src/include/gpxe/settings.h b/gpxe/src/include/gpxe/settings.h index 9e62cdea..efefe73a 100644 --- a/gpxe/src/include/gpxe/settings.h +++ b/gpxe/src/include/gpxe/settings.h @@ -7,11 +7,12 @@ * */ +FILE_LICENCE ( GPL2_OR_LATER ); + #include <stdint.h> #include <gpxe/tables.h> #include <gpxe/list.h> #include <gpxe/refcnt.h> -#include <gpxe/dhcpopts.h> struct settings; struct in_addr; @@ -36,8 +37,11 @@ struct setting { unsigned int tag; }; +/** Configuration setting table */ +#define SETTINGS __table ( struct setting, "settings" ) + /** Declare a configuration setting */ -#define __setting __table ( struct setting, settings, 01 ) +#define __setting __table_entry ( SETTINGS, 01 ) /** Settings block operations */ struct settings_operations { @@ -64,6 +68,11 @@ struct settings_operations { */ int ( * fetch ) ( struct settings *settings, struct setting *setting, void *data, size_t len ); + /** Clear settings block + * + * @v settings Settings block + */ + void ( * clear ) ( struct settings *settings ); }; /** A settings block */ @@ -123,9 +132,11 @@ struct setting_type { char *buf, size_t len ); }; +/** Configuration setting type table */ +#define SETTING_TYPES __table ( struct setting_type, "setting_types" ) + /** Declare a configuration setting type */ -#define __setting_type \ - __table ( struct setting_type, setting_types, 01 ) +#define __setting_type __table_entry ( SETTING_TYPES, 01 ) /** * A settings applicator @@ -139,28 +150,32 @@ struct settings_applicator { int ( * apply ) ( void ); }; +/** Settings applicator table */ +#define SETTINGS_APPLICATORS \ + __table ( struct settings_applicator, "settings_applicators" ) + /** Declare a settings applicator */ -#define __settings_applicator \ - __table ( struct settings_applicator, settings_applicators, 01 ) +#define __settings_applicator __table_entry ( SETTINGS_APPLICATORS, 01 ) /** - * A simple settings block + * A generic settings block * */ -struct simple_settings { +struct generic_settings { /** Settings block */ struct settings settings; - /** DHCP options */ - struct dhcp_options dhcpopts; + /** List of generic settings */ + struct list_head list; }; -extern struct settings_operations simple_settings_operations; -extern int simple_settings_store ( struct settings *settings, - struct setting *setting, - const void *data, size_t len ); -extern int simple_settings_fetch ( struct settings *settings, - struct setting *setting, - void *data, size_t len ); +extern struct settings_operations generic_settings_operations; +extern int generic_settings_store ( struct settings *settings, + struct setting *setting, + const void *data, size_t len ); +extern int generic_settings_fetch ( struct settings *settings, + struct setting *setting, + void *data, size_t len ); +extern void generic_settings_clear ( struct settings *settings ); extern int register_settings ( struct settings *settings, struct settings *parent ); @@ -191,10 +206,9 @@ extern unsigned long fetch_uintz_setting ( struct settings *settings, struct setting *setting ); extern int fetch_uuid_setting ( struct settings *settings, struct setting *setting, union uuid *uuid ); +extern void clear_settings ( struct settings *settings ); extern int setting_cmp ( struct setting *a, struct setting *b ); -extern struct settings * find_child_settings ( struct settings *parent, - const char *name ); extern struct settings * find_settings ( const char *name ); extern int storef_setting ( struct settings *settings, @@ -228,6 +242,7 @@ extern struct setting priority_setting __setting; extern struct setting uuid_setting __setting; extern struct setting next_server_setting __setting; extern struct setting mac_setting __setting; +extern struct setting busid_setting __setting; extern struct setting user_class_setting __setting; /** @@ -255,15 +270,16 @@ static inline void settings_init ( struct settings *settings, /** * Initialise a settings block * - * @v simple Simple settings block + * @v generics Generic settings block * @v refcnt Containing object reference counter, or NULL * @v name Settings block name */ -static inline void simple_settings_init ( struct simple_settings *simple, - struct refcnt *refcnt, - const char *name ) { - settings_init ( &simple->settings, &simple_settings_operations, +static inline void generic_settings_init ( struct generic_settings *generics, + struct refcnt *refcnt, + const char *name ) { + settings_init ( &generics->settings, &generic_settings_operations, refcnt, name, 0 ); + INIT_LIST_HEAD ( &generics->list ); } /** |