diff options
author | bde <bde@FreeBSD.org> | 1998-07-20 12:04:42 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1998-07-20 12:04:42 +0000 |
commit | bde5ccb95a20e03f669924e0306b39e06acceab5 (patch) | |
tree | cad29524d0382f758b43bcaebde38844c572ead2 /sbin/newfs | |
parent | 870a72fe1fc3d170d8d7638ecefee02d6ff206b0 (diff) | |
download | FreeBSD-src-bde5ccb95a20e03f669924e0306b39e06acceab5.zip FreeBSD-src-bde5ccb95a20e03f669924e0306b39e06acceab5.tar.gz |
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
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 80cbf52..d2ba9ac 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__ |