]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[parseopt] Add parse_netdev_configurator()
authorMichael Brown <mcb30@ipxe.org>
Mon, 4 Nov 2013 17:05:16 +0000 (17:05 +0000)
committerMichael Brown <mcb30@ipxe.org>
Tue, 5 Nov 2013 17:30:20 +0000 (17:30 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/core/parseopt.c
src/include/ipxe/parseopt.h

index 514508357c61b928e675ada77ec9714bf631e5a9..334ffb2cf50333acd1ac712f5320c72fa338ef34 100644 (file)
@@ -139,6 +139,29 @@ int parse_netdev ( char *text, struct net_device **netdev ) {
        return 0;
 }
 
+/**
+ * Parse network device configurator name
+ *
+ * @v text             Text
+ * @ret configurator   Network device configurator
+ * @ret rc             Return status code
+ */
+int parse_netdev_configurator ( char *text,
+                               struct net_device_configurator **configurator ){
+
+       /* Sanity check */
+       assert ( text != NULL );
+
+       /* Find network device configurator */
+       *configurator = find_netdev_configurator ( text );
+       if ( ! *configurator ) {
+               printf ( "\"%s\": no such configurator\n", text );
+               return -ENOTSUP;
+       }
+
+       return 0;
+}
+
 /**
  * Parse menu name
  *
index e3b54c8e5e92d88bac080b6583fc44dd7f33b251..840de74971a9bc57f57063670300fdb21c3c7a3e 100644 (file)
@@ -14,6 +14,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 #include <ipxe/settings.h>
 
 struct net_device;
+struct net_device_configurator;
 struct menu;
 struct parameters;
 
@@ -128,6 +129,9 @@ extern int parse_string ( char *text, char **value );
 extern int parse_integer ( char *text, unsigned int *value );
 extern int parse_timeout ( char *text, unsigned long *value );
 extern int parse_netdev ( char *text, struct net_device **netdev );
+extern int
+parse_netdev_configurator ( char *text,
+                           struct net_device_configurator **configurator );
 extern int parse_menu ( char *text, struct menu **menu );
 extern int parse_flag ( char *text __unused, int *flag );
 extern int parse_key ( char *text, unsigned int *key );