Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst Avoid architecture specific ifdefs in main ...



details:   https://anonhg.NetBSD.org/src/rev/33318660d056
branches:  trunk
changeset: 999852:33318660d056
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Jun 20 18:32:32 2019 +0000

description:
Avoid architecture specific ifdefs in main code, move to MD macros.

diffstat:

 usr.sbin/sysinst/arch/dummy/md.h   |   8 +++++++-
 usr.sbin/sysinst/arch/sparc/md.h   |   6 +++++-
 usr.sbin/sysinst/arch/sparc64/md.h |   6 +++++-
 usr.sbin/sysinst/disklabel.c       |  12 +++++++-----
 4 files changed, 24 insertions(+), 8 deletions(-)

diffs (92 lines):

diff -r 4b6256f734ad -r 33318660d056 usr.sbin/sysinst/arch/dummy/md.h
--- a/usr.sbin/sysinst/arch/dummy/md.h  Thu Jun 20 17:33:30 2019 +0000
+++ b/usr.sbin/sysinst/arch/dummy/md.h  Thu Jun 20 18:32:32 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.h,v 1.1 2014/07/26 19:56:30 dholland Exp $  */
+/*     $NetBSD: md.h,v 1.2 2019/06/20 18:32:33 martin Exp $    */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -33,3 +33,9 @@
  */
 
 #define XNEEDMB                100
+
+#ifdef __sun__
+/* sunlabels force track alignment (true = no further processing) */
+#define        MD_DISKLABEL_SET_ALIGN_PRE(align, track)        \
+       (align) = (track), true
+#endif
diff -r 4b6256f734ad -r 33318660d056 usr.sbin/sysinst/arch/sparc/md.h
--- a/usr.sbin/sysinst/arch/sparc/md.h  Thu Jun 20 17:33:30 2019 +0000
+++ b/usr.sbin/sysinst/arch/sparc/md.h  Thu Jun 20 18:32:32 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.h,v 1.3 2018/11/16 19:54:05 martin Exp $    */
+/*     $NetBSD: md.h,v 1.4 2019/06/20 18:32:33 martin Exp $    */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -56,6 +56,10 @@
 /* have support for booting from UFS2 */
 #define        HAVE_UFS2_BOOT
 
+/* sunlabels force track alignment (true = no further processing) */
+#define        MD_DISKLABEL_SET_ALIGN_PRE(align, track)        \
+       (align) = (track), true
+
 /*
  * Default filesets to fetch and install during installation
  * or upgrade.
diff -r 4b6256f734ad -r 33318660d056 usr.sbin/sysinst/arch/sparc64/md.h
--- a/usr.sbin/sysinst/arch/sparc64/md.h        Thu Jun 20 17:33:30 2019 +0000
+++ b/usr.sbin/sysinst/arch/sparc64/md.h        Thu Jun 20 18:32:32 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.h,v 1.4 2019/06/13 06:25:03 martin Exp $    */
+/*     $NetBSD: md.h,v 1.5 2019/06/20 18:32:33 martin Exp $    */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -54,6 +54,10 @@
 #define XNEEDMB                300     /* Extra megs for full X installation */
 #define DEBNEEDMB      1200    /* Extra megs for debug sets */
 
+/* sunlabels force track alignment (true = no further processing) */
+#define        MD_DISKLABEL_SET_ALIGN_PRE(align, track)        \
+       (align) = (track), true
+
 /* use UFS2 by default for ffs */
 #define        DEFAULT_UFS2
 
diff -r 4b6256f734ad -r 33318660d056 usr.sbin/sysinst/disklabel.c
--- a/usr.sbin/sysinst/disklabel.c      Thu Jun 20 17:33:30 2019 +0000
+++ b/usr.sbin/sysinst/disklabel.c      Thu Jun 20 18:32:32 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disklabel.c,v 1.3 2019/06/20 16:57:25 martin Exp $     */
+/*     $NetBSD: disklabel.c,v 1.4 2019/06/20 18:32:32 martin Exp $     */
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -75,10 +75,10 @@
        if (dl_maxpart == 0)
                dl_maxpart = getmaxpartitions();
 
-#if defined(__sun__) || defined(__sparc__)
-       /* sun labels are always cylinder aligned */
-       parts->ptn_alignment = track;
-#else
+#ifdef MD_DISKLABEL_SET_ALIGN_PRE
+       if (MD_DISKLABEL_SET_ALIGN_PRE(parts->ptn_alignment, track))
+               return;
+#endif
        /* Use 1MB alignemnt for large (>128GB) disks */
        if (parts->dp.disk_size > HUGE_DISK_SIZE) {
                parts->ptn_alignment = 2048;
@@ -87,6 +87,8 @@
        } else {
                parts->ptn_alignment = 1;
        }
+#ifdef MD_DISKLABEL_SET_ALIGN_POST
+       MD_DISKLABEL_SET_ALIGN_POST(parts->ptn_alignment, track);
 #endif
 }
 



Home | Main Index | Thread Index | Old Index