diff options
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/newfs/Makefile | 4 | ||||
-rw-r--r-- | sbin/newfs/mkfs.c | 17 | ||||
-rw-r--r-- | sbin/newfs/newfs.8 | 16 | ||||
-rw-r--r-- | sbin/newfs/newfs.c | 11 |
4 files changed, 33 insertions, 15 deletions
diff --git a/sbin/newfs/Makefile b/sbin/newfs/Makefile index 34cbb21f75a..1de2fd0dd9a 100644 --- a/sbin/newfs/Makefile +++ b/sbin/newfs/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.3 1996/06/23 14:31:45 deraadt Exp $ +# $OpenBSD: Makefile,v 1.4 1997/02/23 03:51:22 millert Exp $ # $NetBSD: Makefile,v 1.10 1996/05/16 07:13:01 thorpej Exp $ PROG= newfs @@ -6,7 +6,7 @@ SRCS= dkcksum.c getmntopts.c newfs.c mkfs.c MAN= newfs.8 MOUNT= ${.CURDIR}/../mount -CFLAGS+=-DMFS -I${MOUNT} +CFLAGS+=-DMFS -DFSIRAND -I${MOUNT} .PATH: ${MOUNT} ${.CURDIR}/../disklabel DPADD= ${LIBUTIL} diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index 8e3646e4325..88801eb7bab 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkfs.c,v 1.5 1997/02/21 22:55:19 millert Exp $ */ +/* $OpenBSD: mkfs.c,v 1.6 1997/02/23 03:51:23 millert Exp $ */ /* $NetBSD: mkfs.c,v 1.25 1995/06/18 21:35:38 cgd Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)mkfs.c 8.3 (Berkeley) 2/3/94"; #else -static char rcsid[] = "$OpenBSD: mkfs.c,v 1.5 1997/02/21 22:55:19 millert Exp $"; +static char rcsid[] = "$OpenBSD: mkfs.c,v 1.6 1997/02/23 03:51:23 millert Exp $"; #endif #endif /* not lint */ @@ -571,8 +571,12 @@ next: sblock.fs_cstotal.cs_nifree = 0; sblock.fs_cstotal.cs_nffree = 0; sblock.fs_fmod = 0; - sblock.fs_clean = FS_ISCLEAN; sblock.fs_ronly = 0; + sblock.fs_clean = FS_ISCLEAN; +#ifdef FSIRAND + sblock.fs_id[0] = (u_int32_t)utime; + sblock.fs_id[1] = (u_int32_t)arc4random(); +#endif /* * Dump out summary information about file system. */ @@ -721,6 +725,10 @@ initcg(cylno, utime) acg.cg_cs.cs_nifree--; } for (i = 0; i < sblock.fs_ipg / INOPF(&sblock); i += sblock.fs_frag) { +#ifdef FSIRAND + for (j = 0; j < sblock.fs_bsize / sizeof(struct dinode); j++) + zino[j].di_gen = (u_int32_t)arc4random(); +#endif wtfs(fsbtodb(&sblock, cgimin(&sblock, cylno) + i), sblock.fs_bsize, (char *)zino); } @@ -990,6 +998,9 @@ iput(ip, ino) daddr_t d; int c; +#ifdef FSIRAND + ip->di_gen = (u_int32_t)arc4random(); +#endif c = ino_to_cg(&sblock, ino); rdfs(fsbtodb(&sblock, cgtod(&sblock, 0)), sblock.fs_cgsize, (char *)&acg); diff --git a/sbin/newfs/newfs.8 b/sbin/newfs/newfs.8 index dbc6c339774..2358fd28dc6 100644 --- a/sbin/newfs/newfs.8 +++ b/sbin/newfs/newfs.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: newfs.8,v 1.4 1996/12/04 08:38:58 deraadt Exp $ +.\" $OpenBSD: newfs.8,v 1.5 1997/02/23 03:51:24 millert Exp $ .\" $NetBSD: newfs.8,v 1.12 1995/03/18 14:58:41 cgd Exp $ .\" .\" Copyright (c) 1983, 1987, 1991, 1993, 1994 @@ -123,6 +123,17 @@ will be used. (This option is useful when trying to use .Nm mount_mfs on a machine without any disks.) .Pp +Both +.Nm +and +.Nm mount_mfs +now have the functionality of +.Xr fsirand 8 +built-in so it is not necesary to run +.Xr fsirand 8 +manually unless you wish to re-randomize the +filesystem (or list the inode generation numbers). +.Pp The following options define the general layout policies. .Bl -tag -width Fl .It Fl N @@ -277,7 +288,8 @@ man page for possible options and their meanings. .Xr fsck 8 , .Xr format 8 , .Xr mount 8 , -.Xr tunefs 8 +.Xr tunefs 8 , +.Xr fsirand 8 .Rs .%A M. McKusick .%A W. Joy diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index e3c8511c99e..0523a2f3d7f 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: newfs.c,v 1.13 1997/02/22 05:53:35 millert Exp $ */ +/* $OpenBSD: newfs.c,v 1.14 1997/02/23 03:51:25 millert Exp $ */ /* $NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)newfs.c 8.8 (Berkeley) 4/18/94"; #else -static char rcsid[] = "$OpenBSD: newfs.c,v 1.13 1997/02/22 05:53:35 millert Exp $"; +static char rcsid[] = "$OpenBSD: newfs.c,v 1.14 1997/02/23 03:51:25 millert Exp $"; #endif #endif /* not lint */ @@ -589,12 +589,7 @@ havelabel: fatal("%s: %s", argv[1], strerror(errno)); } #endif - if (!Nflag) { - (void)execl(_PATH_FSIRAND, "fsirand", special, NULL); - err(1, "Can't exec %s", _PATH_FSIRAND); - } else { - exit(0); - } + exit(0); } #ifdef COMPAT |