SCP: Normalize writelock/read only behavior
Setting a unit to write locked specifically allows only read access. - If this is done while a unit is attached, it is up to device logic to limit write activity until it is detached. - If this is done while a unit is not attached, a subsequent attach opens the container read only.
This commit is contained in:
parent
2fb741046d
commit
a50dca0ff0
1 changed files with 5 additions and 2 deletions
7
scp.c
7
scp.c
|
@ -8011,14 +8011,17 @@ t_stat set_writelock (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
|
|||
{
|
||||
if (((uptr->flags & UNIT_WPRT) != 0) == val) /* Already set as desired? */
|
||||
return SCPE_OK; /* Do nothing */
|
||||
if (val) /* Lock? */
|
||||
if (val) { /* Lock? */
|
||||
uptr->flags |= UNIT_WLK; /* Do it. */
|
||||
if ((uptr->flags & UNIT_ATT) == 0)
|
||||
uptr->flags |= UNIT_RO; /* Next attach will be Read-Only. */
|
||||
}
|
||||
else /* Unlock */
|
||||
if (((uptr->flags & UNIT_ATT) != 0) && /* Transition from Locked to Unlock while attached read-only? */
|
||||
((uptr->flags & UNIT_RO) != 0))
|
||||
return sim_messagef (SCPE_ALATT, "%s: Can't enable write when attached read only\n", sim_uname (uptr));
|
||||
else
|
||||
uptr->flags &= ~UNIT_WLK;
|
||||
uptr->flags &= ~UNIT_WPRT;
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue