Restore the ability to override the disk unit/partition at the boot: prompt

in gptboot.

When arch-independent geli support was added, a new static 'gdsk' struct
was added, but there was still a static 'dsk' struct, and when you typed
in an alternate disk/partition, the string was parsed into that struct,
which was then never used for anything.  Now the string gets parsed into
gdsk.dsk, the struct that's actually used.

X-MFC after:	3 days
This commit is contained in:
ian 2018-11-27 16:16:38 +00:00
parent 70b242654b
commit b09f57e843

View File

@ -81,7 +81,6 @@ uint32_t opts;
static const char *const dev_nm[NDEV] = {"ad", "da", "fd"};
static const unsigned char dev_maj[NDEV] = {30, 4, 2};
static struct dsk dsk;
static char kname[1024];
static int comspeed = SIOSPD;
static struct bootinfo bootinfo;
@ -569,22 +568,22 @@ parse_cmds(char *cmdstr, int *dskupdated)
arg[1] != dev_nm[i][1]; i++)
if (i == NDEV - 1)
return (-1);
dsk.type = i;
gdsk.dsk.type = i;
arg += 3;
dsk.unit = *arg - '0';
if (arg[1] != 'p' || dsk.unit > 9)
gdsk.dsk.unit = *arg - '0';
if (arg[1] != 'p' || gdsk.dsk.unit > 9)
return (-1);
arg += 2;
dsk.part = *arg - '0';
if (dsk.part < 1 || dsk.part > 9)
gdsk.dsk.part = *arg - '0';
if (gdsk.dsk.part < 1 || gdsk.dsk.part > 9)
return (-1);
arg++;
if (arg[0] != ')')
return (-1);
arg++;
if (drv == -1)
drv = dsk.unit;
dsk.drive = (dsk.type <= TYPE_MAXHARD
drv = gdsk.dsk.unit;
gdsk.dsk.drive = (gdsk.dsk.type <= TYPE_MAXHARD
? DRV_HARD : 0) + drv;
*dskupdated = 1;
}