avoid hardcoding MBR_MAGICOFF and MBR_MAGIC.

This commit is contained in:
itojun 2002-06-18 00:37:25 +00:00
parent 508a11256f
commit 73941c5096
6 changed files with 18 additions and 9 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.33 2002/04/13 13:35:23 tsutsui Exp $
# $NetBSD: Makefile,v 1.34 2002/06/18 00:37:25 itojun Exp $
S= ${.CURDIR}/../../../..
@ -17,6 +17,9 @@ DBG= -Os
.PATH: ${S}/arch/powerpc/powerpc
SRCS+= ofwmagic.S
.PATH: ${S}/lib/libsa
SRCS+= byteorder.c
NOMAN= # defined
STRIPFLAG=
BINMODE= 444

View File

@ -1,4 +1,4 @@
/* $NetBSD: ofdev.c,v 1.10 2002/06/17 23:59:01 itojun Exp $ */
/* $NetBSD: ofdev.c,v 1.11 2002/06/18 00:37:25 itojun Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -215,7 +215,7 @@ search_label(devp, off, buf, lp, off0)
|| read != DEV_BSIZE)
return ERDLAB;
if (buf[510] != 0x55 || buf[511] != 0xaa)
if (*(u_int16_t *)&buf[MBR_MAGICOFF] != sa_htole16(MBR_MAGIC))
return ERDLAB;
if (recursion++ <= 1)

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.11 2001/12/12 01:49:49 tv Exp $
# $NetBSD: Makefile,v 1.12 2002/06/18 00:37:25 itojun Exp $
S= ${.CURDIR}/../../../..
@ -13,6 +13,9 @@ DBG= -Os -mmultiple
SRCS+= ofwmagic.S
.PATH: ${S}/arch/powerpc/powerpc
SRCS+= byteorder.c
.PATH: ${S}/lib/libsa
NOMAN= # defined
STRIPFLAG=
BINMODE= 444

View File

@ -1,4 +1,4 @@
/* $NetBSD: ofdev.c,v 1.6 2001/10/23 03:31:26 thorpej Exp $ */
/* $NetBSD: ofdev.c,v 1.7 2002/06/18 00:37:25 itojun Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -209,7 +209,7 @@ search_label(devp, off, buf, lp, off0)
|| read != DEV_BSIZE)
return ERDLAB;
if (buf[510] != 0x55 || buf[511] != 0xaa)
if (*(u_int16_t *)&buf[MBR_MAGICOFF] != sa_htole16(MBR_MAGIC))
return ERDLAB;
if (recursion++ <= 1)

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.2 2002/02/10 18:28:13 wiz Exp $
# $NetBSD: Makefile,v 1.3 2002/06/18 00:37:26 itojun Exp $
S= ${.CURDIR}/../../../..
@ -10,6 +10,9 @@ CPPFLAGS+= -DSUPPORT_DHCP -I${.CURDIR}
CPPFLAGS+= -D_STANDALONE
DBG= -Os
SRCS+= byteorder.c
.PATH: ${S}/lib/libsa
# XXX SHOULD NOT NEED TO DEFINE THESE!
LIBCRT0=
LIBCRTBEGIN=

View File

@ -1,4 +1,4 @@
/* $NetBSD: ofdev.c,v 1.1 2002/02/10 01:58:18 thorpej Exp $ */
/* $NetBSD: ofdev.c,v 1.2 2002/06/18 00:37:26 itojun Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -209,7 +209,7 @@ search_label(devp, off, buf, lp, off0)
|| read != DEV_BSIZE)
return ERDLAB;
if (buf[510] != 0x55 || buf[511] != 0xaa)
if (*(u_int16_t *)&buf[MBR_MAGICOFF] != sa_htole16(MBR_MAGIC))
return ERDLAB;
if (recursion++ <= 1)