summaryrefslogtreecommitdiffstats
path: root/src/usr/autoboot.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/usr/autoboot.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/usr/autoboot.c')
-rw-r--r--src/usr/autoboot.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/usr/autoboot.c b/src/usr/autoboot.c
index c7492ea7..738c3cea 100644
--- a/src/usr/autoboot.c
+++ b/src/usr/autoboot.c
@@ -215,6 +215,22 @@ int boot_root_path ( const char *root_path ) {
}
/**
+ * Close all open net devices
+ *
+ * Called before a fresh boot attempt in order to free up memory. We
+ * don't just close the device immediately after the boot fails,
+ * because there may still be TCP connections in the process of
+ * closing.
+ */
+static void close_all_netdevs ( void ) {
+ struct net_device *netdev;
+
+ for_each_netdev ( netdev ) {
+ ifclose ( netdev );
+ }
+}
+
+/**
* Boot from a network device
*
* @v netdev Network device
@@ -232,6 +248,9 @@ int netboot ( struct net_device *netdev ) {
unsigned int pxe_discovery_control;
int rc;
+ /* Close all other network devices */
+ close_all_netdevs();
+
/* Open device and display device status */
if ( ( rc = ifopen ( netdev ) ) != 0 )
return rc;
@@ -275,22 +294,6 @@ int netboot ( struct net_device *netdev ) {
}
/**
- * Close all open net devices
- *
- * Called before a fresh boot attempt in order to free up memory. We
- * don't just close the device immediately after the boot fails,
- * because there may still be TCP connections in the process of
- * closing.
- */
-static void close_all_netdevs ( void ) {
- struct net_device *netdev;
-
- for_each_netdev ( netdev ) {
- ifclose ( netdev );
- }
-}
-
-/**
* Boot the system
*/
int autoboot ( void ) {
@@ -299,7 +302,6 @@ int autoboot ( void ) {
int rc = -ENODEV;
/* If we have an identifable boot device, try that first */
- close_all_netdevs();
if ( ( boot_netdev = find_boot_netdev() ) )
rc = netboot ( boot_netdev );
@@ -307,7 +309,6 @@ int autoboot ( void ) {
for_each_netdev ( netdev ) {
if ( netdev == boot_netdev )
continue;
- close_all_netdevs();
rc = netboot ( netdev );
}