Source-Changes-HG archive

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

[src/trunk]: src/sys/arch avoid hardcoding MBR_MAGICOFF and MBR_MAGIC.



details:   https://anonhg.NetBSD.org/src/rev/84c99695dc9d
branches:  trunk
changeset: 532921:84c99695dc9d
user:      itojun <itojun%NetBSD.org@localhost>
date:      Tue Jun 18 00:37:25 2002 +0000

description:
avoid hardcoding MBR_MAGICOFF and MBR_MAGIC.

diffstat:

 sys/arch/macppc/stand/ofwboot/Makefile |  5 ++++-
 sys/arch/macppc/stand/ofwboot/ofdev.c  |  4 ++--
 sys/arch/ofppc/stand/ofwboot/Makefile  |  5 ++++-
 sys/arch/ofppc/stand/ofwboot/ofdev.c   |  4 ++--
 sys/arch/shark/stand/ofwboot/Makefile  |  5 ++++-
 sys/arch/shark/stand/ofwboot/ofdev.c   |  4 ++--
 6 files changed, 18 insertions(+), 9 deletions(-)

diffs (111 lines):

diff -r fa6edf1faf7c -r 84c99695dc9d sys/arch/macppc/stand/ofwboot/Makefile
--- a/sys/arch/macppc/stand/ofwboot/Makefile    Tue Jun 18 00:37:04 2002 +0000
+++ b/sys/arch/macppc/stand/ofwboot/Makefile    Tue Jun 18 00:37:25 2002 +0000
@@ -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 @@
 .PATH:         ${S}/arch/powerpc/powerpc
 SRCS+=         ofwmagic.S
 
+.PATH:         ${S}/lib/libsa
+SRCS+=         byteorder.c
+
 NOMAN=         # defined
 STRIPFLAG=
 BINMODE=       444
diff -r fa6edf1faf7c -r 84c99695dc9d sys/arch/macppc/stand/ofwboot/ofdev.c
--- a/sys/arch/macppc/stand/ofwboot/ofdev.c     Tue Jun 18 00:37:04 2002 +0000
+++ b/sys/arch/macppc/stand/ofwboot/ofdev.c     Tue Jun 18 00:37:25 2002 +0000
@@ -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 @@
            || 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)
diff -r fa6edf1faf7c -r 84c99695dc9d sys/arch/ofppc/stand/ofwboot/Makefile
--- a/sys/arch/ofppc/stand/ofwboot/Makefile     Tue Jun 18 00:37:04 2002 +0000
+++ b/sys/arch/ofppc/stand/ofwboot/Makefile     Tue Jun 18 00:37:25 2002 +0000
@@ -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 @@
 SRCS+=         ofwmagic.S
 .PATH:         ${S}/arch/powerpc/powerpc
 
+SRCS+=         byteorder.c
+.PATH:         ${S}/lib/libsa
+
 NOMAN=         # defined
 STRIPFLAG=
 BINMODE=       444
diff -r fa6edf1faf7c -r 84c99695dc9d sys/arch/ofppc/stand/ofwboot/ofdev.c
--- a/sys/arch/ofppc/stand/ofwboot/ofdev.c      Tue Jun 18 00:37:04 2002 +0000
+++ b/sys/arch/ofppc/stand/ofwboot/ofdev.c      Tue Jun 18 00:37:25 2002 +0000
@@ -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 @@
            || 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)
diff -r fa6edf1faf7c -r 84c99695dc9d sys/arch/shark/stand/ofwboot/Makefile
--- a/sys/arch/shark/stand/ofwboot/Makefile     Tue Jun 18 00:37:04 2002 +0000
+++ b/sys/arch/shark/stand/ofwboot/Makefile     Tue Jun 18 00:37:25 2002 +0000
@@ -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+=     -D_STANDALONE
 DBG=           -Os
 
+SRCS+=         byteorder.c
+.PATH:         ${S}/lib/libsa
+
 # XXX SHOULD NOT NEED TO DEFINE THESE!
 LIBCRT0=
 LIBCRTBEGIN=
diff -r fa6edf1faf7c -r 84c99695dc9d sys/arch/shark/stand/ofwboot/ofdev.c
--- a/sys/arch/shark/stand/ofwboot/ofdev.c      Tue Jun 18 00:37:04 2002 +0000
+++ b/sys/arch/shark/stand/ofwboot/ofdev.c      Tue Jun 18 00:37:25 2002 +0000
@@ -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 @@
            || 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)



Home | Main Index | Thread Index | Old Index