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 =================================================================== 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 3 May 2003 18:41:58 -0000 1.75 +++ sbin/newfs/mkfs.c 8 May 2003 10:42:15 -0000 _at__at_ -113,6 +113,12 _at__at_ quad_t sizepb; int width; char tmpbuf[100]; /* XXX this will break in about 2,500 years */ + union { + struct fs fdummy; + char cdummy[SBLOCKSIZE]; + } dummy; +#define fsdummy dummy.fdummy +#define chdummy dummy.cdummy /* * Our blocks == sector size, and the version of UFS we are using is _at__at_ -479,8 +485,22 _at__at_ sblock.fs_old_cstotal.cs_nifree = sblock.fs_cstotal.cs_nifree; sblock.fs_old_cstotal.cs_nffree = sblock.fs_cstotal.cs_nffree; } - if (!Nflag) + if (!Nflag) { + /* + * Wipe out old UFS1 superblock if necessary. + */ + if (Oflag != 1) { + i = bread(&disk, SBLOCK_UFS1 / disk.d_bsize, chdummy, SBLOCKSIZE); + if (i == -1) + err(1, "can't bread: %s", disk.d_error); + + if (fsdummy.fs_magic == FS_UFS1_MAGIC) { + fsdummy.fs_magic = 0; + bwrite(&disk, SBLOCK_UFS1 / disk.d_bsize, chdummy, SBLOCKSIZE); + } + } sbwrite(&disk, 0); + } for (i = 0; i < sblock.fs_cssize; i += sblock.fs_bsize) wtfs(fsbtodb(&sblock, sblock.fs_csaddr + numfrags(&sblock, i)), sblock.fs_cssize - i < sblock.fs_bsize ? ---8<--- regards, le -- Lukas Ertl eMail: l.ertl_at_univie.ac.at UNIX-Systemadministrator Tel.: (+43 1) 4277-14073 Zentraler Informatikdienst (ZID) Fax.: (+43 1) 4277-9140 der Universität Wien http://mailbox.univie.ac.at/~le/Received on Thu May 08 2003 - 01:45:39 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:07 UTC