Module Name:    src
Committed By:   snj
Date:           Wed Dec 14 15:36:52 UTC 2022

Modified Files:
        src/usr.sbin/sysinst [netbsd-9]: bsddisklabel.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #1553):

        usr.sbin/sysinst/bsddisklabel.c: revision 1.67

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


To generate a diff of this commit:
cvs rdiff -u -r1.23.2.11 -r1.23.2.12 src/usr.sbin/sysinst/bsddisklabel.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/sysinst/bsddisklabel.c
diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.23.2.11 src/usr.sbin/sysinst/bsddisklabel.c:1.23.2.12
--- src/usr.sbin/sysinst/bsddisklabel.c:1.23.2.11	Thu Oct 15 19:36:50 2020
+++ src/usr.sbin/sysinst/bsddisklabel.c	Wed Dec 14 15:36:52 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bsddisklabel.c,v 1.23.2.11 2020/10/15 19:36:50 bouyer Exp $	*/
+/*	$NetBSD: bsddisklabel.c,v 1.23.2.12 2022/12/14 15:36:52 snj Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -653,18 +653,23 @@ set_ptn_size(menudesc *m, void *arg)
 				}
 			}
 			/* 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 @@ set_ptn_size(menudesc *m, void *arg)
 	}
 	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;
@@ -1205,6 +1209,7 @@ fill_defaults(struct partition_usage_set
 			    wanted->infos[root].limit;
 		}
 	}
+	wanted->infos[root].def_size = wanted->infos[root].size;
 }
 
 /*

Reply via email to