Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst Use an install target hint to mark a new pa...



details:   https://anonhg.NetBSD.org/src/rev/d5f0b4b81fb1
branches:  trunk
changeset: 976982:d5f0b4b81fb1
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Oct 10 18:49:27 2020 +0000

description:
Use an install target hint to mark a new partition active.
When compiled with BOOTSEL support, also name the new partition "NetBSD".

diffstat:

 usr.sbin/sysinst/mbr.c |  21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diffs (77 lines):

diff -r fcbc64b40f46 -r d5f0b4b81fb1 usr.sbin/sysinst/mbr.c
--- a/usr.sbin/sysinst/mbr.c    Sat Oct 10 18:48:32 2020 +0000
+++ b/usr.sbin/sysinst/mbr.c    Sat Oct 10 18:49:27 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mbr.c,v 1.34 2020/10/03 18:54:18 martin Exp $ */
+/*     $NetBSD: mbr.c,v 1.35 2020/10/10 18:49:27 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1579,7 +1579,8 @@
 
 static bool
 mbr_info_to_partitition(const struct disk_part_info *info,
-   struct mbr_partition *mp, uint sector, const char **err_msg)
+   struct mbr_partition *mp, uint sector,
+   struct mbr_info_t *mb, size_t index, const char **err_msg)
 {
        size_t pt = mbr_type_from_gen_desc(info->nat_type);
        if (info->start + info->size > UINT_MAX
@@ -1591,6 +1592,12 @@
        mp->mbrp_start = info->start - sector;
        mp->mbrp_size = info->size;
        mp->mbrp_type = pt;
+       if (info->flags & PTI_INSTALL_TARGET) {
+               mp->mbrp_flag |= MBR_PFLAG_ACTIVE;
+#ifdef BOOTSEL
+               strcpy(mb->mbrb.mbrbs_nametab[index], "NetBSD");
+#endif
+       }
 
        return true;
 }
@@ -1771,7 +1778,7 @@
                data.size = size;
        uint old_start = m->mbr.mbr_parts[i].mbrp_start;
        if (!mbr_info_to_partitition(&data,
-          &m->mbr.mbr_parts[i], m->sector, err_msg))
+          &m->mbr.mbr_parts[i], m->sector, m, i, err_msg))
                return false;
        if (data.flags & PTI_INSTALL_TARGET)
                parts->target = start;
@@ -2262,7 +2269,7 @@
                        /* empty slot, we can just use it */
                        newp = &m->mbr.mbr_parts[0];
                        mbr_info_to_partitition(&data, &m->mbr.mbr_parts[0],
-                           m->sector, errmsg);
+                           m->sector, m, 0, errmsg);
                        if (data.last_mounted && m->last_mounted[0] &&
                            data.last_mounted != m->last_mounted[0]) {
                                free(__UNCONST(m->last_mounted[0]));
@@ -2316,7 +2323,7 @@
                                newp = &new_mbr->mbr.mbr_parts[0];
                                mbr_info_to_partitition(&data,
                                    &new_mbr->mbr.mbr_parts[0],
-                                   new_mbr->sector, errmsg);
+                                   new_mbr->sector, new_mbr, 0, errmsg);
                                if (data.last_mounted && m->last_mounted[0] &&
                                    data.last_mounted != m->last_mounted[0]) {
                                        free(__UNCONST(m->last_mounted[0]));
@@ -2335,7 +2342,7 @@
                                newp = &new_mbr->mbr.mbr_parts[0];
                                mbr_info_to_partitition(&data,
                                    &new_mbr->mbr.mbr_parts[0],
-                                   new_mbr->sector, errmsg);
+                                   new_mbr->sector, new_mbr, 0, errmsg);
                                if (data.last_mounted && m->last_mounted[0] &&
                                    data.last_mounted != m->last_mounted[0]) {
                                        free(__UNCONST(m->last_mounted[0]));
@@ -2399,7 +2406,7 @@
        if (data.start + data.size > start + size)
                data.size = start + size - data.start;
        mbr_info_to_partitition(&data, &m->mbr.mbr_parts[free_primary],
-            m->sector, errmsg);
+            m->sector, m, free_primary, errmsg);
        if (data.last_mounted && m->last_mounted[free_primary] &&
            data.last_mounted != m->last_mounted[free_primary]) {
                free(__UNCONST(m->last_mounted[free_primary]));



Home | Main Index | Thread Index | Old Index