#include <stdint.h>#include <string.h>#include <stdlib.h>#include <stdio.h>#include <errno.h>#include <gpxe/iscsi.h>#include <gpxe/netdevice.h>#include <gpxe/ibft.h>#include <gpxe/sanboot.h>#include <int13.h>Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| static int | iscsiboot (const char *root_path) |
Variables | |
| struct sanboot_protocol iscsi_sanboot_protocol | __sanboot_protocol |
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| static int iscsiboot | ( | const char * | root_path | ) | [static] |
Definition at line 14 of file iscsiboot.c.
References scsi_device::backend, scsi_device::blockdev, int13_drive::blockdev, container_of, int13_drive::drive, ENOMEM, free(), ibft_fill_data(), init_scsidev(), int13_boot(), iscsi_attach(), iscsi_detach(), keep_san(), last_opened_netdev(), netdev, printf(), register_int13_drive(), strerror(), unregister_int13_drive(), and zalloc().
00014 { 00015 struct scsi_device *scsi; 00016 struct int13_drive *drive; 00017 int rc; 00018 00019 scsi = zalloc ( sizeof ( *scsi ) ); 00020 if ( ! scsi ) { 00021 rc = -ENOMEM; 00022 goto err_alloc_scsi; 00023 } 00024 drive = zalloc ( sizeof ( *drive ) ); 00025 if ( ! drive ) { 00026 rc = -ENOMEM; 00027 goto err_alloc_drive; 00028 } 00029 00030 if ( ( rc = iscsi_attach ( scsi, root_path ) ) != 0 ) { 00031 printf ( "Could not attach iSCSI device: %s\n", 00032 strerror ( rc ) ); 00033 goto err_attach; 00034 } 00035 if ( ( rc = init_scsidev ( scsi ) ) != 0 ) { 00036 printf ( "Could not initialise iSCSI device: %s\n", 00037 strerror ( rc ) ); 00038 goto err_init; 00039 } 00040 00041 drive->blockdev = &scsi->blockdev; 00042 00043 /* FIXME: ugly, ugly hack */ 00044 struct net_device *netdev = last_opened_netdev(); 00045 struct iscsi_session *iscsi = 00046 container_of ( scsi->backend, struct iscsi_session, refcnt ); 00047 ibft_fill_data ( netdev, iscsi ); 00048 00049 register_int13_drive ( drive ); 00050 printf ( "Registered as BIOS drive %#02x\n", drive->drive ); 00051 printf ( "Booting from BIOS drive %#02x\n", drive->drive ); 00052 rc = int13_boot ( drive->drive ); 00053 printf ( "Boot failed\n" ); 00054 00055 /* Leave drive registered, if instructed to do so */ 00056 if ( keep_san() ) 00057 return rc; 00058 00059 printf ( "Unregistering BIOS drive %#02x\n", drive->drive ); 00060 unregister_int13_drive ( drive ); 00061 00062 err_init: 00063 iscsi_detach ( scsi ); 00064 err_attach: 00065 free ( drive ); 00066 err_alloc_drive: 00067 free ( scsi ); 00068 err_alloc_scsi: 00069 return rc; 00070 }
| struct sanboot_protocol iscsi_sanboot_protocol __sanboot_protocol |
Initial value:
{
.prefix = "iscsi:",
.boot = iscsiboot,
}
Definition at line 72 of file iscsiboot.c.
1.5.7.1