From owner-freebsd-current@FreeBSD.ORG Thu May 8 03:45:39 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EEF9437B401; Thu, 8 May 2003 03:45:39 -0700 (PDT) Received: from mailbox.univie.ac.at (mail.univie.ac.at [131.130.1.27]) by mx1.FreeBSD.org (Postfix) with ESMTP id 412C243FA3; Thu, 8 May 2003 03:45:38 -0700 (PDT) (envelope-from l.ertl@univie.ac.at) Received: from pcle2.cc.univie.ac.at (pcle2.cc.univie.ac.at [131.130.2.177]) by mailbox.univie.ac.at (8.12.2/8.12.2) with ESMTP id h48AjKTu079514; Thu, 8 May 2003 12:45:27 +0200 Date: Thu, 8 May 2003 12:45:20 +0200 (CEST) From: Lukas Ertl To: Kirk McKusick In-Reply-To: <200305072229.h47MTDTh024656@beastie.mckusick.com> Message-ID: <20030508124346.A42559@pcle2.cc.univie.ac.at> References: <200305072229.h47MTDTh024656@beastie.mckusick.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE X-DCC-ZID-Univie-Metrics: mailbox 4251; Body=3 Fuz1=3 Fuz2=3 cc: DougB@freebsd.org cc: freebsd-current@freebsd.org Subject: Re: bin/51619 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 May 2003 10:45:40 -0000 On Wed, 7 May 2003, Kirk McKusick wrote: > At one time I had the suggested change that you made in bin/51619 > in the FreeBSD-5.0 newfs program. The problem with that change is > that the bootstrap on some architectures now exceeds 8K which means > that instead of zeroing an old superblock you destroy the boot code. > So, I removed the zeroing of the old UFS1 superblock area. A possible > alternative would be to check for a UFS1 magic number at the old > location (and also at the 16K first backup location) and zero out > just those fields if they are found. While it is possible that a > bootstrap might just have that number at that offset, it is highly > unlikely. Hi Kirk, thanks for clarifying this. Would this patch here be better suited? ---8<--- Index: sbin/newfs/mkfs.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /u/cvs/cvs/src/sbin/newfs/mkfs.c,v retrieving revision 1.75 diff -u -r1.75 mkfs.c --- sbin/newfs/mkfs.c=093 May 2003 18:41:58 -0000=091.75 +++ sbin/newfs/mkfs.c=098 May 2003 10:42:15 -0000 @@ -113,6 +113,12 @@ =09quad_t sizepb; =09int width; =09char tmpbuf[100];=09/* XXX this will break in about 2,500 years */ +=09union { +=09=09struct fs fdummy; +=09=09char cdummy[SBLOCKSIZE]; +=09} dummy; +#define fsdummy dummy.fdummy +#define chdummy dummy.cdummy =09/* =09 * Our blocks =3D=3D sector size, and the version of UFS we are using i= s @@ -479,8 +485,22 @@ =09=09sblock.fs_old_cstotal.cs_nifree =3D sblock.fs_cstotal.cs_nifree; =09=09sblock.fs_old_cstotal.cs_nffree =3D sblock.fs_cstotal.cs_nffree; =09} -=09if (!Nflag) +=09if (!Nflag) { +=09=09/* +=09=09 * Wipe out old UFS1 superblock if necessary. +=09=09 */ +=09=09if (Oflag !=3D 1) { +=09=09=09i =3D bread(&disk, SBLOCK_UFS1 / disk.d_bsize, chdummy, SBLOCKSIZ= E); +=09=09=09if (i =3D=3D -1) +=09=09=09=09err(1, "can't bread: %s", disk.d_error); + +=09=09=09if (fsdummy.fs_magic =3D=3D FS_UFS1_MAGIC) { +=09=09=09=09fsdummy.fs_magic =3D 0; +=09=09=09=09bwrite(&disk, SBLOCK_UFS1 / disk.d_bsize, chdummy, SBLOCKSIZE)= ; +=09=09=09} +=09=09} =09=09sbwrite(&disk, 0); +=09} =09for (i =3D 0; i < sblock.fs_cssize; i +=3D sblock.fs_bsize) =09=09wtfs(fsbtodb(&sblock, sblock.fs_csaddr + numfrags(&sblock, i)), =09=09=09sblock.fs_cssize - i < sblock.fs_bsize ? ---8<--- regards, le --=20 Lukas Ertl eMail: l.ertl@univie.ac.at UNIX-Systemadministrator Tel.: (+43 1) 4277-14073 Zentraler Informatikdienst (ZID) Fax.: (+43 1) 4277-9140 der Universit=E4t Wien http://mailbox.univie.ac.at/~le/