[settings] Apply settings block name in register_settings()

Pass the settings block name as a parameter to register_settings(),
rather than defining it with settings_init() (and then possibly
changing it by directly manipulating settings->name).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2010-12-01 16:34:23 +00:00
parent de6a59470b
commit 67b45186a5
10 changed files with 30 additions and 32 deletions

View File

@@ -489,8 +489,7 @@ netdev_settings ( struct net_device *netdev ) {
*/
static inline __attribute__ (( always_inline )) void
netdev_settings_init ( struct net_device *netdev ) {
generic_settings_init ( &netdev->settings,
&netdev->refcnt, netdev->name );
generic_settings_init ( &netdev->settings, &netdev->refcnt );
netdev->settings.settings.op = &netdev_settings_operations;
}

View File

@@ -178,7 +178,7 @@ extern int generic_settings_fetch ( struct settings *settings,
extern void generic_settings_clear ( struct settings *settings );
extern int register_settings ( struct settings *settings,
struct settings *parent );
struct settings *parent, const char *name );
extern void unregister_settings ( struct settings *settings );
extern int store_setting ( struct settings *settings, struct setting *setting,
@@ -252,19 +252,16 @@ extern struct setting user_class_setting __setting;
* @v settings Settings block
* @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,
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;
}
@@ -273,13 +270,11 @@ static inline void settings_init ( struct settings *settings,
*
* @v generics Generic settings block
* @v refcnt Containing object reference counter, or NULL
* @v name Settings block name
*/
static inline void generic_settings_init ( struct generic_settings *generics,
struct refcnt *refcnt,
const char *name ) {
struct refcnt *refcnt ) {
settings_init ( &generics->settings, &generic_settings_operations,
refcnt, name, 0 );
refcnt, 0 );
INIT_LIST_HEAD ( &generics->list );
}