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 a few of the very stupid mistakes I mad...



details:   https://anonhg.NetBSD.org/src/rev/2024142372e0
branches:  trunk
changeset: 457717:2024142372e0
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Jul 14 15:36:57 2019 +0000

description:
Fix a few of the very stupid mistakes I made when converting this to
the abstract partitioning interface.

diffstat:

 usr.sbin/sysinst/partman.c |  69 +++++++++++++++++++++++++++++++++++++--------
 1 files changed, 56 insertions(+), 13 deletions(-)

diffs (124 lines):

diff -r afb9891d9420 -r 2024142372e0 usr.sbin/sysinst/partman.c
--- a/usr.sbin/sysinst/partman.c        Sun Jul 14 13:55:43 2019 +0000
+++ b/usr.sbin/sysinst/partman.c        Sun Jul 14 15:36:57 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: partman.c,v 1.36 2019/07/13 17:13:36 martin Exp $ */
+/*     $NetBSD: partman.c,v 1.37 2019/07/14 15:36:57 martin Exp $ */
 
 /*
  * Copyright 2012 Eugene Lozovoy
@@ -454,11 +454,11 @@
                line = out;
        }
        if (no_size_display != NULL) {
-               wprintw(w, "%-34s (%s)", line, no_size_display);
+               wprintw(w, "   %-56s (%s)", line, no_size_display);
        } else {
                humanize_number(human, sizeof(human),
                    total, "", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL);
-               wprintw(w, "%-34s %s", line, human);
+               wprintw(w, "   %-56s %s", line, human);
        }
 }
 
@@ -2650,6 +2650,7 @@
        char buf[STRSIZE], dev[STRSIZE];
        part_id part_num = ((struct part_entry *)arg)[opt].id;
        struct pm_devs *pm_cur = ((struct part_entry *)arg)[opt].dev_ptr;
+       struct disk_partitions *parts = ((struct part_entry *)arg)[opt].parts;
        struct disk_part_info info;
        const char *mount_point, *fstype;
 
@@ -2668,11 +2669,16 @@
                                dev_status);
                        break;
                case PM_PART:
-                       pm_cur->parts->pscheme->get_part_device(pm_cur->parts,
-                           part_num, dev, sizeof dev, NULL, plain_name, false);
-                       pm_cur->parts->pscheme->get_part_info(pm_cur->parts,
+                       if (parts->pscheme->get_part_device != NULL)
+                               parts->pscheme->get_part_device(
+                                   parts,  part_num,
+                                   dev, sizeof dev, NULL, plain_name, false);
+                       else
+                               strcpy(dev, "-");
+                       parts->pscheme->get_part_info(parts,
                            part_num, &info);
-                       if (pm_cur->mounted[part_num] != NULL &&
+                       if (pm_cur->mounted != NULL &&
+                           pm_cur->mounted[part_num] != NULL &&
                            pm_cur->mounted[part_num][0] != 0)
                                mount_point = msg_string(MSG_pmmounted);
                        else
@@ -2754,6 +2760,8 @@
        int i = 0;
        size_t ii;
        struct pm_devs *pm_i;
+       struct disk_partitions *secondary;
+       const struct disk_partitioning_scheme *ps;
        struct disk_part_info info;
 
        if (arg != NULL)
@@ -2788,14 +2796,27 @@
                if (pm_i->no_part)
                        ((struct part_entry *)arg)[i].type = PM_SPEC;
                else {
+                       ps = pm_i->parts != NULL ? pm_i->parts->pscheme : NULL;
+                       secondary = NULL;
+
                        ((struct part_entry *)arg)[i].type = PM_DISK;
-                       for (ii = 0; ii < pm_i->parts->num_part; ii++) {
-                               if (!pm_i->parts->pscheme->get_part_info(
-                                   pm_i->parts, i, &info))
+
+                       for (ii = 0; pm_i->parts != NULL &&
+                           ii < pm_i->parts->num_part; ii++) {
+                               if (!ps->get_part_info(
+                                   pm_i->parts, ii, &info))
                                        continue;
-                               if (info.flags & (PTI_SEC_CONTAINER|
-                                   PTI_WHOLE_DISK|PTI_PSCHEME_INTERNAL|
-                                   PTI_RAW_PART))
+                               if (info.flags & PTI_SEC_CONTAINER) {
+                                       if (secondary == NULL &&
+                                           ps->secondary_scheme != NULL)
+                                               secondary = ps->
+                                                   secondary_partitions(
+                                                   pm_i->parts,
+                                                   info.start, false);
+                                       continue;
+                               }
+                               if (info.flags & (PTI_WHOLE_DISK|
+                                   PTI_PSCHEME_INTERNAL|PTI_RAW_PART))
                                        continue;
                                if (info.fs_type == FS_UNUSED)
                                        continue;
@@ -2803,6 +2824,28 @@
                                m->opts[i].opt_name = NULL;
                                m->opts[i].opt_exp_name = NULL;
                                m->opts[i].opt_action = pm_submenu;
+                               ((struct part_entry *)arg)[i].parts =
+                                   pm_i->parts;
+                               ((struct part_entry *)arg)[i].dev_ptr = pm_i;
+                               ((struct part_entry *)arg)[i].id = ii;
+                               ((struct part_entry *)arg)[i].type = PM_PART;
+                       }
+
+                       for (ii = 0; secondary != NULL &&
+                           ii < secondary->num_part; ii++) {
+                               if (!secondary->pscheme->get_part_info(
+                                   secondary, ii, &info))
+                                       continue;
+                               if (info.flags & (PTI_WHOLE_DISK|
+                                   PTI_PSCHEME_INTERNAL|PTI_RAW_PART))
+                                       continue;
+                               if (info.fs_type == FS_UNUSED)
+                                       continue;
+                               i++;
+                               m->opts[i].opt_name = NULL;
+                               m->opts[i].opt_exp_name = NULL;
+                               m->opts[i].opt_action = pm_submenu;
+                               ((struct part_entry *)arg)[i].parts = secondary;
                                ((struct part_entry *)arg)[i].dev_ptr = pm_i;
                                ((struct part_entry *)arg)[i].id = ii;
                                ((struct part_entry *)arg)[i].type = PM_PART;



Home | Main Index | Thread Index | Old Index