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 creating an install description from e...



details:   https://anonhg.NetBSD.org/src/rev/57916c7272f2
branches:  trunk
changeset: 452098:57916c7272f2
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Jun 18 10:46:51 2019 +0000

description:
When creating an install description from existing partitions, use
the inner partitioning scheme (e.g.: disklabel) instead of the
outer (e.g. MBR).

diffstat:

 usr.sbin/sysinst/util.c |  32 +++++++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 deletions(-)

diffs (48 lines):

diff -r 0521ebb4a10a -r 57916c7272f2 usr.sbin/sysinst/util.c
--- a/usr.sbin/sysinst/util.c   Tue Jun 18 10:45:27 2019 +0000
+++ b/usr.sbin/sysinst/util.c   Tue Jun 18 10:46:51 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: util.c,v 1.22 2019/06/12 06:20:18 martin Exp $ */
+/*     $NetBSD: util.c,v 1.23 2019/06/18 10:46:51 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -2032,8 +2032,38 @@
 install_desc_from_parts(struct install_partition_desc *install,
     struct disk_partitions *parts)
 {
+       struct disk_partitions *inner_parts;
+       daddr_t start, size;
+       part_id pno;
+       struct disk_part_info info;
+
        memset(install, 0, sizeof(*install));
 
+       if (parts->pscheme->secondary_scheme != NULL) {
+               start = -1;
+               size = -1;
+               if (parts->pscheme->guess_install_target != NULL &&
+                   parts->pscheme->guess_install_target(parts,
+                       &start, &size)) {
+               } else {
+                       for (pno = 0; pno < parts->num_part; pno++) {
+                               if (!parts->pscheme->get_part_info(parts, pno,
+                                   &info))
+                                       continue;
+                               if (!(info.flags & PTI_SEC_CONTAINER))
+                                       continue;
+                               start = info.start;
+                               size = info.size;
+                       }
+               }
+               if (size > 0) {
+                       inner_parts = parts->pscheme->secondary_partitions(
+                           parts, start, false);
+                       if (inner_parts != NULL)
+                               parts = inner_parts;
+               }
+       }
+
        return usage_info_list_from_parts(&install->infos, &install->num,
            parts);
 }



Home | Main Index | Thread Index | Old Index