Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/newfs Explicitly zap possible Ext2fs magic leftover to ...
details: https://anonhg.NetBSD.org/src/rev/574a5083264f
branches: trunk
changeset: 773577:574a5083264f
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Tue Feb 07 14:14:45 2012 +0000
description:
Explicitly zap possible Ext2fs magic leftover to prevent
kernel vfs_mountroot() and bootloaders from mis-recognizing
the newfs(8)'ed file system as still Ext2fs.
The problem is reported and the fix is tested by Frank Wille
on current-users@. Also approved by releng.
diffstat:
sbin/newfs/mkfs.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diffs (40 lines):
diff -r ef60ffcdfa83 -r 574a5083264f sbin/newfs/mkfs.c
--- a/sbin/newfs/mkfs.c Tue Feb 07 11:40:24 2012 +0000
+++ b/sbin/newfs/mkfs.c Tue Feb 07 14:14:45 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkfs.c,v 1.110 2011/08/25 16:17:58 joerg Exp $ */
+/* $NetBSD: mkfs.c,v 1.111 2012/02/07 14:14:45 tsutsui Exp $ */
/*
* Copyright (c) 1980, 1989, 1993
@@ -73,7 +73,7 @@
#if 0
static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95";
#else
-__RCSID("$NetBSD: mkfs.c,v 1.110 2011/08/25 16:17:58 joerg Exp $");
+__RCSID("$NetBSD: mkfs.c,v 1.111 2012/02/07 14:14:45 tsutsui Exp $");
#endif
#endif /* not lint */
@@ -152,6 +152,8 @@
((sblock.fs_magic == FS_UFS1_MAGIC) ? \
(dp)->dp1.di_##field : (dp)->dp2.di_##field)
+#define EXT2FS_SBOFF 1024 /* XXX: SBOFF in <ufs/ext2fs/ext2fs.h> */
+
char *iobuf;
int iobufsize; /* size to end of 2nd inode block */
int iobuf_memsize; /* Actual buffer size */
@@ -615,6 +617,12 @@
for (sz = SBLOCKSIZE; sz <= 0x10000; sz <<= 1)
zap_old_sblock(roundup(sblkoff, sz));
}
+ /*
+ * Also zap possible Ext2fs magic leftover to prevent
+ * kernel vfs_mountroot() and bootloaders from mis-recognizing
+ * this file system as Ext2fs.
+ */
+ zap_old_sblock(EXT2FS_SBOFF);
if (isappleufs) {
struct appleufslabel appleufs;
Home |
Main Index |
Thread Index |
Old Index