Source-Changes-HG archive

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

[src/netbsd-3]: src/distrib/utils/sysinst Pull up following revision(s) (requ...



details:   https://anonhg.NetBSD.org/src/rev/ae8f48fbb6e1
branches:  netbsd-3
changeset: 577522:ae8f48fbb6e1
user:      tron <tron%NetBSD.org@localhost>
date:      Mon Nov 21 20:42:02 2005 +0000

description:
Pull up following revision(s) (requested by dsl in ticket #976):
        distrib/utils/sysinst/mbr.c: revision 1.71
Rework the checking of the typed size against the limit so we don't error
if the size is too large after we've rounded up to a cylinder boundary.
Stops silly errors (4170 > 4172) when partitions end at the end of the disk.

diffstat:

 distrib/utils/sysinst/mbr.c |  43 ++++++++++++++++++++++++-------------------
 1 files changed, 24 insertions(+), 19 deletions(-)

diffs (67 lines):

diff -r b28cb896220f -r ae8f48fbb6e1 distrib/utils/sysinst/mbr.c
--- a/distrib/utils/sysinst/mbr.c       Mon Nov 21 20:40:27 2005 +0000
+++ b/distrib/utils/sysinst/mbr.c       Mon Nov 21 20:42:02 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mbr.c,v 1.68.2.2 2005/09/30 22:44:54 tron Exp $ */
+/*     $NetBSD: mbr.c,v 1.68.2.3 2005/11/21 20:42:02 tron Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -701,6 +701,7 @@
        }
 
        start = mbri->sector + mbrp->mbrp_start;
+       /* We need to keep both the unrounded and rounded (_r) max and dflt */
        dflt_r = (start + dflt) / sizemult - start / sizemult;
        if (max == dflt)
                max_r = dflt_r;
@@ -716,27 +717,31 @@
                        errmsg = MSG_Invalid_numeric;
                        continue;
                }
-               if (new == 0 || new == max_r)
-                       new = max;
-               else {
-                       if (new == dflt_r)
-                               new = dflt;
-                       else {
-                               /* Round end to cylinder boundary */
-                               if (sizemult != 1) {
-                                       new *= sizemult;
-                                       new += ROUNDDOWN(start,current_cylsize);
-                                       new = ROUNDUP(new, current_cylsize);
-                                       new -= start;
-                                       while (new <= 0)
-                                               new += current_cylsize;
-                               }
-                       }
-               }
-               if (new > max) {
+               if (new > max_r) {
                        errmsg = MSG_Too_large;
                        continue;
                }
+               if (new == 0)
+                       /* Treat zero as a request for the maximum */
+                       new = max_r;
+               if (new == dflt_r)
+                       /* If unchanged, don't re-round size */
+                       new = dflt;
+               else {
+                       /* Round end to cylinder boundary */
+                       if (sizemult != 1) {
+                               new *= sizemult;
+                               new += ROUNDDOWN(start,current_cylsize);
+                               new = ROUNDUP(new, current_cylsize);
+                               new -= start;
+                               while (new <= 0)
+                                       new += current_cylsize;
+                       }
+               }
+               if (new > max)
+                       /* We rounded the value to above the max */
+                       new = max;
+
                if (new == dflt || opt >= MBR_PART_COUNT
                    || !MBR_IS_EXTENDED(mbrp->mbrp_type))
                        break;



Home | Main Index | Thread Index | Old Index