The FSIRAND code is always compiled in, and it is unlikely that
anyone needs a newfs without it. Remove the #ifdef's from around the code and the -DFSIRAND from the Makefile. Also remove redundant declarations of random() and srandomdev().
This commit is contained in:
parent
9710700cb1
commit
f7b48c89c8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=92710
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
PROG= newfs
|
PROG= newfs
|
||||||
SRCS= newfs.c mkfs.c
|
SRCS= newfs.c mkfs.c
|
||||||
CFLAGS+=-DFSIRAND
|
|
||||||
WARNS?= 2
|
WARNS?= 2
|
||||||
MAN= newfs.8
|
MAN= newfs.8
|
||||||
|
|
||||||
|
@ -59,11 +59,6 @@ static const char rcsid[] =
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
#ifdef FSIRAND
|
|
||||||
extern long random (void);
|
|
||||||
extern void srandomdev (void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* make file system for cylinder-group style file systems
|
* make file system for cylinder-group style file systems
|
||||||
*/
|
*/
|
||||||
@ -129,9 +124,7 @@ union {
|
|||||||
struct dinode zino[MAXBSIZE / sizeof(struct dinode)];
|
struct dinode zino[MAXBSIZE / sizeof(struct dinode)];
|
||||||
|
|
||||||
int fsi, fso;
|
int fsi, fso;
|
||||||
#ifdef FSIRAND
|
|
||||||
int randinit;
|
int randinit;
|
||||||
#endif
|
|
||||||
daddr_t alloc();
|
daddr_t alloc();
|
||||||
long calcipg();
|
long calcipg();
|
||||||
static int charsperline();
|
static int charsperline();
|
||||||
@ -164,12 +157,10 @@ mkfs(pp, fsys, fi, fo)
|
|||||||
char tmpbuf[100]; /* XXX this will break in about 2,500 years */
|
char tmpbuf[100]; /* XXX this will break in about 2,500 years */
|
||||||
|
|
||||||
time(&utime);
|
time(&utime);
|
||||||
#ifdef FSIRAND
|
|
||||||
if (!randinit) {
|
if (!randinit) {
|
||||||
randinit = 1;
|
randinit = 1;
|
||||||
srandomdev();
|
srandomdev();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
fsi = fi;
|
fsi = fi;
|
||||||
fso = fo;
|
fso = fo;
|
||||||
if (Oflag) {
|
if (Oflag) {
|
||||||
@ -600,10 +591,8 @@ mkfs(pp, fsys, fi, fo)
|
|||||||
sblock.fs_fmod = 0;
|
sblock.fs_fmod = 0;
|
||||||
sblock.fs_ronly = 0;
|
sblock.fs_ronly = 0;
|
||||||
sblock.fs_clean = 1;
|
sblock.fs_clean = 1;
|
||||||
#ifdef FSIRAND
|
|
||||||
sblock.fs_id[0] = (long)utime;
|
sblock.fs_id[0] = (long)utime;
|
||||||
sblock.fs_id[1] = random();
|
sblock.fs_id[1] = random();
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dump out summary information about file system.
|
* Dump out summary information about file system.
|
||||||
@ -682,11 +671,8 @@ initcg(cylno, utime)
|
|||||||
time_t utime;
|
time_t utime;
|
||||||
{
|
{
|
||||||
daddr_t cbase, d, dlower, dupper, dmax, blkno;
|
daddr_t cbase, d, dlower, dupper, dmax, blkno;
|
||||||
long i;
|
|
||||||
struct csum *cs;
|
struct csum *cs;
|
||||||
#ifdef FSIRAND
|
long i, j;
|
||||||
long j;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine block bounds for cylinder group.
|
* Determine block bounds for cylinder group.
|
||||||
@ -746,10 +732,8 @@ initcg(cylno, utime)
|
|||||||
acg.cg_cs.cs_nifree--;
|
acg.cg_cs.cs_nifree--;
|
||||||
}
|
}
|
||||||
for (i = 0; i < sblock.fs_ipg / INOPF(&sblock); i += sblock.fs_frag) {
|
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++)
|
for (j = 0; j < sblock.fs_bsize / sizeof(struct dinode); j++)
|
||||||
zino[j].di_gen = random();
|
zino[j].di_gen = random();
|
||||||
#endif
|
|
||||||
wtfs(fsbtodb(&sblock, cgimin(&sblock, cylno) + i),
|
wtfs(fsbtodb(&sblock, cgimin(&sblock, cylno) + i),
|
||||||
sblock.fs_bsize, (char *)zino);
|
sblock.fs_bsize, (char *)zino);
|
||||||
}
|
}
|
||||||
@ -1058,9 +1042,7 @@ iput(ip, ino)
|
|||||||
daddr_t d;
|
daddr_t d;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
#ifdef FSIRAND
|
|
||||||
ip->di_gen = random();
|
ip->di_gen = random();
|
||||||
#endif
|
|
||||||
c = ino_to_cg(&sblock, ino);
|
c = ino_to_cg(&sblock, ino);
|
||||||
rdfs(fsbtodb(&sblock, cgtod(&sblock, 0)), sblock.fs_cgsize,
|
rdfs(fsbtodb(&sblock, cgtod(&sblock, 0)), sblock.fs_cgsize,
|
||||||
(char *)&acg);
|
(char *)&acg);
|
||||||
|
Loading…
Reference in New Issue
Block a user