Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst A little less (confusing) magic: adjust the...



details:   https://anonhg.NetBSD.org/src/rev/f735746870dc
branches:  trunk
changeset: 372572:f735746870dc
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Dec 09 16:54:31 2022 +0000

description:
A little less (confusing) magic: adjust the size of / when adding /usr
only if / has not beenn manually resized.

diffstat:

 usr.sbin/sysinst/bsddisklabel.c |  29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)

diffs (59 lines):

diff -r 30ecfd3cba6c -r f735746870dc usr.sbin/sysinst/bsddisklabel.c
--- a/usr.sbin/sysinst/bsddisklabel.c   Fri Dec 09 10:33:18 2022 +0000
+++ b/usr.sbin/sysinst/bsddisklabel.c   Fri Dec 09 16:54:31 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bsddisklabel.c,v 1.66 2022/11/30 15:57:54 martin Exp $ */
+/*     $NetBSD: bsddisklabel.c,v 1.67 2022/12/09 16:54:31 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -653,18 +653,23 @@
                                }
                        }
                        /* Remove space for /usr from / */
-                       if (root < pset->num && pset->infos[i].cur_part_id ==
-                           NO_PART) {
-                               pset->infos[root].size -= p->def_size;
+                       if (root < pset->num &&
+                            pset->infos[root].cur_part_id == NO_PART &&
+                            pset->infos[root].size ==
+                                       pset->infos[root].def_size) {
+                               /*
+                                * root partition does not yet exist and
+                                * has default size
+                                */
+                               pset->infos[root].size -= p->def_size;
                                pset->cur_free_space += p->def_size;
                        }
-                       /* hack to add free space to default sized /usr */
-                       if (strcmp(answer, dflt) == 0) {
-                               size = p->def_size;
-                               pset->infos[root].flags &= ~PUIFLAG_EXTEND;
-                               p->flags |= PUIFLAG_EXTEND;
-                               goto adjust_free;
-                       }
+                       /*
+                        * hack to add free space to /usr if
+                        * previously / got it
+                        */
+                       if (pset->infos[root].flags & PUIFLAG_EXTEND)
+                               extend = true;
                }
                if (new_size_val < 0)
                        continue;
@@ -687,7 +692,6 @@
        }
        if (p->limit != 0 && size > p->limit)
                size = p->limit;
-    adjust_free:
        if ((p->flags & (PUIFLG_IS_OUTER|PUIFLG_JUST_MOUNTPOINT)) == 0)
                pset->cur_free_space += p->size - size;
        p->size = is_percent ? -size : size;
@@ -1206,6 +1210,7 @@
                            wanted->infos[root].limit;
                }
        }
+       wanted->infos[root].def_size = wanted->infos[root].size;
 }
 
 /*



Home | Main Index | Thread Index | Old Index