Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst When re-discovering a disk where we have fr...



details:   https://anonhg.NetBSD.org/src/rev/c3629ad8bb47
branches:  trunk
changeset: 457966:c3629ad8bb47
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Jul 25 13:11:15 2019 +0000

description:
When re-discovering a disk where we have free the partitions, read
the current partitions again (they might have changed).

diffstat:

 usr.sbin/sysinst/disks.c |  24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diffs (42 lines):

diff -r b88e462d0fba -r c3629ad8bb47 usr.sbin/sysinst/disks.c
--- a/usr.sbin/sysinst/disks.c  Thu Jul 25 11:56:09 2019 +0000
+++ b/usr.sbin/sysinst/disks.c  Thu Jul 25 13:11:15 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disks.c,v 1.43 2019/07/24 14:35:02 martin Exp $ */
+/*     $NetBSD: disks.c,v 1.44 2019/07/25 13:11:15 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -873,15 +873,27 @@
                        already_found = 0;
                        SLIST_FOREACH(pm_i, &pm_head, l) {
                                pm_last = pm_i;
-                               if (!already_found &&
-                                   strcmp(pm_i->diskdev, disk->dd_name) == 0) {
-                                       pm_i->found = 1;
+                               if (strcmp(pm_i->diskdev, disk->dd_name) == 0) {
+                                       already_found = 1;
                                        break;
                                }
                        }
-                       if (pm_i != NULL && pm_i->found)
-                               /* We already added this device, skipping */
+                       if (pm_i != NULL && already_found) {
+                               /*
+                                * We already added this device, but
+                                * partitions might have changed
+                                */
+                               if (!pm_i->found) {
+                                       pm_i->found = true;
+                                       if (pm_i->parts == NULL) {
+                                               pm_i->parts =
+                                                   partitions_read_disk(
+                                                   pm_i->diskdev,
+                                                   disk->dd_totsec);
+                                       }
+                               }
                                continue;
+                       }
                }
                pm = pm_new;
                pm->found = 1;



Home | Main Index | Thread Index | Old Index