DISK: Add SET NOAUTOSIZE - disable autosize when attaching existing containers
This is a global command possibly for folks who have configurations which always explicitly specify the drive type they want a particular unit to be before they attach a container to the unit. The side effect of this will be to avoid the addition of drive type describing meta data to disk containers.
This commit is contained in:
parent
af4f37efac
commit
eac0e5680b
3 changed files with 47 additions and 1 deletions
6
scp.c
6
scp.c
|
@ -1546,7 +1546,10 @@ static const char simh_help1[] =
|
||||||
"+SET <unit> DISABLED disable unit\n"
|
"+SET <unit> DISABLED disable unit\n"
|
||||||
"+SET <unit> arg{,arg...} set unit parameters (see show modifiers)\n"
|
"+SET <unit> arg{,arg...} set unit parameters (see show modifiers)\n"
|
||||||
"+HELP <dev> SET displays the device specific set commands\n"
|
"+HELP <dev> SET displays the device specific set commands\n"
|
||||||
"++++++++ available\n";
|
"++++++++ available\n"
|
||||||
|
#define HLP_NOAUTOSIZE "*Commands SET NoAutosize"
|
||||||
|
"3NoAutosize\n"
|
||||||
|
"+SET NOAUTOSIZE disables disk autosizing for all disks\n";
|
||||||
static const char simh_help2[] =
|
static const char simh_help2[] =
|
||||||
/***************** 80 character line width template *************************/
|
/***************** 80 character line width template *************************/
|
||||||
#define HLP_SHOW "*Commands SHOW"
|
#define HLP_SHOW "*Commands SHOW"
|
||||||
|
@ -2597,6 +2600,7 @@ static CTAB set_glob_tab[] = {
|
||||||
{ "PROMPT", &set_prompt, 0, HLP_SET_PROMPT },
|
{ "PROMPT", &set_prompt, 0, HLP_SET_PROMPT },
|
||||||
{ "RUNLIMIT", &set_runlimit, 1, HLP_RUNLIMIT },
|
{ "RUNLIMIT", &set_runlimit, 1, HLP_RUNLIMIT },
|
||||||
{ "NORUNLIMIT", &set_runlimit, 0, HLP_RUNLIMIT },
|
{ "NORUNLIMIT", &set_runlimit, 0, HLP_RUNLIMIT },
|
||||||
|
{ "NOAUTOSIZE", &sim_disk_set_noautosize, 1, HLP_NOAUTOSIZE },
|
||||||
{ NULL, NULL, 0 }
|
{ NULL, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
41
sim_disk.c
41
sim_disk.c
|
@ -516,6 +516,37 @@ AIO_CALL(DOP_IAVL, 0, NULL, NULL, 0, callback);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static t_bool sim_disk_no_autosize = FALSE;
|
||||||
|
|
||||||
|
t_stat sim_disk_set_noautosize (int32 flag, CONST char *cptr)
|
||||||
|
{
|
||||||
|
DEVICE *dptr;
|
||||||
|
uint32 dev, unit, count = 0;
|
||||||
|
|
||||||
|
if (flag == sim_disk_no_autosize)
|
||||||
|
return sim_messagef (SCPE_ARG, "Autosizing is already %sabled!\n",
|
||||||
|
sim_disk_no_autosize ? "dis" : "en");
|
||||||
|
for (dev = 0; (dptr = sim_devices[dev]) != NULL; dev++) {
|
||||||
|
if ((DEV_TYPE (dptr) != DEV_DISK) ||
|
||||||
|
(dptr->flags & DEV_DIS))
|
||||||
|
continue;
|
||||||
|
++count;
|
||||||
|
for (unit = 0; unit < dptr->numunits; unit++) {
|
||||||
|
char cmd[CBUFSIZE];
|
||||||
|
int32 saved_sim_show_message = sim_show_message;
|
||||||
|
|
||||||
|
sim_show_message = FALSE;
|
||||||
|
sprintf (cmd, "%s %sAUTOSIZE", sim_uname (&dptr->units[unit]), (flag != 0) ? "NO" : "");
|
||||||
|
set_cmd (0, cmd);
|
||||||
|
sim_show_message = saved_sim_show_message;
|
||||||
|
}
|
||||||
|
if (count == 0)
|
||||||
|
return sim_messagef (SCPE_ARG, "No disk devices support autosizing\n");
|
||||||
|
}
|
||||||
|
sim_disk_no_autosize = flag;
|
||||||
|
return SCPE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* Test for write protect */
|
/* Test for write protect */
|
||||||
|
|
||||||
t_bool sim_disk_wrp (UNIT *uptr)
|
t_bool sim_disk_wrp (UNIT *uptr)
|
||||||
|
@ -2421,6 +2452,10 @@ t_bool auto_format = FALSE;
|
||||||
t_offset container_size, filesystem_size, current_unit_size;
|
t_offset container_size, filesystem_size, current_unit_size;
|
||||||
size_t tmp_size = 1;
|
size_t tmp_size = 1;
|
||||||
|
|
||||||
|
if (sim_disk_no_autosize) {
|
||||||
|
dontchangecapac = TRUE;
|
||||||
|
drivetypes = NULL;
|
||||||
|
}
|
||||||
if (uptr->flags & UNIT_DIS) /* disabled? */
|
if (uptr->flags & UNIT_DIS) /* disabled? */
|
||||||
return SCPE_UDIS;
|
return SCPE_UDIS;
|
||||||
if (!(uptr->flags & UNIT_ATTABLE)) /* not attachable? */
|
if (!(uptr->flags & UNIT_ATTABLE)) /* not attachable? */
|
||||||
|
@ -6286,6 +6321,12 @@ return WriteVirtualDiskSectors(hVHD, buf, sects, sectswritten, ctx->sector_size,
|
||||||
|
|
||||||
t_stat sim_disk_init (void)
|
t_stat sim_disk_init (void)
|
||||||
{
|
{
|
||||||
|
int32 saved_sim_show_message = sim_show_message;
|
||||||
|
|
||||||
|
sim_show_message = FALSE;
|
||||||
|
sim_disk_no_autosize = TRUE;
|
||||||
|
sim_disk_set_noautosize (FALSE, NULL);
|
||||||
|
sim_show_message = saved_sim_show_message;
|
||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,6 +128,7 @@ t_bool sim_disk_vhd_support (void);
|
||||||
t_bool sim_disk_raw_support (void);
|
t_bool sim_disk_raw_support (void);
|
||||||
void sim_disk_data_trace (UNIT *uptr, const uint8 *data, size_t lba, size_t len, const char* txt, int detail, uint32 reason);
|
void sim_disk_data_trace (UNIT *uptr, const uint8 *data, size_t lba, size_t len, const char* txt, int detail, uint32 reason);
|
||||||
t_stat sim_disk_info_cmd (int32 flag, CONST char *ptr);
|
t_stat sim_disk_info_cmd (int32 flag, CONST char *ptr);
|
||||||
|
t_stat sim_disk_set_noautosize (int32 flag, CONST char *cptr);
|
||||||
t_stat sim_disk_test (DEVICE *dptr, const char *cptr);
|
t_stat sim_disk_test (DEVICE *dptr, const char *cptr);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
Loading…
Add table
Reference in a new issue