diff options
author | Bruce Evans <bde@FreeBSD.org> | 1998-07-20 12:04:42 +0000 |
---|---|---|
committer | Bruce Evans <bde@FreeBSD.org> | 1998-07-20 12:04:42 +0000 |
commit | 519e76df7c90aa01f7ac833876090ca0e3353196 (patch) | |
tree | ff49c6cf25cd7fde96e512b607ae391290b5ce0b /sbin/newfs | |
parent | e18fb238dcac552bdb4cf72451c915c74826a30f (diff) | |
download | src-519e76df7c90aa01f7ac833876090ca0e3353196.tar.gz src-519e76df7c90aa01f7ac833876090ca0e3353196.zip |
Backed out rev.1.9 (except don't bring back the vax code deleted
in rev.1.9). fsck uses the per-partition ffs-related information
in the label to find alternate superblocks when the main superblock
is hosed. Rev.1.9 broke this by deleting the code that wrote the
label.
PR: 2537
xref: fsck/setup.c rev.1.8
Notes
Notes:
svn path=/head/; revision=37775
Diffstat (limited to 'sbin/newfs')
-rw-r--r-- | sbin/newfs/newfs.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index 80cbf52ea8e6..d2ba9ac8cac3 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)newfs.c 8.13 (Berkeley) 5/1/95"; #endif static const char rcsid[] = - "$Id: newfs.c,v 1.20 1998/07/15 06:28:05 charnier Exp $"; + "$Id: newfs.c,v 1.21 1998/07/16 12:04:52 charnier Exp $"; #endif /* not lint */ /* @@ -595,6 +595,8 @@ havelabel: if (realsectorsize != DEV_BSIZE) pp->p_size /= realsectorsize /DEV_BSIZE; #endif + if (!Nflag && bcmp(pp, &oldpartition, sizeof(oldpartition))) + rewritelabel(special, fso, lp); if (!Nflag) close(fso); close(fsi); @@ -663,6 +665,23 @@ getdisklabel(s, fd) return (&lab); } +rewritelabel(s, fd, lp) + char *s; + int fd; + register struct disklabel *lp; +{ +#ifdef COMPAT + if (unlabeled) + return; +#endif + lp->d_checksum = 0; + lp->d_checksum = dkcksum(lp); + if (ioctl(fd, DIOCWDINFO, (char *)lp) < 0) { + warn("ioctl (WDINFO)"); + fatal("%s: can't rewrite disk label", s); + } +} + /*VARARGS*/ void #if __STDC__ |