DISK: Avoid trying to change drive type when it is already correct.
This commit is contained in:
parent
c76086bc00
commit
5bec9d58dd
1 changed files with 16 additions and 11 deletions
11
sim_disk.c
11
sim_disk.c
|
@ -2541,7 +2541,8 @@ if ((DK_GET_FMT (uptr) == DKUF_F_VHD) || (ctx->footer)) {
|
||||||
|
|
||||||
if (((sector_size == 0) || (sector_size == ctx->sector_size)) &&
|
if (((sector_size == 0) || (sector_size == ctx->sector_size)) &&
|
||||||
((xfer_element_size == 0) || (xfer_element_size == ctx->xfer_element_size))) {
|
((xfer_element_size == 0) || (xfer_element_size == ctx->xfer_element_size))) {
|
||||||
if ((strcmp (container_dtype, dtype) != 0) && (drivetypes == NULL)) /* No Autosize */
|
if (strcmp (container_dtype, dtype) != 0) {
|
||||||
|
if (drivetypes == NULL) /* No Autosize */
|
||||||
r = sim_messagef (SCPE_OPENERR, "%s: Can't attach %s container to %s unit - Autosizing disk disabled\n", sim_uname (uptr), container_dtype, dtype);
|
r = sim_messagef (SCPE_OPENERR, "%s: Can't attach %s container to %s unit - Autosizing disk disabled\n", sim_uname (uptr), container_dtype, dtype);
|
||||||
else {
|
else {
|
||||||
cmd[sizeof (cmd) - 1] = '\0';
|
cmd[sizeof (cmd) - 1] = '\0';
|
||||||
|
@ -2551,6 +2552,7 @@ if ((DK_GET_FMT (uptr) == DKUF_F_VHD) || (ctx->footer)) {
|
||||||
r = sim_messagef (r, "Can't set %s to drive type %s\n", sim_uname (uptr), container_dtype);
|
r = sim_messagef (r, "Can't set %s to drive type %s\n", sim_uname (uptr), container_dtype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
r = sim_messagef (SCPE_INCOMPDSK, "%s container created by the %s simulator is incompatible with the %s device on the %s simulator\n", container_dtype, created_name, uptr->dptr->name, sim_name);
|
r = sim_messagef (SCPE_INCOMPDSK, "%s container created by the %s simulator is incompatible with the %s device on the %s simulator\n", container_dtype, created_name, uptr->dptr->name, sim_name);
|
||||||
if (r != SCPE_OK) {
|
if (r != SCPE_OK) {
|
||||||
|
@ -2736,9 +2738,11 @@ if (container_size && (container_size != (t_offset)-1)) {
|
||||||
return SCPE_FSSIZE;
|
return SCPE_FSSIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
|
if (!created)
|
||||||
sim_messagef (SCPE_OK, "%s: No File System found on '%s', skipping autosizing\n", sim_uname (uptr), cptr);
|
sim_messagef (SCPE_OK, "%s: No File System found on '%s', skipping autosizing\n", sim_uname (uptr), cptr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ((container_size != current_unit_size) &&
|
if ((container_size != current_unit_size) &&
|
||||||
((DKUF_F_VHD == DK_GET_FMT (uptr)) || (0 != (uptr->flags & UNIT_RO)) ||
|
((DKUF_F_VHD == DK_GET_FMT (uptr)) || (0 != (uptr->flags & UNIT_RO)) ||
|
||||||
(ctx->footer))) {
|
(ctx->footer))) {
|
||||||
|
@ -5899,7 +5903,8 @@ if (flag) { /* zap type */
|
||||||
if ((container_size != (t_offset)-1) && (container_size > sizeof (*f)) &&
|
if ((container_size != (t_offset)-1) && (container_size > sizeof (*f)) &&
|
||||||
(sim_fseeko (container, container_size - sizeof (*f), SEEK_SET) == 0) &&
|
(sim_fseeko (container, container_size - sizeof (*f), SEEK_SET) == 0) &&
|
||||||
(sizeof (*f) == sim_fread (f, 1, sizeof (*f), container))) {
|
(sizeof (*f) == sim_fread (f, 1, sizeof (*f), container))) {
|
||||||
if (f->Checksum == NtoHl (eth_crc32 (0, f, sizeof (*f) - sizeof (f->Checksum)))) {
|
if ((memcmp (f->Signature, "simh", 4) == 0) &&
|
||||||
|
(f->Checksum == NtoHl (eth_crc32 (0, f, sizeof (*f) - sizeof (f->Checksum))))) {
|
||||||
(void)sim_set_fsize (container, (t_addr)(container_size - sizeof (*f)));
|
(void)sim_set_fsize (container, (t_addr)(container_size - sizeof (*f)));
|
||||||
fclose (container);
|
fclose (container);
|
||||||
return sim_messagef (SCPE_OK, "Disk Type Removed from container '%s'\n", cptr);
|
return sim_messagef (SCPE_OK, "Disk Type Removed from container '%s'\n", cptr);
|
||||||
|
|
Loading…
Add table
Reference in a new issue