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 changing the user geometry, do not alt...



details:   https://anonhg.NetBSD.org/src/rev/f351fbd7b7af
branches:  trunk
changeset: 461967:f351fbd7b7af
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Jul 21 11:56:20 2019 +0000

description:
When changing the user geometry, do not alter the disklabel internal
geometry information. On drives only capable of doing CHS addressing,
we rely on this data.

diffstat:

 usr.sbin/sysinst/disklabel.c |  20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diffs (46 lines):

diff -r 4f3ae6692561 -r f351fbd7b7af usr.sbin/sysinst/disklabel.c
--- a/usr.sbin/sysinst/disklabel.c      Sun Jul 21 11:52:14 2019 +0000
+++ b/usr.sbin/sysinst/disklabel.c      Sun Jul 21 11:56:20 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disklabel.c,v 1.8 2019/07/21 11:36:34 martin Exp $     */
+/*     $NetBSD: disklabel.c,v 1.9 2019/07/21 11:56:20 martin Exp $     */
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -99,18 +99,18 @@
        struct disklabel_disk_partitions *parts =
            (struct disklabel_disk_partitions*)arg;
 
-       disklabel_init_default_alignment(parts, nhead * nsec);
+       assert(parts->l.d_secsize != 0);
+       assert(parts->l.d_nsectors != 0);
+       assert(parts->l.d_ntracks != 0);
+       assert(parts->l.d_ncylinders != 0);
+       assert(parts->l.d_secpercyl != 0);
 
-       parts->l.d_ncylinders = ncyl;
-       parts->l.d_ntracks = nhead;
-       parts->l.d_nsectors = nsec;
-       parts->l.d_secsize = DEV_BSIZE;
-       parts->l.d_secpercyl = nsec * nhead;
-
+       disklabel_init_default_alignment(parts, nhead * nsec);
        if (ncyl*nhead*nsec <= TINY_DISK_SIZE)
                set_default_sizemult(1);
        else
                set_default_sizemult(MEG/512);
+
        return true;
 }
 
@@ -273,6 +273,10 @@
        size_t n;
 
        assert(parts->l.d_secsize != 0);
+       assert(parts->l.d_nsectors != 0);
+       assert(parts->l.d_ntracks != 0);
+       assert(parts->l.d_ncylinders != 0);
+       assert(parts->l.d_secpercyl != 0);
 
        sprintf(fname, "/tmp/disklabel.%u", getpid());
        f = fopen(fname, "w");



Home | Main Index | Thread Index | Old Index