Skip to content

Commit

Permalink
Added clear_setting()
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Brown committed Dec 12, 2006
1 parent 0a26cd2 commit 007ca97
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
27 changes: 25 additions & 2 deletions src/core/settings.c
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
*
Expand Down
1 change: 1 addition & 0 deletions src/include/gpxe/settings.h
Expand Up @@ -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 */

0 comments on commit 007ca97

Please sign in to comment.