pjw wrote:The driver should give a 'bad or changed medium' if the image file gets changed 'on the fly'. I will look into it.
Considering the way you have implemented the driver, off the top of my head I cant think of a situation where this condition would occur: Presumably the driver for the device the image is on would detect that and return the error to your driver?
The test I have been trying over the weekend is to mount an image, open a file on that image, unmount the image, mount another image, and then try to read from the previously opened file.
I would have expected an error of some sort (bad or changed medium?), but it does not error, it may return nothing, or just wait, or rubbish? I think I will try the same thing with a couple of real floppy disks to see what the real thing does in that situation.
Looking at the code reminded me of why I thought this 'disk swapping' was handled already. The SMSQ/E driver seems to have a flag system, that monitors if a drive is rotating. During an OPEN, if the drive is rotating then it could not have been changed since the last time it was checked. If it has stopped rotating then it may have been changed, and needs to checked. My mount and unmount commands set the flag to stopped, so that the next time OPEN is called it knows to check for a disk change.
So I was working on the theory that once the image file is flagged as rotating (the OPEN routine does this), it never stops until its unmounted. But I now don't think that the I/O routines check if the drive has stopped (as a floppy may). So by opening a file, unmounting an image, then mounting another image. The I/O routines think nothing has happened. I'm not sure how the real thing handles I/O if the drive has stopped. Unless its handled by the slave block mechanism (which I don't use).
I may need to add a check in the I/O, and maybe the CLOSE routines, to check if the drive has stopped, and return an error (bad or changed medium?).
Sorry if I've rambled on a bit...Now I hesitate to ask, but there's been no mention of any problems with using the driver itself. So do I take it that it seems to be working OK otherwise.
Martin.