Skip floopies when selecting an install target, but do not add them to

the CD list when selecting an installation source device.
This commit is contained in:
martin 2018-11-11 10:06:09 +00:00
parent 8b5066c45d
commit 57cf8237b6
3 changed files with 18 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: defs.h,v 1.23 2018/11/11 09:17:10 martin Exp $ */
/* $NetBSD: defs.h,v 1.24 2018/11/11 10:06:09 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -482,7 +482,7 @@ void toplevel(void);
bool get_default_cdrom(char *, size_t);
int find_disks(const char *);
bool enumerate_disks(void *state,bool (*func)(void *state, const char *dev));
bool is_cdrom_device(const char *dev);
bool is_cdrom_device(const char *dev, bool as_target);
struct menudesc;
void fmt_fspart(struct menudesc *, int, void *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: disks.c,v 1.24 2018/11/11 09:17:10 martin Exp $ */
/* $NetBSD: disks.c,v 1.25 2018/11/11 10:06:09 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -369,7 +369,7 @@ get_default_cdrom_helper(void *state, const char *dev)
{
struct default_cdrom_data *data = state;
if (!is_cdrom_device(dev))
if (!is_cdrom_device(dev, false))
return true;
strlcpy(data->device, dev, data->max_len);
@ -511,11 +511,12 @@ is_ffs_wedge(const char *dev)
/*
* Does this device match an entry in our default CDROM device list?
* If looking for install targets, we also flag floopy devices.
*/
bool
is_cdrom_device(const char *dev)
is_cdrom_device(const char *dev, bool as_target)
{
static const char *cdrom_devices[] = {
static const char *target_devices[] = {
#ifdef CD_NAMES
CD_NAMES
#endif
@ -530,8 +531,15 @@ is_cdrom_device(const char *dev)
#endif
0
};
static const char *src_devices[] = {
#ifdef CD_NAMES
CD_NAMES ,
#endif
0
};
for (const char **dev_pat = cdrom_devices; *dev_pat; dev_pat++)
for (const char **dev_pat = as_target ? target_devices : src_devices;
*dev_pat; dev_pat++)
if (fnmatch(*dev_pat, dev, 0) == 0)
return true;
@ -593,7 +601,7 @@ get_disks_helper(void *arg, const char *dev)
struct disklabel l;
/* is this a CD device? */
if (is_cdrom_device(dev))
if (is_cdrom_device(dev, true))
return true;
strlcpy(state->dd->dd_name, dev, sizeof state->dd->dd_name - 2);

View File

@ -1,4 +1,4 @@
/* $NetBSD: util.c,v 1.15 2018/11/08 20:29:37 martin Exp $ */
/* $NetBSD: util.c,v 1.16 2018/11/11 10:06:09 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -431,7 +431,7 @@ get_available_cds_helper(void *arg, const char *device)
struct disklabel label;
int part, dev, error, sess, ready;
if (!is_cdrom_device(device))
if (!is_cdrom_device(device, false))
return true;
sprintf(dname, "/dev/r%s%c", device, 'a'+RAW_PART);