diff options
author | Michael Brown <mcb30@etherboot.org> | 2008-10-13 10:05:23 +0100 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2008-10-13 10:05:51 +0100 |
commit | 54c024e0af429e544137fb12002591cea50634a8 (patch) | |
tree | 479cfd4116d46412a821257154ed51963da3d7e9 /src/usr | |
parent | d4e152e7667ce8603c2517b8b0e025e54164d6bd (diff) | |
download | ipxe-54c024e0af429e544137fb12002591cea50634a8.zip ipxe-54c024e0af429e544137fb12002591cea50634a8.tar.gz ipxe-54c024e0af429e544137fb12002591cea50634a8.tar.bz2 |
[sanboot] Quick and dirty hack to make SAN boot protocols selectable
Diffstat (limited to 'src/usr')
-rw-r--r-- | src/usr/aoeboot.c | 9 | ||||
-rw-r--r-- | src/usr/autoboot.c | 20 | ||||
-rw-r--r-- | src/usr/iscsiboot.c | 9 |
3 files changed, 28 insertions, 10 deletions
diff --git a/src/usr/aoeboot.c b/src/usr/aoeboot.c index f0e481b..08d21c4 100644 --- a/src/usr/aoeboot.c +++ b/src/usr/aoeboot.c @@ -6,9 +6,9 @@ #include <gpxe/ata.h> #include <gpxe/netdevice.h> #include <gpxe/settings.h> +#include <gpxe/sanboot.h> #include <gpxe/abft.h> #include <int13.h> -#include <usr/aoeboot.h> /** * Guess boot network device @@ -26,7 +26,7 @@ static struct net_device * guess_boot_netdev ( void ) { return NULL; } -int aoeboot ( const char *root_path ) { +static int aoeboot ( const char *root_path ) { struct ata_device ata; struct int13_drive drive; int rc; @@ -71,3 +71,8 @@ int aoeboot ( const char *root_path ) { error_attach: return rc; } + +struct sanboot_protocol aoe_sanboot_protocol __sanboot_protocol = { + .prefix = "aoe:", + .boot = aoeboot, +}; diff --git a/src/usr/autoboot.c b/src/usr/autoboot.c index 326292b..f5f7f7d 100644 --- a/src/usr/autoboot.c +++ b/src/usr/autoboot.c @@ -24,13 +24,12 @@ #include <gpxe/settings.h> #include <gpxe/image.h> #include <gpxe/embedded.h> +#include <gpxe/sanboot.h> #include <gpxe/uri.h> #include <usr/ifmgmt.h> #include <usr/route.h> #include <usr/dhcpmgmt.h> #include <usr/imgmgmt.h> -#include <usr/iscsiboot.h> -#include <usr/aoeboot.h> #include <usr/autoboot.h> /** @file @@ -45,6 +44,12 @@ /** Shutdown flags for exit */ int shutdown_exit_flags = 0; +/* SAN boot protocols */ +static struct sanboot_protocol sanboot_protocols[0] \ + __table_start ( struct sanboot_protocol, sanboot_protocols ); +static struct sanboot_protocol sanboot_protocols_end[0] \ + __table_end ( struct sanboot_protocol, sanboot_protocols ); + /** * Identify the boot network device * @@ -141,12 +146,15 @@ static int boot_next_server_and_filename ( struct in_addr next_server, * @ret rc Return status code */ int boot_root_path ( const char *root_path ) { + struct sanboot_protocol *sanboot; /* Quick hack */ - if ( strncmp ( root_path, "iscsi:", 6 ) == 0 ) { - return iscsiboot ( root_path ); - } else if ( strncmp ( root_path, "aoe:", 4 ) == 0 ) { - return aoeboot ( root_path ); + for ( sanboot = sanboot_protocols ; + sanboot < sanboot_protocols_end ; sanboot++ ) { + if ( strncmp ( root_path, sanboot->prefix, + strlen ( sanboot->prefix ) ) == 0 ) { + return sanboot->boot ( root_path ); + } } return -ENOTSUP; diff --git a/src/usr/iscsiboot.c b/src/usr/iscsiboot.c index 84d77c4..e0098fd 100644 --- a/src/usr/iscsiboot.c +++ b/src/usr/iscsiboot.c @@ -9,9 +9,9 @@ #include <gpxe/netdevice.h> #include <gpxe/ibft.h> #include <gpxe/init.h> +#include <gpxe/sanboot.h> #include <int13.h> #include <usr/autoboot.h> -#include <usr/iscsiboot.h> struct setting keep_san_setting __setting = { .name = "keep-san", @@ -36,7 +36,7 @@ static struct net_device * guess_boot_netdev ( void ) { return NULL; } -int iscsiboot ( const char *root_path ) { +static int iscsiboot ( const char *root_path ) { struct scsi_device *scsi; struct int13_drive *drive; int keep_san; @@ -100,3 +100,8 @@ int iscsiboot ( const char *root_path ) { err_alloc_scsi: return rc; } + +struct sanboot_protocol iscsi_sanboot_protocol __sanboot_protocol = { + .prefix = "iscsi:", + .boot = iscsiboot, +}; |