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
 	rc = int13_boot ( drive.drive );
49
 	rc = int13_boot ( drive.drive );
50
 	printf ( "Boot failed\n" );
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
 	printf ( "Unregistering BIOS drive %#02x\n", drive.drive );
56
 	printf ( "Unregistering BIOS drive %#02x\n", drive.drive );
53
 	unregister_int13_drive ( &drive );
57
 	unregister_int13_drive ( &drive );
54
 
58
 

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

50
 	rc = int13_boot ( drive->drive );
50
 	rc = int13_boot ( drive->drive );
51
 	printf ( "Boot failed\n" );
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
 	printf ( "Unregistering BIOS drive %#02x\n", drive->drive );
57
 	printf ( "Unregistering BIOS drive %#02x\n", drive->drive );
54
 	unregister_int13_drive ( drive );
58
 	unregister_int13_drive ( drive );
55
 
59
 

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

4
 #include <stdio.h>
4
 #include <stdio.h>
5
 #include <errno.h>
5
 #include <errno.h>
6
 #include <gpxe/iscsi.h>
6
 #include <gpxe/iscsi.h>
7
-#include <gpxe/settings.h>
8
-#include <gpxe/dhcp.h>
9
 #include <gpxe/netdevice.h>
7
 #include <gpxe/netdevice.h>
10
 #include <gpxe/ibft.h>
8
 #include <gpxe/ibft.h>
11
-#include <gpxe/init.h>
12
 #include <gpxe/sanboot.h>
9
 #include <gpxe/sanboot.h>
13
 #include <int13.h>
10
 #include <int13.h>
14
-#include <usr/autoboot.h>
15
 
11
 
16
 FILE_LICENCE ( GPL2_OR_LATER );
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
 static int iscsiboot ( const char *root_path ) {
14
 static int iscsiboot ( const char *root_path ) {
26
 	struct scsi_device *scsi;
15
 	struct scsi_device *scsi;
27
 	struct int13_drive *drive;
16
 	struct int13_drive *drive;
28
-	int keep_san;
29
 	int rc;
17
 	int rc;
30
 
18
 
31
 	scsi = zalloc ( sizeof ( *scsi ) );
19
 	scsi = zalloc ( sizeof ( *scsi ) );
67
 	printf ( "Boot failed\n" );
55
 	printf ( "Boot failed\n" );
68
 
56
 
69
 	/* Leave drive registered, if instructed to do so */
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
 		return rc;
59
 		return rc;
75
-	}
76
 
60
 
77
 	printf ( "Unregistering BIOS drive %#02x\n", drive->drive );
61
 	printf ( "Unregistering BIOS drive %#02x\n", drive->drive );
78
 	unregister_int13_drive ( drive );
62
 	unregister_int13_drive ( drive );

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

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
 
15
 
16
 #define __sanboot_protocol __table_entry ( SANBOOT_PROTOCOLS, 01 )
16
 #define __sanboot_protocol __table_entry ( SANBOOT_PROTOCOLS, 01 )
17
 
17
 
18
+extern int keep_san ( void );
19
+
18
 #endif /* _GPXE_SANBOOT_H */
20
 #endif /* _GPXE_SANBOOT_H */

Loading…
Cancelar
Guardar