summaryrefslogtreecommitdiffstats
path: root/src/hci/commands/autoboot_cmd.c
diff options
context:
space:
mode:
authorMichael Brown2010-11-22 22:04:30 +0100
committerMichael Brown2010-11-22 22:04:30 +0100
commitdebbea1123b453471ad42b3afcc05c18fe7bfffb (patch)
tree92d45bfbff1867bba931cd8ff0f1e316bd5d4e57 /src/hci/commands/autoboot_cmd.c
parent[cmdline] Add "isset" command (diff)
downloadipxe-debbea1123b453471ad42b3afcc05c18fe7bfffb.tar.gz
ipxe-debbea1123b453471ad42b3afcc05c18fe7bfffb.tar.xz
ipxe-debbea1123b453471ad42b3afcc05c18fe7bfffb.zip
[autoboot] Merge "netboot" command into "autoboot"
Allow "autoboot" to accept an optional list of network devices, and remove the "netboot" command. This saves around 130 bytes. The "netboot" command has existed for approximately 48 hours, so its removal should not cause backwards compatibility issues for anyone. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/hci/commands/autoboot_cmd.c')
-rw-r--r--src/hci/commands/autoboot_cmd.c68
1 files changed, 4 insertions, 64 deletions
diff --git a/src/hci/commands/autoboot_cmd.c b/src/hci/commands/autoboot_cmd.c
index 33788682..6fd34b3a 100644
--- a/src/hci/commands/autoboot_cmd.c
+++ b/src/hci/commands/autoboot_cmd.c
@@ -21,6 +21,7 @@
#include <ipxe/command.h>
#include <ipxe/parseopt.h>
#include <ipxe/netdevice.h>
+#include <hci/ifmgmt_cmd.h>
#include <usr/autoboot.h>
FILE_LICENCE ( GPL2_OR_LATER );
@@ -31,17 +32,10 @@ FILE_LICENCE ( GPL2_OR_LATER );
*
*/
-/** "autoboot" options */
-struct autoboot_options {};
-
-/** "autoboot" option list */
-static struct option_descriptor autoboot_opts[] = {};
-
/** "autoboot" command descriptor */
static struct command_descriptor autoboot_cmd =
- COMMAND_DESC ( struct autoboot_options, autoboot_opts, 0, 0,
- "",
- "Attempt to boot the system" );
+ COMMAND_DESC ( struct ifcommon_options, ifcommon_opts, 0, MAX_ARGUMENTS,
+ "[<interface>...]", "Attempt to boot the system" );
/**
* "autoboot" command
@@ -51,57 +45,7 @@ static struct command_descriptor autoboot_cmd =
* @ret rc Return status code
*/
static int autoboot_exec ( int argc, char **argv ) {
- struct autoboot_options opts;
- int rc;
-
- /* Parse options */
- if ( ( rc = parse_options ( argc, argv, &autoboot_cmd, &opts ) ) != 0 )
- return rc;
-
- /* Try to boot */
- if ( ( rc = autoboot() ) != 0 )
- return rc;
-
- return 0;
-}
-
-/** "netboot" options */
-struct netboot_options {};
-
-/** "netboot" option list */
-static struct option_descriptor netboot_opts[] = {};
-
-/** "netboot" command descriptor */
-static struct command_descriptor netboot_cmd =
- COMMAND_DESC ( struct netboot_options, netboot_opts, 1, 1,
- "<interface>",
- "Attempt to boot the system from <interface>" );
-
-/**
- * "netboot" command
- *
- * @v argc Argument count
- * @v argv Argument list
- * @ret rc Return status code
- */
-static int netboot_exec ( int argc, char **argv ) {
- struct netboot_options opts;
- struct net_device *netdev;
- int rc;
-
- /* Parse options */
- if ( ( rc = parse_options ( argc, argv, &netboot_cmd, &opts ) ) != 0 )
- return rc;
-
- /* Parse interface */
- if ( ( rc = parse_netdev ( argv[optind], &netdev ) ) != 0 )
- return rc;
-
- /* Try to boot */
- if ( ( rc = netboot ( netdev ) ) != 0 )
- return rc;
-
- return 0;
+ return ifcommon_exec ( argc, argv, &autoboot_cmd, netboot, 0 );
}
/** Booting commands */
@@ -110,8 +54,4 @@ struct command autoboot_commands[] __command = {
.name = "autoboot",
.exec = autoboot_exec,
},
- {
- .name = "netboot",
- .exec = netboot_exec,
- },
};