Source-Changes-HG archive

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

[src/trunk]: src/sbin/disklabel Don't use #ifdef __${MACHINE_ARCH}__ to enabl...



details:   https://anonhg.NetBSD.org/src/rev/c88e10b20bd6
branches:  trunk
changeset: 749385:c88e10b20bd6
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Nov 28 12:14:53 2009 +0000

description:
Don't use #ifdef __${MACHINE_ARCH}__ to enable machine dependent features.
Instead, use proper macro defined in Makefile per ${MACHINE_ARCH}.

__${MACHINE_ARCH}__ doesn't represent an architecture of tool's target
but an architecture of binaries being compiled, so required features
are not prolery enabled or unintentionally enabled on certain host
and target combinations during src/tools build.

diffstat:

 sbin/disklabel/Makefile |  12 +++++++++++-
 sbin/disklabel/main.c   |  14 +++++++-------
 2 files changed, 18 insertions(+), 8 deletions(-)

diffs (82 lines):

diff -r 889d55b75595 -r c88e10b20bd6 sbin/disklabel/Makefile
--- a/sbin/disklabel/Makefile   Sat Nov 28 12:13:04 2009 +0000
+++ b/sbin/disklabel/Makefile   Sat Nov 28 12:14:53 2009 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.63 2009/11/28 11:26:36 tsutsui Exp $
+#      $NetBSD: Makefile,v 1.64 2009/11/28 12:14:53 tsutsui Exp $
 #      @(#)Makefile    8.2 (Berkeley) 3/17/94
 
 PROG=  disklabel
@@ -50,4 +50,14 @@
 CPPFLAGS+= -DUSE_ACORN
 .endif
 
+.if (${MACHINE_ARCH} == "alpha")
+# alpha requires boot block checksum
+CPPFLAGS+= -DALPHA_BOOTBLOCK_CKSUM
+.endif
+
+.if (${MACHINE_ARCH} == "vax")
+# vax requires labels in alternative sectors on SMD disk
+CPPFLAGS+= -DVAX_ALTLABELS
+.endif
+
 .include <bsd.prog.mk>
diff -r 889d55b75595 -r c88e10b20bd6 sbin/disklabel/main.c
--- a/sbin/disklabel/main.c     Sat Nov 28 12:13:04 2009 +0000
+++ b/sbin/disklabel/main.c     Sat Nov 28 12:14:53 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.20 2009/05/04 18:09:04 mhitch Exp $ */
+/*     $NetBSD: main.c,v 1.21 2009/11/28 12:14:53 tsutsui Exp $        */
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@
 static char sccsid[] = "@(#)disklabel.c        8.4 (Berkeley) 5/4/95";
 /* from static char sccsid[] = "@(#)disklabel.c        1.2 (Symmetric) 11/28/85"; */
 #else
-__RCSID("$NetBSD: main.c,v 1.20 2009/05/04 18:09:04 mhitch Exp $");
+__RCSID("$NetBSD: main.c,v 1.21 2009/11/28 12:14:53 tsutsui Exp $");
 #endif
 #endif /* not lint */
 
@@ -535,7 +535,7 @@
                }
        }
 
-#ifdef __vax__
+#ifdef VAX_ALTLABELS
        if (lab.d_type == DTYPE_SMD && lab.d_flags & D_BADSECT &&
            lab.d_secsize == 512) {
                /* Write the label to the odd sectors of the last track! */
@@ -554,7 +554,7 @@
                                warn("alternate label %d write", i/2);
                }
        }
-#endif /* __vax__ */
+#endif /* VAX_ALTLABELS */
 
        return 0;
 }
@@ -978,10 +978,10 @@
        if (bootarea_len <= 0)
                errx(1, "attempting to write after failed read");
 
-#ifdef __alpha__
+#ifdef ALPHA_BOOTBLOCK_CKSUM
        /*
         * The Alpha requires that the boot block be checksummed.
-        * The NetBSD/alpha disklabel.h provides a macro to do it.
+        * <sys/bootblock.h> provides a macro to do it.
         */
        if (sector == 0) {
                struct alpha_boot_block *bb;
@@ -990,7 +990,7 @@
                bb->bb_cksum = 0;
                ALPHA_BOOT_BLOCK_CKSUM(bb, &bb->bb_cksum);
        }
-#endif /* __alpha__ */
+#endif /* ALPHA_BOOTBLOCK_CKSUM */
 
        wlen = pwrite(f, bootarea, bootarea_len, sector * (off_t)DEV_BSIZE);
        if (wlen == bootarea_len)



Home | Main Index | Thread Index | Old Index