From cf033046206aede5064c798bfa887fbb888b9217 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 20 Mar 2008 23:15:48 +0000 Subject: [Settings] Introduce settings applicators. Convert DHCP option applicators in dns.c and iscsi.c to settings applicators. Kill off DHCP option applicators. --- src/include/gpxe/dhcp.h | 17 ----------------- src/include/gpxe/settings.h | 32 ++++++++++++++++++-------------- 2 files changed, 18 insertions(+), 31 deletions(-) (limited to 'src/include/gpxe') diff --git a/src/include/gpxe/dhcp.h b/src/include/gpxe/dhcp.h index 3da965255..a8fa811f7 100644 --- a/src/include/gpxe/dhcp.h +++ b/src/include/gpxe/dhcp.h @@ -489,23 +489,6 @@ struct dhcp_packet { struct dhcp_option_block options; }; -/** A DHCP option applicator */ -struct dhcp_option_applicator { - /** DHCP option tag */ - unsigned int tag; - /** Applicator - * - * @v tag DHCP option tag - * @v option DHCP option - * @ret rc Return status code - */ - int ( * apply ) ( unsigned int tag, struct dhcp_option *option ); -}; - -/** Declare a DHCP option applicator */ -#define __dhcp_applicator \ - __table ( struct dhcp_option_applicator, dhcp_applicators, 01 ) - /** * Get reference to DHCP options block * diff --git a/src/include/gpxe/settings.h b/src/include/gpxe/settings.h index 5333c4f2c..94ca9e0f5 100644 --- a/src/include/gpxe/settings.h +++ b/src/include/gpxe/settings.h @@ -122,6 +122,22 @@ struct named_setting { /** Declare a configuration setting */ #define __named_setting __table ( struct named_setting, named_settings, 01 ) +/** + * A settings applicator + * + */ +struct settings_applicator { + /** Apply updated settings + * + * @ret rc Return status code + */ + int ( * apply ) ( void ); +}; + +/** Declare a settings applicator */ +#define __settings_applicator \ + __table ( struct settings_applicator, settings_applicators, 01 ) + extern int simple_settings_store ( struct settings *settings, unsigned int tag, const void *data, size_t len ); extern int simple_settings_fetch ( struct settings *settings, unsigned int tag, @@ -131,6 +147,8 @@ extern struct settings_operations simple_settings_operations; extern int register_settings ( struct settings *settings, struct settings *parent ); extern void unregister_settings ( struct settings *settings ); +extern int store_setting ( struct settings *settings, unsigned int tag, + const void *data, size_t len ); extern int fetch_setting ( struct settings *settings, unsigned int tag, void *data, size_t len ); extern int fetch_setting_len ( struct settings *settings, unsigned int tag ); @@ -179,20 +197,6 @@ static inline void settings_init ( struct settings *settings, settings->name = name; } -/** - * Store value of setting - * - * @v settings Settings block - * @v tag Setting tag number - * @v data Setting data, or NULL to clear setting - * @v len Length of setting data - * @ret rc Return status code - */ -static inline int store_setting ( struct settings *settings, unsigned int tag, - const void *data, size_t len ) { - return settings->op->store ( settings, tag, data, len ); -} - /** * Delete setting * -- cgit v1.2.3-55-g7522