Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/disklabel add hpcmips support (MBR)
details: https://anonhg.NetBSD.org/src/rev/22610a0d4b5d
branches: trunk
changeset: 477100:22610a0d4b5d
user: shin <shin%NetBSD.org@localhost>
date: Mon Oct 11 05:28:04 1999 +0000
description:
add hpcmips support (MBR)
diffstat:
sbin/disklabel/Makefile | 9 ++++++++-
sbin/disklabel/disklabel.c | 25 +++++++++++++++----------
2 files changed, 23 insertions(+), 11 deletions(-)
diffs (123 lines):
diff -r d87f61e825c4 -r 22610a0d4b5d sbin/disklabel/Makefile
--- a/sbin/disklabel/Makefile Mon Oct 11 05:25:35 1999 +0000
+++ b/sbin/disklabel/Makefile Mon Oct 11 05:28:04 1999 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.33 1999/06/03 01:58:51 cgd Exp $
+# $NetBSD: Makefile,v 1.34 1999/10/11 05:28:04 shin Exp $
# @(#)Makefile 8.2 (Berkeley) 3/17/94
PROG= disklabel
@@ -29,4 +29,11 @@
CPPFLAGS+= -DSAVEBOOTAREA
.endif
+.if (${MACHINE} == "hpcmips")
+# recognize old partition ID for a while
+CPPFLAGS+= -DCOMPAT_386BSD_MBRPART
+# use MBR partition info
+CPPFLAGS+= -DUSE_MBR
+.endif
+
.include <bsd.prog.mk>
diff -r d87f61e825c4 -r 22610a0d4b5d sbin/disklabel/disklabel.c
--- a/sbin/disklabel/disklabel.c Mon Oct 11 05:25:35 1999 +0000
+++ b/sbin/disklabel/disklabel.c Mon Oct 11 05:28:04 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: disklabel.c,v 1.75 1999/09/17 18:30:33 ross Exp $ */
+/* $NetBSD: disklabel.c,v 1.76 1999/10/11 05:28:04 shin Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -47,7 +47,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: disklabel.c,v 1.75 1999/09/17 18:30:33 ross Exp $");
+__RCSID("$NetBSD: disklabel.c,v 1.76 1999/10/11 05:28:04 shin Exp $");
#endif
#endif /* not lint */
@@ -137,7 +137,7 @@
#define OPTIONS "BCNRWb:ef:irs:tw"
#endif
-#ifdef __i386__
+#if defined(__i386__) || defined(USE_MBR)
static struct mbr_partition *dosdp; /* i386 DOS partition, if found */
static int mbrpt_nobsd; /* MBR partition table exists, but no BSD partition */
static struct mbr_partition *readmbr __P((int));
@@ -147,7 +147,7 @@
static u_int get_filecore_partition __P((int));
static int filecore_checksum __P((u_char *));
#endif /* __arm32__ */
-#if defined(__i386__) || (defined(__arm32__) && defined(notyet))
+#if defined(__i386__) || (defined(__arm32__) && defined(notyet)) || defined(USE_MBR)
static void confirm __P((const char *));
#endif
@@ -274,7 +274,7 @@
if (f < 0)
err(4, "%s", specname);
-#ifdef __i386__
+#if defined(__i386__) || defined(USE_MBR)
/*
* Check for presence of DOS partition table in
* master boot record. Return pointer to NetBSD/i386
@@ -433,7 +433,7 @@
(void)strncpy(lp->d_packname, name, sizeof(lp->d_packname));
}
-#if defined(__i386__) || (defined(__arm32__) && defined(notyet))
+#if defined(__i386__) || (defined(__arm32__) && defined(notyet)) || defined(USE_MBR)
static void
confirm(txt)
const char *txt;
@@ -474,7 +474,7 @@
if (rflag)
#endif
{
-#ifdef __i386__
+#if defined(_i386__) || defined(USE_MBR)
struct partition *pp = &lp->d_partitions[2];
/*
@@ -606,7 +606,7 @@
}
}
-#ifdef __i386__
+#if defined(_i386__) || defined(USE_MBR)
/*
* Fetch DOS partition table from disk.
*/
@@ -623,6 +623,11 @@
read(f, mbr, sizeof(mbr)) < sizeof(mbr))
err(4, "can't read master boot record");
+#if !defined(__i386__)
+ /* avoid alignment error */
+ memcpy(mbr, &mbr[MBR_PARTOFF], NMBRPART * sizeof(*dp));
+ dp = (struct mbr_partition *)mbr;
+#endif
/*
* Don't (yet) know disk geometry (BIOS), use
* partition table to find NetBSD/i386 partition, and obtain
@@ -821,7 +826,7 @@
char *msg;
off_t sectoffset = 0;
-#ifdef __i386__
+#if defined(_i386__) || defined(USE_MBR)
if (dosdp)
sectoffset = (off_t)dosdp->mbrp_start * DEV_BSIZE;
#endif
@@ -906,7 +911,7 @@
if (rflag) {
off_t sectoffset = 0;
-#ifdef __i386__
+#if defined(_i386__) || defined(USE_MBR)
if (dosdp)
sectoffset = (off_t)dosdp->mbrp_start * DEV_BSIZE;
#endif
Home |
Main Index |
Thread Index |
Old Index