Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/disklabel On NetBSD/alpha, go out of the way to read th...
details: https://anonhg.NetBSD.org/src/rev/4f9ce00c52e6
branches: trunk
changeset: 473428:4f9ce00c52e6
user: cgd <cgd%NetBSD.org@localhost>
date: Thu Jun 03 01:58:51 1999 +0000
description:
On NetBSD/alpha, go out of the way to read the boot area's contents if -r
is specified, so that the boot blocks aren't clobbered when writing labels.
diffstat:
sbin/disklabel/Makefile | 8 +++++++-
sbin/disklabel/disklabel.c | 18 ++++++++++++++++--
2 files changed, 23 insertions(+), 3 deletions(-)
diffs (59 lines):
diff -r d528572cbdf6 -r 4f9ce00c52e6 sbin/disklabel/Makefile
--- a/sbin/disklabel/Makefile Thu Jun 03 01:49:58 1999 +0000
+++ b/sbin/disklabel/Makefile Thu Jun 03 01:58:51 1999 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.32 1999/04/09 16:00:17 kleink Exp $
+# $NetBSD: Makefile,v 1.33 1999/06/03 01:58:51 cgd Exp $
# @(#)Makefile 8.2 (Berkeley) 3/17/94
PROG= disklabel
@@ -23,4 +23,10 @@
CPPFLAGS+= -DSTRICT_CYLINDER_ALIGNMENT
.endif
+.if (${MACHINE} == "alpha")
+# read in the old boot area even though we don't support writing the boot
+# area with disklabel(8).
+CPPFLAGS+= -DSAVEBOOTAREA
+.endif
+
.include <bsd.prog.mk>
diff -r d528572cbdf6 -r 4f9ce00c52e6 sbin/disklabel/disklabel.c
--- a/sbin/disklabel/disklabel.c Thu Jun 03 01:49:58 1999 +0000
+++ b/sbin/disklabel/disklabel.c Thu Jun 03 01:58:51 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: disklabel.c,v 1.69 1999/05/03 09:45:01 christos Exp $ */
+/* $NetBSD: disklabel.c,v 1.70 1999/06/03 01:58:51 cgd 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.69 1999/05/03 09:45:01 christos Exp $");
+__RCSID("$NetBSD: disklabel.c,v 1.70 1999/06/03 01:58:51 cgd Exp $");
#endif
#endif /* not lint */
@@ -881,6 +881,20 @@
lp = (struct disklabel *)
(boot + (LABELSECTOR * dp->d_secsize) + LABELOFFSET);
(void) memset(lp, 0, sizeof *lp);
+#ifdef SAVEBOOTAREA
+ /*
+ * We must read the current bootarea so we don't clobber the
+ * existing boot block, if any.
+ */
+ if (rflag) {
+ off_t sectoffset = 0;
+
+ if (lseek(f, sectoffset, SEEK_SET) < 0 ||
+ read(f, boot, BBSIZE) < BBSIZE)
+ err(4, "%s", specname);
+ (void) memset(lp, 0, sizeof *lp);
+ }
+#endif
#if NUMBOOT > 0
/*
* If we are not installing a boot program but we are installing a
Home |
Main Index |
Thread Index |
Old Index