*
* @v uri URI
* @v drive Drive number
- * @ret rc Return status code
+ * @ret drive Drive number, or negative error
*
* Registers the drive with the INT 13 emulation subsystem, and hooks
* the INT 13 interrupt vector (if not already hooked).
int13_sync_num_drives();
natural_drive = ( ( drive & 0x80 ) ? ( num_drives | 0x80 ) : num_fdds );
+ /* Use natural drive number if directed to do so */
+ if ( ( drive & 0x7f ) == 0x7f )
+ drive = natural_drive;
+
/* Check that drive number is not in use */
list_for_each_entry ( int13, &int13s, list ) {
if ( int13->drive == drive ) {
int13_sync_num_drives();
free ( scratch );
- return 0;
+ return drive;
err_guess_geometry:
err_parse_iso9660:
/* Hook SAN device, if applicable */
if ( root_path ) {
- if ( ( rc = san_hook ( root_path, drive ) ) != 0 ) {
+ drive = san_hook ( root_path, drive );
+ if ( drive < 0 ) {
+ rc = drive;
printf ( "Could not open SAN device: %s\n",
strerror ( rc ) );
goto err_san_hook;
}
/* Describe SAN device, if applicable */
- if ( ( drive >= 0 ) && ! ( flags & URIBOOT_NO_SAN_DESCRIBE ) ) {
+ if ( ! ( flags & URIBOOT_NO_SAN_DESCRIBE ) ) {
if ( ( rc = san_describe ( drive ) ) != 0 ) {
printf ( "Could not describe SAN device %#02x: %s\n",
drive, strerror ( rc ) );
}
/* Attempt SAN boot if applicable */
- if ( ( drive >= 0 ) && ! ( flags & URIBOOT_NO_SAN_BOOT ) ) {
+ if ( ! ( flags & URIBOOT_NO_SAN_BOOT ) ) {
if ( fetch_intz_setting ( NULL, &skip_san_boot_setting) == 0 ) {
printf ( "Booting from SAN device %#02x\n", drive );
rc = san_boot ( drive );
err_download:
err_san_describe:
/* Unhook SAN device, if applicable */
- if ( ( drive >= 0 ) && ! ( flags & URIBOOT_NO_SAN_UNHOOK ) ) {
+ if ( ! ( flags & URIBOOT_NO_SAN_UNHOOK ) ) {
if ( fetch_intz_setting ( NULL, &keep_san_setting ) == 0 ) {
san_unhook ( drive );
printf ( "Unregistered SAN device %#02x\n", drive );