Explorar el Código

[sanboot] Extend the "keep-san" option to non-iSCSI SAN protocols

This disgustingly ugly hack just keeps getting worse.
tags/v1.0.0-rc1
Michael Brown hace 14 años
padre
commit
be670840c7

+ 4
- 0
src/arch/i386/interface/pcbios/aoeboot.c Ver fichero

@@ -49,6 +49,10 @@ static int aoeboot ( const char *root_path ) {
49 49
 	rc = int13_boot ( drive.drive );
50 50
 	printf ( "Boot failed\n" );
51 51
 
52
+	/* Leave drive registered, if instructed to do so */
53
+	if ( keep_san() )
54
+		return rc;
55
+
52 56
 	printf ( "Unregistering BIOS drive %#02x\n", drive.drive );
53 57
 	unregister_int13_drive ( &drive );
54 58
 

+ 4
- 0
src/arch/i386/interface/pcbios/ib_srpboot.c Ver fichero

@@ -50,6 +50,10 @@ static int ib_srpboot ( const char *root_path ) {
50 50
 	rc = int13_boot ( drive->drive );
51 51
 	printf ( "Boot failed\n" );
52 52
 
53
+	/* Leave drive registered, if instructed to do so */
54
+	if ( keep_san() )
55
+		return rc;
56
+
53 57
 	printf ( "Unregistering BIOS drive %#02x\n", drive->drive );
54 58
 	unregister_int13_drive ( drive );
55 59
 

+ 1
- 17
src/arch/i386/interface/pcbios/iscsiboot.c Ver fichero

@@ -4,28 +4,16 @@
4 4
 #include <stdio.h>
5 5
 #include <errno.h>
6 6
 #include <gpxe/iscsi.h>
7
-#include <gpxe/settings.h>
8
-#include <gpxe/dhcp.h>
9 7
 #include <gpxe/netdevice.h>
10 8
 #include <gpxe/ibft.h>
11
-#include <gpxe/init.h>
12 9
 #include <gpxe/sanboot.h>
13 10
 #include <int13.h>
14
-#include <usr/autoboot.h>
15 11
 
16 12
 FILE_LICENCE ( GPL2_OR_LATER );
17 13
 
18
-struct setting keep_san_setting __setting = {
19
-	.name = "keep-san",
20
-	.description = "Preserve SAN connection",
21
-	.tag = DHCP_EB_KEEP_SAN,
22
-	.type = &setting_type_int8,
23
-};
24
-
25 14
 static int iscsiboot ( const char *root_path ) {
26 15
 	struct scsi_device *scsi;
27 16
 	struct int13_drive *drive;
28
-	int keep_san;
29 17
 	int rc;
30 18
 
31 19
 	scsi = zalloc ( sizeof ( *scsi ) );
@@ -67,12 +55,8 @@ static int iscsiboot ( const char *root_path ) {
67 55
 	printf ( "Boot failed\n" );
68 56
 
69 57
 	/* Leave drive registered, if instructed to do so */
70
-	keep_san = fetch_intz_setting ( NULL, &keep_san_setting );
71
-	if ( keep_san ) {
72
-		printf ( "Preserving connection to SAN disk\n" );
73
-		shutdown_exit_flags |= SHUTDOWN_KEEP_DEVICES;
58
+	if ( keep_san() )
74 59
 		return rc;
75
-	}
76 60
 
77 61
 	printf ( "Unregistering BIOS drive %#02x\n", drive->drive );
78 62
 	unregister_int13_drive ( drive );

+ 26
- 0
src/arch/i386/interface/pcbios/keepsan.c Ver fichero

@@ -0,0 +1,26 @@
1
+#include <stdint.h>
2
+#include <stdio.h>
3
+#include <gpxe/settings.h>
4
+#include <gpxe/dhcp.h>
5
+#include <gpxe/init.h>
6
+#include <gpxe/sanboot.h>
7
+#include <usr/autoboot.h>
8
+
9
+struct setting keep_san_setting __setting = {
10
+	.name = "keep-san",
11
+	.description = "Preserve SAN connection",
12
+	.tag = DHCP_EB_KEEP_SAN,
13
+	.type = &setting_type_int8,
14
+};
15
+
16
+int keep_san ( void ) {
17
+	int keep_san;
18
+
19
+	keep_san = fetch_intz_setting ( NULL, &keep_san_setting );
20
+	if ( ! keep_san )
21
+		return 0;
22
+
23
+	printf ( "Preserving connection to SAN disk\n" );
24
+	shutdown_exit_flags |= SHUTDOWN_KEEP_DEVICES;
25
+	return 1;
26
+}

+ 2
- 0
src/include/gpxe/sanboot.h Ver fichero

@@ -15,4 +15,6 @@ struct sanboot_protocol {
15 15
 
16 16
 #define __sanboot_protocol __table_entry ( SANBOOT_PROTOCOLS, 01 )
17 17
 
18
+extern int keep_san ( void );
19
+
18 20
 #endif /* _GPXE_SANBOOT_H */

Loading…
Cancelar
Guardar