1
0
mirror of https://github.com/simh/simh.git synced 2026-01-11 23:52:58 +00:00

DISK: Assure that unit flags in proper state on an explicit attach or detach

- Make sure unit isn't queued when detached.
- Properly allow (or reject) EXAMINE or DEPOSIT to disks unless format is
- correct.
This commit is contained in:
Mark Pizzolato 2023-06-20 18:50:53 -10:00
parent 6fa6b5292c
commit c73235d8ef
2 changed files with 9 additions and 6 deletions

9
scp.c
View File

@ -10475,10 +10475,11 @@ for (i = 0, j = addr; i < sim_emax; i++, j = j + dptr->aincr) {
else {
if (!(uptr->flags & UNIT_ATT))
return SCPE_UNATT;
if ((uptr->dynflags & UNIT_NO_FIO) ||
(uptr->fileref == NULL) ||
(sim_can_seek (uptr->fileref) == FALSE))
return SCPE_NOFNC;
if (((uptr->flags & UNIT_BUF) == 0) &&
((uptr->dynflags & UNIT_NO_FIO) ||
(uptr->fileref == NULL) ||
(sim_can_seek (uptr->fileref) == FALSE)))
return sim_messagef (SCPE_NOFNC, "Can't seek on %s - %s\n", sim_uname (uptr), uptr->filename ? uptr->filename : "");
if ((uptr->flags & UNIT_FIX) && (j >= uptr->capac)) {
reason = SCPE_NXM;
break;

View File

@ -3994,7 +3994,8 @@ if (uptr->flags & UNIT_BUFABLE) { /* buffer in memory? */
memcpy (uptr->filebuf2, uptr->filebuf, (size_t)ctx->container_size);/* save initial contents */
uptr->flags |= UNIT_BUF; /* mark as buffered */
}
if (DK_GET_FMT (uptr) != DKUF_F_STD)
uptr->dynflags |= UNIT_NO_FIO;
return SCPE_OK;
}
@ -4008,6 +4009,7 @@ char *autozap_filename = NULL;
if (uptr == NULL)
return SCPE_IERR;
sim_cancel (uptr);
if (!(uptr->flags & UNIT_ATT))
return SCPE_UNATT;
@ -7200,7 +7202,7 @@ for (i = 0; NULL != (dptr = sim_devices[i]); i++) {
NULL, &sim_disk_show_autosize, NULL, "Display disk autosize on attach setting" }};
static MTAB autoz[] = {
{ MTAB_XTD|MTAB_VUN, 1, NULL, "AUTOZAP",
&sim_disk_set_autozap, NULL, NULL, "Enable disk metadaat removal on detach" },
&sim_disk_set_autozap, NULL, NULL, "Enable disk metadata removal on detach" },
{ MTAB_XTD|MTAB_VUN, 0, NULL, "NOAUTOZAP",
&sim_disk_set_autozap, NULL, NULL, "Disable disk metadata removal on detach" },
{ MTAB_XTD|MTAB_VUN, 0, "AUTOZAP", NULL,