Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/sysinst Skip floopies when selecting an install tar...



details:   https://anonhg.NetBSD.org/src/rev/7def5ea1cfe0
branches:  trunk
changeset: 836886:7def5ea1cfe0
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Nov 11 10:06:09 2018 +0000

description:
Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.

diffstat:

 usr.sbin/sysinst/defs.h  |   4 ++--
 usr.sbin/sysinst/disks.c |  20 ++++++++++++++------
 usr.sbin/sysinst/util.c  |   4 ++--
 3 files changed, 18 insertions(+), 10 deletions(-)

diffs (95 lines):

diff -r 15203f336af4 -r 7def5ea1cfe0 usr.sbin/sysinst/defs.h
--- a/usr.sbin/sysinst/defs.h   Sun Nov 11 09:17:10 2018 +0000
+++ b/usr.sbin/sysinst/defs.h   Sun Nov 11 10:06:09 2018 +0000
@@ -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 @@
 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 *);
diff -r 15203f336af4 -r 7def5ea1cfe0 usr.sbin/sysinst/disks.c
--- a/usr.sbin/sysinst/disks.c  Sun Nov 11 09:17:10 2018 +0000
+++ b/usr.sbin/sysinst/disks.c  Sun Nov 11 10:06:09 2018 +0000
@@ -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 @@
 {
        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 @@
 
 /*
  * 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 @@
 #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 @@
        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);
diff -r 15203f336af4 -r 7def5ea1cfe0 usr.sbin/sysinst/util.c
--- a/usr.sbin/sysinst/util.c   Sun Nov 11 09:17:10 2018 +0000
+++ b/usr.sbin/sysinst/util.c   Sun Nov 11 10:06:09 2018 +0000
@@ -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 @@
        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);



Home | Main Index | Thread Index | Old Index