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 editing outer partitions:



details:   https://anonhg.NetBSD.org/src/rev/34d86e4d715a
branches:  trunk
changeset: 457637:34d86e4d715a
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Jul 09 16:14:46 2019 +0000

description:
When editing outer partitions:
 - when there are no outer partitions to edit, just report success and go
   on, instead of failing an assertion.
 - use the partitions passed as argument and avoid refering (the hopefully
   same set) via the global pm device pointer.

When checking for pre-exisiting partitions, skip non-user partitions
(like the raw partition in disklabel, or extended partitions in MBR).

diffstat:

 usr.sbin/sysinst/part_edit.c |  25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diffs (62 lines):

diff -r e891c37b77f2 -r 34d86e4d715a usr.sbin/sysinst/part_edit.c
--- a/usr.sbin/sysinst/part_edit.c      Tue Jul 09 13:59:25 2019 +0000
+++ b/usr.sbin/sysinst/part_edit.c      Tue Jul 09 16:14:46 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: part_edit.c,v 1.5 2019/06/22 20:46:07 christos Exp $ */
+/*     $NetBSD: part_edit.c,v 1.6 2019/07/09 16:14:46 martin Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -1085,24 +1085,25 @@
        if (pm && (pm->no_part || pm->no_mbr))
                return true;
 
-       /* Make sure pm has been properly initialized */
-       assert(pm->parts && pm->parts->pscheme);
+       /* Make sure parts has been properly initialized */
+       assert(parts && parts->pscheme);
 
-       if (partman_go)
+       if (parts->pscheme->secondary_scheme == NULL)
+               return true;    /* no outer parts */
+
+       if (partman_go) {
                layout = LY_SETSIZES;
-       else {
+       } else {
                /* Ask full/part */
                const struct disk_partitioning_scheme *sec =
-                   pm->parts->pscheme->secondary_scheme;
-
-               assert(sec != NULL);
+                   parts->pscheme->secondary_scheme;
 
                uint64_t m_size =
                    DEFROOTSIZE + DEFSWAPSIZE + DEFUSRSIZE + XNEEDMB;
                char min_size[5], build_size[5];
                const char
-                   *prim_name = msg_string(pm->parts->pscheme->name),
-                   *prim_short = msg_string(pm->parts->pscheme->short_name),
+                   *prim_name = msg_string(parts->pscheme->name),
+                   *prim_short = msg_string(parts->pscheme->short_name),
                    *sec_name = msg_string(sec->name),
                    *sec_short = msg_string(sec->short_name);
 
@@ -1120,7 +1121,7 @@
                    min_size, build_size);
                msg_display_add("\n\n");
 
-               layout = ask_fullpart(pm->parts);
+               layout = ask_fullpart(parts);
        }
 
        if (layout == LY_USEFULL) {
@@ -1133,6 +1134,8 @@
                                continue;
                        if (info.size == 0)
                                continue;
+                       if (info.flags & (PTI_PSCHEME_INTERNAL|PTI_RAW_PART))
+                               continue;
                        if (info.nat_type != NULL
                            && info.nat_type->generic_ptype != PT_root
                            && info.nat_type->generic_ptype != PT_swap)



Home | Main Index | Thread Index | Old Index