2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-12-14 23:31:39 +00:00

Added clear_setting()

This commit is contained in:
Michael Brown 2006-12-12 15:49:46 +00:00
parent 0a26cd2933
commit 007ca97f25
2 changed files with 26 additions and 2 deletions

View File

@ -115,7 +115,8 @@ find_or_build_config_setting ( const char *name,
return setting;
}
/** Show value of setting
/**
* Show value of setting
*
* @v context Configuration context
* @v name Configuration setting name
@ -134,7 +135,8 @@ int show_setting ( struct config_context *context, const char *name,
return setting->type->show ( context, setting, buf, len );
}
/** Set value of setting
/**
* Set value of setting
*
* @v context Configuration context
* @v name Configuration setting name
@ -152,6 +154,27 @@ int set_setting ( struct config_context *context, const char *name,
return setting->type->set ( context, setting, value );
}
/**
* Clear setting
*
* @v context Configuration context
* @v name Configuration setting name
* @ret rc Return status code
*/
int clear_setting ( struct config_context *context, const char *name ) {
struct config_setting *setting;
struct config_setting tmp_setting;
setting = find_or_build_config_setting ( name, &tmp_setting );
if ( ! setting )
return -ENOENT;
/* All types of settings get cleared the same way */
delete_dhcp_option ( context->options, setting->tag );
return 0;
}
/**
* Show value of string setting
*

View File

@ -102,5 +102,6 @@ extern int show_setting ( struct config_context *context, const char *name,
char *buf, size_t len );
extern int set_setting ( struct config_context *context, const char *name,
const char *value );
extern int clear_setting ( struct config_context *context, const char *name );
#endif /* _GPXE_SETTINGS_H */