Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[sanboot] Extend the "keep-san" option to non-iSCSI SAN protocols
This disgustingly ugly hack just keeps getting worse.
  • Loading branch information
Michael Brown committed Nov 4, 2009
1 parent 67015d1 commit be67084
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 17 deletions.
4 changes: 4 additions & 0 deletions src/arch/i386/interface/pcbios/aoeboot.c
Expand Up @@ -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 );

Expand Down
4 changes: 4 additions & 0 deletions src/arch/i386/interface/pcbios/ib_srpboot.c
Expand Up @@ -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 );

Expand Down
18 changes: 1 addition & 17 deletions src/arch/i386/interface/pcbios/iscsiboot.c
Expand Up @@ -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 ) );
Expand Down Expand Up @@ -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 );
Expand Down
26 changes: 26 additions & 0 deletions 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;
}
2 changes: 2 additions & 0 deletions src/include/gpxe/sanboot.h
Expand Up @@ -15,4 +15,6 @@ struct sanboot_protocol {

#define __sanboot_protocol __table_entry ( SANBOOT_PROTOCOLS, 01 )

extern int keep_san ( void );

#endif /* _GPXE_SANBOOT_H */

0 comments on commit be67084

Please sign in to comment.