summaryrefslogtreecommitdiffstats
path: root/src/include/gpxe/settings.h
diff options
context:
space:
mode:
authorMichael Brown2009-05-26 12:05:58 +0200
committerMichael Brown2009-05-26 12:05:58 +0200
commit3c06277bbb6ea135e6a1daf22463a347fc7898c7 (patch)
tree48469dfe123ab00d0e417535ac7ae7879e84ff24 /src/include/gpxe/settings.h
parent[multiboot] Include argv[0] as part of "command line" (diff)
downloadipxe-3c06277bbb6ea135e6a1daf22463a347fc7898c7.tar.gz
ipxe-3c06277bbb6ea135e6a1daf22463a347fc7898c7.tar.xz
ipxe-3c06277bbb6ea135e6a1daf22463a347fc7898c7.zip
[settings] Allow for arbitrarily-named settings
This provides a mechanism for using arbitrarily-named variables within gPXE, using the existing syntax for settings.
Diffstat (limited to 'src/include/gpxe/settings.h')
-rw-r--r--src/include/gpxe/settings.h41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/include/gpxe/settings.h b/src/include/gpxe/settings.h
index ed3f1590..09934b64 100644
--- a/src/include/gpxe/settings.h
+++ b/src/include/gpxe/settings.h
@@ -13,7 +13,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <gpxe/tables.h>
#include <gpxe/list.h>
#include <gpxe/refcnt.h>
-#include <gpxe/dhcpopts.h>
struct settings;
struct in_addr;
@@ -69,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 */
@@ -154,23 +158,24 @@ struct settings_applicator {
#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 );
@@ -201,6 +206,7 @@ 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_settings ( const char *name );
@@ -263,15 +269,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 );
}
/**