Re: [hatari-devel] Duplicate drive image file issue

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

Any news on this?

Best regards

Uwe

> Hi,
> 
> No, I'm afraid nothing has changed, the issue is still there.
> 
> Best regards
> 
> Uwe
> 
> > H,
> > 
> > On 11/3/19 9:33 PM, Uwe Seimet wrote:> Hi Roger,
> > >> On 3 Nov 2019 at 8:17, Uwe Seimet wrote:
> > >>>
> > >>> For IDE HD 0 I have configured a drive image to be used. When I select
> > >>> the same image file for ACSI HD 0 and reset Hatari, Hatari reports
> > >>> "Locking HD file for writing failed" and TOS only sees IDE HD 0, but not
> > >>> HD ACSI 0. So far, so good.
> >  >>>
> > >>> Now I eject the file for IDE HD 0, so that the image file is configured
> > >>> for ACSI HD 0 only. After rebooting there is no HD available for TOS
> > >>> at all, even though ACSI HD 0 is the only drive configured with an image
> > >>> file. Looks as if Hatari has not noticed that there is no image file
> > >>> conflict anymore but still ignores the (only) assigned image.
> > >>>
> > >> Are you sure this is not a byte-swapping problem?  My ACSI image and IDE image
> > >> are byte-swapped with respect to each other.
> >  >
> >  > Yes, I'm sure, because if I avoid the locking issue by applying the
> >  > change (i.e. using the image file for ACSI instead of IDE) in a single
> >  > step in the UI, everything is fine.
> > 
> > I think I see the problem.  In:
> > 	change.c::Change_CopyChangedParamsToConfiguration()
> > 
> > UnInit for IDE & ACSI/SCSI drives is called only if the status of drives
> > is changed *and* at least on of the changed drives is still used,
> > i.e. they're unlocked only if IDE or ACSI needs to re-initialized.
> > 
> > Attached quick patch does unInit separately for them.  Does that fix
> > the problem?
> > 
> > 
> > (Additionally the patch also makes code more uniform about the way
> > to ensure atht some other things don't get initialized unless they've
> > been uninitialized.)
> > 
> > 
> > 	- Eero
> 
> > diff --git a/src/change.c b/src/change.c
> > index d50fe801..77e154a7 100644
> > --- a/src/change.c
> > +++ b/src/change.c
> > @@ -182,10 +182,17 @@ void Change_CopyChangedParamsToConfiguration(CNF_PARAMS *current, CNF_PARAMS *ch
> >  {
> >  	bool NeedReset;
> >  	bool bReInitGemdosDrive = false;
> > -	bool bReInitHdcEmu = false;
> > -	bool bReInitIDEEmu = false;
> > +	typedef struct {
> > +		bool unInit;
> > +		bool reInit;
> > +	} images_init_t;
> > +	images_init_t initHdc = { false, false };
> > +	images_init_t initIde = { false, false };
> >  	bool bReInitIoMem = false;
> >  	bool bScreenModeChange = false;
> > +	bool bReInitSound = false;
> > +	bool bReInitRS232 = false;
> > +	bool bReInitSCC = false;
> >  	bool bReInitMidi = false;
> >  	bool bReInitPrinter = false;
> >  	bool bFloppyInsert[MAX_FLOPPYDRIVES];
> > @@ -221,11 +228,12 @@ void Change_CopyChangedParamsToConfiguration(CNF_PARAMS *current, CNF_PARAMS *ch
> >  
> >  	/* Did set new printer parameters? */
> >  	if (changed->Printer.bEnablePrinting != current->Printer.bEnablePrinting
> > -	    || strcmp(changed->Printer.szPrintToFileName,current->Printer.szPrintToFileName))
> > +	    || strcmp(changed->Printer.szPrintToFileName, current->Printer.szPrintToFileName))
> >  	{
> >  		Dprintf("- printer>\n");
> >  		Printer_UnInit();
> > -		bReInitPrinter = true;
> > +		if (changed->Printer.bEnablePrinting)
> > +			bReInitPrinter = true;
> >  	}
> >  
> >  	/* Did set new RS232 parameters? */
> > @@ -235,6 +243,8 @@ void Change_CopyChangedParamsToConfiguration(CNF_PARAMS *current, CNF_PARAMS *ch
> >  	{
> >  		Dprintf("- RS-232>\n");
> >  		RS232_UnInit();
> > +		if (changed->RS232.bEnableRS232)
> > +			bReInitRS232 = true;
> >  	}
> >  
> >  	/* Did set new SCC parameters? */
> > @@ -245,6 +255,8 @@ void Change_CopyChangedParamsToConfiguration(CNF_PARAMS *current, CNF_PARAMS *ch
> >  	{
> >  		Dprintf("- SCC>\n");
> >  		SCC_UnInit();
> > +		if (changed->RS232.bEnableSccB)
> > +			bReInitSCC = true;
> >  	}
> >  
> >  	/* Did stop sound? Or change playback Hz. If so, also stop sound recording */
> > @@ -254,6 +266,8 @@ void Change_CopyChangedParamsToConfiguration(CNF_PARAMS *current, CNF_PARAMS *ch
> >  		if (Sound_AreWeRecording())
> >  			Sound_EndRecording();
> >  		Audio_UnInit();
> > +		if (changed->Sound.bEnableSound)
> > +			bReInitSound = true;
> >  	}
> >  
> >  	/* Did change floppy (images)? */
> > @@ -286,51 +300,55 @@ void Change_CopyChangedParamsToConfiguration(CNF_PARAMS *current, CNF_PARAMS *ch
> >  	/* Did change GEMDOS drive Atari/host location or enabling? */
> >  	if (changed->HardDisk.nGemdosDrive != current->HardDisk.nGemdosDrive
> >  	    || changed->HardDisk.bUseHardDiskDirectories != current->HardDisk.bUseHardDiskDirectories
> > -	    || (strcmp(changed->HardDisk.szHardDiskDirectories[0], current->HardDisk.szHardDiskDirectories[0])
> > -	        && changed->HardDisk.bUseHardDiskDirectories))
> > +	    || strcmp(changed->HardDisk.szHardDiskDirectories[0], current->HardDisk.szHardDiskDirectories[0]))
> >  	{
> >  		Dprintf("- gemdos HD>\n");
> >  		GemDOS_UnInitDrives();
> > -		bReInitGemdosDrive = true;
> > +		if (changed->HardDisk.bUseHardDiskDirectories)
> > +			bReInitGemdosDrive = true;
> >  	}
> >  
> >  	/* Did change ACSI image? */
> >  	for (i = 0; i < MAX_ACSI_DEVS; i++)
> >  	{
> >  		if (changed->Acsi[i].bUseDevice != current->Acsi[i].bUseDevice
> > -		    || (strcmp(changed->Acsi[i].sDeviceFile, current->Acsi[i].sDeviceFile)
> > -		        && changed->Acsi[i].bUseDevice))
> > +		    || strcmp(changed->Acsi[i].sDeviceFile, current->Acsi[i].sDeviceFile))
> >  		{
> >  			Dprintf("- ACSI image %i>\n", i);
> > -			bReInitHdcEmu = true;
> > +			initHdc.unInit = true;
> > +			if (changed->Acsi[i].bUseDevice)
> > +				initHdc.reInit = true;
> > +
> >  		}
> >  	}
> >  	/* Did change SCSI image? */
> >  	for (i = 0; i < MAX_SCSI_DEVS; i++)
> >  	{
> >  		if (changed->Scsi[i].bUseDevice != current->Scsi[i].bUseDevice
> > -		    || (strcmp(changed->Scsi[i].sDeviceFile, current->Scsi[i].sDeviceFile)
> > -		        && changed->Scsi[i].bUseDevice))
> > +		    || strcmp(changed->Scsi[i].sDeviceFile, current->Scsi[i].sDeviceFile))
> >  		{
> >  			Dprintf("- SCSI image %i>\n", i);
> > -			bReInitHdcEmu = true;
> > +			initHdc.unInit = true;
> > +			if (changed->Scsi[i].bUseDevice)
> > +				initHdc.reInit = true;
> >  		}
> >  	}
> > -	if (bReInitHdcEmu)
> > +	if (initHdc.unInit)
> >  		HDC_UnInit();
> >  
> >  	/* Did change IDE HD image? */
> >  	for (i = 0; i < MAX_IDE_DEVS; i++)
> >  	{
> >  		if (changed->Ide[i].bUseDevice != current->Ide[i].bUseDevice
> > -		    || (strcmp(changed->Ide[i].sDeviceFile, current->Ide[i].sDeviceFile)
> > -		        && changed->Ide[i].bUseDevice))
> > +		    || strcmp(changed->Ide[i].sDeviceFile, current->Ide[i].sDeviceFile))
> >  		{
> >  			Dprintf("- IDE image %i>\n", i);
> > -			bReInitIDEEmu = true;
> > +			initIde.unInit = true;
> > +			if (changed->Ide[i].bUseDevice)
> > +				initIde.reInit = true;
> >  		}
> >  	}
> > -	if (bReInitIDEEmu)
> > +	if (initIde.unInit)
> >  		Ide_UnInit();
> >  
> >  	/* Did change blitter, DSP or system type? */
> > @@ -368,7 +386,8 @@ void Change_CopyChangedParamsToConfiguration(CNF_PARAMS *current, CNF_PARAMS *ch
> >  	{
> >  		Dprintf("- midi>\n");
> >  		Midi_UnInit();
> > -		bReInitMidi = true;
> > +		if (changed->Midi.bEnableMidi)
> > +			bReInitMidi = true;
> >  	}
> >  
> >  	/* Copy details to configuration,
> > @@ -399,14 +418,14 @@ void Change_CopyChangedParamsToConfiguration(CNF_PARAMS *current, CNF_PARAMS *ch
> >  	}
> >  
> >  	/* Mount a new ACSI/SCSI HD images: */
> > -	if (bReInitHdcEmu)
> > +	if (initHdc.reInit)
> >  	{
> >  		Dprintf("- HD<\n");
> >  		HDC_Init();
> >  	}
> >  
> >  	/* Mount a new IDE HD images: */
> > -	if (bReInitIDEEmu && (ConfigureParams.Ide[0].bUseDevice || ConfigureParams.Ide[1].bUseDevice))
> > +	if (initIde.reInit)
> >  	{
> >  		Dprintf("- IDE<\n");
> >  		Ide_Init();
> > @@ -423,28 +442,28 @@ void Change_CopyChangedParamsToConfiguration(CNF_PARAMS *current, CNF_PARAMS *ch
> >  	}
> >  
> >  	/* Mount a new GEMDOS drive? */
> > -	if (bReInitGemdosDrive && ConfigureParams.HardDisk.bUseHardDiskDirectories)
> > +	if (bReInitGemdosDrive)
> >  	{
> >  		Dprintf("- gemdos HD<\n");
> >  		GemDOS_InitDrives();
> >  	}
> >  
> >  	/* Restart audio sub system if necessary: */
> > -	if (ConfigureParams.Sound.bEnableSound && !bSoundWorking)
> > +	if (bReInitSound)
> >  	{
> >  		Dprintf("- audio<\n");
> >  		Audio_Init();
> >  	}
> >  
> >  	/* Re-initialize the RS232 emulation: */
> > -	if (ConfigureParams.RS232.bEnableRS232)
> > +	if (bReInitRS232)
> >  	{
> >  		Dprintf("- RS-232<\n");
> >  		RS232_Init();
> >  	}
> >  
> >  	/* Re-initialize the SCC emulation: */
> > -	if (ConfigureParams.RS232.bEnableSccB)
> > +	if (bReInitSCC)
> >  	{
> >  		Dprintf("- SCC<\n");
> >  		SCC_Init();
> 
> 
> 



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/