Sfoglia il codice sorgente

[settings] Expose parse_setting_name()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 11 anni fa
parent
commit
5ffcae69c0
2 ha cambiato i file con 13 aggiunte e 12 eliminazioni
  1. 5
    11
      src/core/settings.c
  2. 8
    1
      src/include/ipxe/settings.h

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

@@ -295,8 +295,8 @@ struct settings * find_child_settings ( struct settings *parent,
295 295
  * @v name		Name within this parent
296 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 300
 	struct {
301 301
 		struct autovivified_settings autovivified;
302 302
 		char name[ strlen ( name ) + 1 /* NUL */ ];
@@ -356,9 +356,7 @@ const char * settings_name ( struct settings *settings ) {
356 356
  * @ret settings	Settings block, or NULL
357 357
  */
358 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 360
 	struct settings *settings = &settings_root;
363 361
 	char name_copy[ strlen ( name ) + 1 ];
364 362
 	char *subname;
@@ -1205,12 +1203,8 @@ static struct setting_type * find_setting_type ( const char *name ) {
1205 1203
  * Note that on success, this function will have modified the original
1206 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 1208
 	char *settings_name;
1215 1209
 	char *setting_name;
1216 1210
 	char *type_name;

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

@@ -241,6 +241,9 @@ struct generic_settings {
241 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 247
 extern struct settings_operations generic_settings_operations;
245 248
 extern int generic_settings_store ( struct settings *settings,
246 249
 				    struct setting *setting,
@@ -295,10 +298,14 @@ extern int setting_cmp ( struct setting *a, struct setting *b );
295 298
 
296 299
 extern struct settings * find_child_settings ( struct settings *parent,
297 300
 					       const char *name );
301
+extern struct settings * autovivify_child_settings ( struct settings *parent,
302
+						     const char *name );
298 303
 extern const char * settings_name ( struct settings *settings );
299 304
 extern struct settings * find_settings ( const char *name );
300 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 309
 extern int setting_name ( struct settings *settings, struct setting *setting,
303 310
 			  char *buf, size_t len );
304 311
 extern int fetchf_setting ( struct settings *settings, struct setting *setting,

Loading…
Annulla
Salva