Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst Fix handling of inner/outer partitions (e.g...



details:   https://anonhg.NetBSD.org/src/rev/b53a63bbccaf
branches:  trunk
changeset: 467161:b53a63bbccaf
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Jan 15 19:08:24 2020 +0000

description:
Fix handling of inner/outer partitions (e.g. MBR and disklabel) in
extended partitioning:
 - when editing a disk with such a schme, offer both partitions in two
   steps
 - when commiting changes save the inner partitions after the outer ones

diffstat:

 usr.sbin/sysinst/partman.c |  28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)

diffs (69 lines):

diff -r 807bf41bacb8 -r b53a63bbccaf usr.sbin/sysinst/partman.c
--- a/usr.sbin/sysinst/partman.c        Wed Jan 15 18:47:23 2020 +0000
+++ b/usr.sbin/sysinst/partman.c        Wed Jan 15 19:08:24 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: partman.c,v 1.47 2020/01/10 12:55:14 martin Exp $ */
+/*     $NetBSD: partman.c,v 1.48 2020/01/15 19:08:24 martin Exp $ */
 
 /*
  * Copyright 2012 Eugene Lozovoy
@@ -2650,6 +2650,7 @@
 {
        int retcode;
        struct pm_devs *pm_i;
+       struct disk_partitions *secondary;
 
        pm_retvalue = -1;
        SLIST_FOREACH(pm_i, &pm_head, l) {
@@ -2665,6 +2666,20 @@
                                    pm_i->diskdev);
                        return -1;
                }
+               if (pm_i->parts->pscheme->secondary_scheme != NULL) {
+                       secondary = pm_i->parts->pscheme->
+                           secondary_partitions(pm_i->parts, -1, false);
+                       if (secondary != NULL) {
+                               if (!secondary->pscheme->write_to_disk(
+                                   secondary)) {
+                                       if (logfp)
+                                               fprintf(logfp, 
+                                                   "partitining error %s\n",
+                                                   pm_i->diskdev);
+                                       return -1;
+                               }
+                       }
+               }
        }
 
        /* Call all functions that may create new devices */
@@ -3232,20 +3247,29 @@
 {
        struct pm_devs *my_pm = pm_from_pe(pe);
        struct partition_usage_set pset = { 0 };
+       struct disk_partitions *parts;
 
        if (!my_pm)
                return;
 
        if (!pm_force_parts(my_pm))
                return;
+       parts = my_pm->parts;
 
        clear();
        refresh();
 
-       usage_set_from_parts(&pset, my_pm->parts);
+       if (my_pm->parts->pscheme->secondary_scheme != NULL) {
+               if (!edit_outer_parts(my_pm->parts))
+                       goto done;
+               parts = get_inner_parts(parts);
+       }
+
+       usage_set_from_parts(&pset, parts);
        edit_and_check_label(my_pm, &pset, false);
        free_usage_set(&pset);
 
+done:
        pm_partusage(my_pm, -1, -1);
        my_pm->unsaved = true;
        pm_retvalue = 1;



Home | Main Index | Thread Index | Old Index