Module Name: src Committed By: tsutsui Date: Sat Nov 28 12:14:53 UTC 2009
Modified Files: src/sbin/disklabel: Makefile main.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.63 -r1.64 src/sbin/disklabel/Makefile cvs rdiff -u -r1.20 -r1.21 src/sbin/disklabel/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sbin/disklabel/Makefile diff -u src/sbin/disklabel/Makefile:1.63 src/sbin/disklabel/Makefile:1.64 --- src/sbin/disklabel/Makefile:1.63 Sat Nov 28 11:26:36 2009 +++ src/sbin/disklabel/Makefile Sat Nov 28 12:14:53 2009 @@ -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> Index: src/sbin/disklabel/main.c diff -u src/sbin/disklabel/main.c:1.20 src/sbin/disklabel/main.c:1.21 --- src/sbin/disklabel/main.c:1.20 Mon May 4 18:09:04 2009 +++ src/sbin/disklabel/main.c Sat Nov 28 12:14:53 2009 @@ -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)