Skip to content

Commit

Permalink
[settings] Expose parse_setting_name()
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Jul 19, 2013
1 parent 77c70ac commit 5ffcae6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
16 changes: 5 additions & 11 deletions src/core/settings.c
Expand Up @@ -295,8 +295,8 @@ struct settings * find_child_settings ( struct settings *parent,
* @v name Name within this parent
* @ret settings Settings block, or NULL
*/
static struct settings * autovivify_child_settings ( struct settings *parent,
const char *name ) {
struct settings * autovivify_child_settings ( struct settings *parent,
const char *name ) {
struct {
struct autovivified_settings autovivified;
char name[ strlen ( name ) + 1 /* NUL */ ];
Expand Down Expand Up @@ -356,9 +356,7 @@ const char * settings_name ( struct settings *settings ) {
* @ret settings Settings block, or NULL
*/
static struct settings *
parse_settings_name ( const char *name,
struct settings * ( * get_child ) ( struct settings *,
const char * ) ) {
parse_settings_name ( const char *name, get_child_settings_t get_child ) {
struct settings *settings = &settings_root;
char name_copy[ strlen ( name ) + 1 ];
char *subname;
Expand Down Expand Up @@ -1205,12 +1203,8 @@ static struct setting_type * find_setting_type ( const char *name ) {
* Note that on success, this function will have modified the original
* setting @c name.
*/
static int
parse_setting_name ( char *name,
struct settings * ( * get_child )
( struct settings *settings,
const char *name ),
struct settings **settings, struct setting *setting ) {
int parse_setting_name ( char *name, get_child_settings_t get_child,
struct settings **settings, struct setting *setting ) {
char *settings_name;
char *setting_name;
char *type_name;
Expand Down
9 changes: 8 additions & 1 deletion src/include/ipxe/settings.h
Expand Up @@ -241,6 +241,9 @@ struct generic_settings {
struct list_head list;
};

/** A child settings block locator function */
typedef struct settings * ( *get_child_settings_t ) ( struct settings *settings,
const char *name );
extern struct settings_operations generic_settings_operations;
extern int generic_settings_store ( struct settings *settings,
struct setting *setting,
Expand Down Expand Up @@ -295,10 +298,14 @@ extern int setting_cmp ( struct setting *a, struct setting *b );

extern struct settings * find_child_settings ( struct settings *parent,
const char *name );
extern struct settings * autovivify_child_settings ( struct settings *parent,
const char *name );
extern const char * settings_name ( struct settings *settings );
extern struct settings * find_settings ( const char *name );
extern struct setting * find_setting ( const char *name );

extern int parse_setting_name ( char *name, get_child_settings_t get_child,
struct settings **settings,
struct setting *setting );
extern int setting_name ( struct settings *settings, struct setting *setting,
char *buf, size_t len );
extern int fetchf_setting ( struct settings *settings, struct setting *setting,
Expand Down

0 comments on commit 5ffcae6

Please sign in to comment.