Write the UFS2 superblock with a 'BAD' magic number at the beginning

of newfs, to signify the newfs operation has not yet completed.  Re-
write the superblock with the correct magic number once all of the
cylinder groups have been created to show the operation has finished.

Sponsored by:	St. Bernard Software
This commit is contained in:
Wes Peters 2003-11-16 07:08:27 +00:00
parent 12ce12716f
commit ec52df8eb9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=122783
2 changed files with 5 additions and 1 deletions

View File

@ -259,7 +259,7 @@ mkfs(struct partition *pp, char *fsys)
sblock.fs_old_postblformat = 1;
sblock.fs_old_nrpos = 1;
} else {
sblock.fs_magic = FS_UFS2_MAGIC;
sblock.fs_magic = FS_BAD2_MAGIC;
sblock.fs_sblockloc = SBLOCK_UFS2;
sblock.fs_nindir = sblock.fs_bsize / sizeof(ufs2_daddr_t);
sblock.fs_inopb = sblock.fs_bsize / sizeof(struct ufs2_dinode);
@ -449,6 +449,9 @@ mkfs(struct partition *pp, char *fsys)
chdummy, SBLOCKSIZE);
}
}
if (!Nflag)
sbwrite(&disk, 0);
sblock.fs_magic = FS_UFS2_MAGIC;
/*
* Now build the cylinders group blocks and

View File

@ -361,6 +361,7 @@ CTASSERT(sizeof(struct fs) == 1376);
*/
#define FS_UFS1_MAGIC 0x011954 /* UFS1 fast filesystem magic number */
#define FS_UFS2_MAGIC 0x19540119 /* UFS2 fast filesystem magic number */
#define FS_BAD2_MAGIC 0x19960408 /* UFS2 incomplete newfs magic number */
#define FS_OKAY 0x7c269d38 /* superblock checksum */
#define FS_42INODEFMT -1 /* 4.2BSD inode format */
#define FS_44INODEFMT 2 /* 4.4BSD inode format */