diff options
author | Michael Brown | 2009-11-04 02:18:08 +0100 |
---|---|---|
committer | Michael Brown | 2009-11-04 02:21:43 +0100 |
commit | be670840c75165fd290da33a6245f013346b6c6f (patch) | |
tree | 16540c917c3738f00553a4ab7ecd7f2e48f7fec9 | |
parent | [pxebs] Correct endianness of PXE type (diff) | |
download | ipxe-be670840c75165fd290da33a6245f013346b6c6f.tar.gz ipxe-be670840c75165fd290da33a6245f013346b6c6f.tar.xz ipxe-be670840c75165fd290da33a6245f013346b6c6f.zip |
[sanboot] Extend the "keep-san" option to non-iSCSI SAN protocols
This disgustingly ugly hack just keeps getting worse.
-rw-r--r-- | src/arch/i386/interface/pcbios/aoeboot.c | 4 | ||||
-rw-r--r-- | src/arch/i386/interface/pcbios/ib_srpboot.c | 4 | ||||
-rw-r--r-- | src/arch/i386/interface/pcbios/iscsiboot.c | 18 | ||||
-rw-r--r-- | src/arch/i386/interface/pcbios/keepsan.c | 26 | ||||
-rw-r--r-- | src/include/gpxe/sanboot.h | 2 |
5 files changed, 37 insertions, 17 deletions
diff --git a/src/arch/i386/interface/pcbios/aoeboot.c b/src/arch/i386/interface/pcbios/aoeboot.c index 46484c00..fcab42b0 100644 --- a/src/arch/i386/interface/pcbios/aoeboot.c +++ b/src/arch/i386/interface/pcbios/aoeboot.c @@ -49,6 +49,10 @@ static int aoeboot ( const char *root_path ) { rc = int13_boot ( drive.drive ); printf ( "Boot failed\n" ); + /* Leave drive registered, if instructed to do so */ + if ( keep_san() ) + return rc; + printf ( "Unregistering BIOS drive %#02x\n", drive.drive ); unregister_int13_drive ( &drive ); diff --git a/src/arch/i386/interface/pcbios/ib_srpboot.c b/src/arch/i386/interface/pcbios/ib_srpboot.c index 5b9c2c9a..b1cbc337 100644 --- a/src/arch/i386/interface/pcbios/ib_srpboot.c +++ b/src/arch/i386/interface/pcbios/ib_srpboot.c @@ -50,6 +50,10 @@ static int ib_srpboot ( const char *root_path ) { rc = int13_boot ( drive->drive ); printf ( "Boot failed\n" ); + /* Leave drive registered, if instructed to do so */ + if ( keep_san() ) + return rc; + printf ( "Unregistering BIOS drive %#02x\n", drive->drive ); unregister_int13_drive ( drive ); diff --git a/src/arch/i386/interface/pcbios/iscsiboot.c b/src/arch/i386/interface/pcbios/iscsiboot.c index f200c16f..d8bb55a2 100644 --- a/src/arch/i386/interface/pcbios/iscsiboot.c +++ b/src/arch/i386/interface/pcbios/iscsiboot.c @@ -4,28 +4,16 @@ #include <stdio.h> #include <errno.h> #include <gpxe/iscsi.h> -#include <gpxe/settings.h> -#include <gpxe/dhcp.h> #include <gpxe/netdevice.h> #include <gpxe/ibft.h> -#include <gpxe/init.h> #include <gpxe/sanboot.h> #include <int13.h> -#include <usr/autoboot.h> FILE_LICENCE ( GPL2_OR_LATER ); -struct setting keep_san_setting __setting = { - .name = "keep-san", - .description = "Preserve SAN connection", - .tag = DHCP_EB_KEEP_SAN, - .type = &setting_type_int8, -}; - static int iscsiboot ( const char *root_path ) { struct scsi_device *scsi; struct int13_drive *drive; - int keep_san; int rc; scsi = zalloc ( sizeof ( *scsi ) ); @@ -67,12 +55,8 @@ static int iscsiboot ( const char *root_path ) { printf ( "Boot failed\n" ); /* Leave drive registered, if instructed to do so */ - keep_san = fetch_intz_setting ( NULL, &keep_san_setting ); - if ( keep_san ) { - printf ( "Preserving connection to SAN disk\n" ); - shutdown_exit_flags |= SHUTDOWN_KEEP_DEVICES; + if ( keep_san() ) return rc; - } printf ( "Unregistering BIOS drive %#02x\n", drive->drive ); unregister_int13_drive ( drive ); diff --git a/src/arch/i386/interface/pcbios/keepsan.c b/src/arch/i386/interface/pcbios/keepsan.c new file mode 100644 index 00000000..904e017d --- /dev/null +++ b/src/arch/i386/interface/pcbios/keepsan.c @@ -0,0 +1,26 @@ +#include <stdint.h> +#include <stdio.h> +#include <gpxe/settings.h> +#include <gpxe/dhcp.h> +#include <gpxe/init.h> +#include <gpxe/sanboot.h> +#include <usr/autoboot.h> + +struct setting keep_san_setting __setting = { + .name = "keep-san", + .description = "Preserve SAN connection", + .tag = DHCP_EB_KEEP_SAN, + .type = &setting_type_int8, +}; + +int keep_san ( void ) { + int keep_san; + + keep_san = fetch_intz_setting ( NULL, &keep_san_setting ); + if ( ! keep_san ) + return 0; + + printf ( "Preserving connection to SAN disk\n" ); + shutdown_exit_flags |= SHUTDOWN_KEEP_DEVICES; + return 1; +} diff --git a/src/include/gpxe/sanboot.h b/src/include/gpxe/sanboot.h index 6ec2ec24..fd063164 100644 --- a/src/include/gpxe/sanboot.h +++ b/src/include/gpxe/sanboot.h @@ -15,4 +15,6 @@ struct sanboot_protocol { #define __sanboot_protocol __table_entry ( SANBOOT_PROTOCOLS, 01 ) +extern int keep_san ( void ); + #endif /* _GPXE_SANBOOT_H */ |