[PATCH 3/3] Disable failing HD images |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- Subject: [PATCH 3/3] Disable failing HD images
- From: Eero Tamminen <oak@xxxxxxxxxxxxxx>
- Date: Sun, 22 Nov 2020 00:48:38 +0200
Fixes following issue:
* User starts hatari with IDE: hatari --ide-master disk.img
* User selects same image also for another interface in GUI,
e.g. for ACSI, and proceeds
-> Hatari ACSI file locking fails, and it's not mounted
* User ejects IDE image from GUI, leaves ACSI image as-is and proceeds
=> Hatari won't (re-)initialize ACSI as its config did not change, and
as result ACSI drive won't be mounted to emulation, although it's
still visible in the GUI as being mounted.
After the change, ACSI image name isn't anymore shown in the GUI after
failure, as it's now disabled. When user browses it again, he can
just OK the old name, one doesn't need to search for it.
---
src/hdc.c | 2 ++
src/ide.c | 6 +++++-
src/ncr5380.c | 2 ++
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/hdc.c b/src/hdc.c
index edf9421a..e6f3488c 100644
--- a/src/hdc.c
+++ b/src/hdc.c
@@ -883,6 +883,8 @@ bool HDC_Init(void)
nAcsiPartitions += HDC_PartitionCount(AcsiBus.devs[i].image_file, TRACE_SCSI_CMD, NULL);
bAcsiEmuOn = true;
}
+ else
+ ConfigureParams.Acsi[i].bUseDevice = false;
}
/* set total number of partitions */
nNumDrives += nAcsiPartitions;
diff --git a/src/ide.c b/src/ide.c
index 61d4cf69..1563fd89 100644
--- a/src/ide.c
+++ b/src/ide.c
@@ -2740,7 +2740,11 @@ void Ide_Init(void)
if (ConfigureParams.Ide[i].bUseDevice)
{
int is_byteswap;
- bdrv_open(hd_table[i], ConfigureParams.Ide[i].sDeviceFile, ConfigureParams.Ide[i].nBlockSize, 0);
+ if (bdrv_open(hd_table[i], ConfigureParams.Ide[i].sDeviceFile, ConfigureParams.Ide[i].nBlockSize, 0) < 0)
+ {
+ ConfigureParams.Ide[i].bUseDevice = false;
+ continue;
+ }
nIDEPartitions += HDC_PartitionCount(hd_table[i]->fhndl, TRACE_IDE, &is_byteswap);
/* Our IDE implementation is little endian by default,
* so we need to byteswap if the image is not swapped! */
diff --git a/src/ncr5380.c b/src/ncr5380.c
index 4d901ff6..f36c3de5 100644
--- a/src/ncr5380.c
+++ b/src/ncr5380.c
@@ -1041,6 +1041,8 @@ bool Ncr5380_Init(void)
nScsiPartitions += HDC_PartitionCount(ScsiBus.devs[i].image_file, TRACE_SCSI_CMD, NULL);
bScsiEmuOn = true;
}
+ else
+ ConfigureParams.Scsi[i].bUseDevice = false;
}
nNumDrives += nScsiPartitions;
#endif
--
2.20.1
--------------4C2E2705B1012F3979499840
Content-Type: text/x-patch; charset=UTF-8;
name="0002-Fail-IDE-on-IDE-disk-open-errors-and-tell-user-about.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename*0="0002-Fail-IDE-on-IDE-disk-open-errors-and-tell-user-about.pa";
filename*1="tch"