Browse Source

[settings] Expose parse_setting_name()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 11 years ago
parent
commit
5ffcae69c0
2 changed files with 13 additions and 12 deletions
  1. 5
    11
      src/core/settings.c
  2. 8
    1
      src/include/ipxe/settings.h

+ 5
- 11
src/core/settings.c View File

295
  * @v name		Name within this parent
295
  * @v name		Name within this parent
296
  * @ret settings	Settings block, or NULL
296
  * @ret settings	Settings block, or NULL
297
  */
297
  */
298
-static struct settings * autovivify_child_settings ( struct settings *parent,
299
-						     const char *name ) {
298
+struct settings * autovivify_child_settings ( struct settings *parent,
299
+					      const char *name ) {
300
 	struct {
300
 	struct {
301
 		struct autovivified_settings autovivified;
301
 		struct autovivified_settings autovivified;
302
 		char name[ strlen ( name ) + 1 /* NUL */ ];
302
 		char name[ strlen ( name ) + 1 /* NUL */ ];
356
  * @ret settings	Settings block, or NULL
356
  * @ret settings	Settings block, or NULL
357
  */
357
  */
358
 static struct settings *
358
 static struct settings *
359
-parse_settings_name ( const char *name,
360
-		      struct settings * ( * get_child ) ( struct settings *,
361
-							  const char * ) ) {
359
+parse_settings_name ( const char *name, get_child_settings_t get_child ) {
362
 	struct settings *settings = &settings_root;
360
 	struct settings *settings = &settings_root;
363
 	char name_copy[ strlen ( name ) + 1 ];
361
 	char name_copy[ strlen ( name ) + 1 ];
364
 	char *subname;
362
 	char *subname;
1205
  * Note that on success, this function will have modified the original
1203
  * Note that on success, this function will have modified the original
1206
  * setting @c name.
1204
  * setting @c name.
1207
  */
1205
  */
1208
-static int
1209
-parse_setting_name ( char *name,
1210
-		     struct settings * ( * get_child )
1211
-			     ( struct settings *settings,
1212
-			       const char *name ),
1213
-		     struct settings **settings, struct setting *setting ) {
1206
+int parse_setting_name ( char *name, get_child_settings_t get_child,
1207
+			 struct settings **settings, struct setting *setting ) {
1214
 	char *settings_name;
1208
 	char *settings_name;
1215
 	char *setting_name;
1209
 	char *setting_name;
1216
 	char *type_name;
1210
 	char *type_name;

+ 8
- 1
src/include/ipxe/settings.h View File

241
 	struct list_head list;
241
 	struct list_head list;
242
 };
242
 };
243
 
243
 
244
+/** A child settings block locator function */
245
+typedef struct settings * ( *get_child_settings_t ) ( struct settings *settings,
246
+						      const char *name );
244
 extern struct settings_operations generic_settings_operations;
247
 extern struct settings_operations generic_settings_operations;
245
 extern int generic_settings_store ( struct settings *settings,
248
 extern int generic_settings_store ( struct settings *settings,
246
 				    struct setting *setting,
249
 				    struct setting *setting,
295
 
298
 
296
 extern struct settings * find_child_settings ( struct settings *parent,
299
 extern struct settings * find_child_settings ( struct settings *parent,
297
 					       const char *name );
300
 					       const char *name );
301
+extern struct settings * autovivify_child_settings ( struct settings *parent,
302
+						     const char *name );
298
 extern const char * settings_name ( struct settings *settings );
303
 extern const char * settings_name ( struct settings *settings );
299
 extern struct settings * find_settings ( const char *name );
304
 extern struct settings * find_settings ( const char *name );
300
 extern struct setting * find_setting ( const char *name );
305
 extern struct setting * find_setting ( const char *name );
301
-
306
+extern int parse_setting_name ( char *name, get_child_settings_t get_child,
307
+				struct settings **settings,
308
+				struct setting *setting );
302
 extern int setting_name ( struct settings *settings, struct setting *setting,
309
 extern int setting_name ( struct settings *settings, struct setting *setting,
303
 			  char *buf, size_t len );
310
 			  char *buf, size_t len );
304
 extern int fetchf_setting ( struct settings *settings, struct setting *setting,
311
 extern int fetchf_setting ( struct settings *settings, struct setting *setting,

Loading…
Cancel
Save