Mostly sync with CSRG.

This commit is contained in:
mycroft 1994-12-28 00:03:49 +00:00
parent d966913f57
commit 0826920c54
12 changed files with 152 additions and 82 deletions

View File

@ -32,8 +32,8 @@
*/ */
#ifndef lint #ifndef lint
/*static char sccsid[] = "from: @(#)dir.c 8.1 (Berkeley) 6/5/93";*/ /*static char sccsid[] = "from: @(#)dir.c 8.5 (Berkeley) 12/8/94";*/
static char *rcsid = "$Id: dir.c,v 1.15 1994/12/05 20:15:44 cgd Exp $"; static char *rcsid = "$Id: dir.c,v 1.16 1994/12/28 00:03:49 mycroft Exp $";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -348,11 +348,11 @@ mkentry(idesc)
dirp->d_reclen = oldlen; dirp->d_reclen = oldlen;
dirp = (struct direct *)(((char *)dirp) + oldlen); dirp = (struct direct *)(((char *)dirp) + oldlen);
dirp->d_ino = idesc->id_parent; /* ino to be entered is in id_parent */ dirp->d_ino = idesc->id_parent; /* ino to be entered is in id_parent */
dirp->d_reclen = newent.d_reclen;
if (newinofmt) if (newinofmt)
dirp->d_type = typemap[idesc->id_parent]; dirp->d_type = typemap[idesc->id_parent];
else else
dirp->d_type = 0; dirp->d_type = 0;
dirp->d_reclen = newent.d_reclen;
dirp->d_namlen = newent.d_namlen; dirp->d_namlen = newent.d_namlen;
memcpy(dirp->d_name, idesc->id_name, (size_t)dirp->d_namlen + 1); memcpy(dirp->d_name, idesc->id_name, (size_t)dirp->d_namlen + 1);
# if (BYTE_ORDER == LITTLE_ENDIAN) # if (BYTE_ORDER == LITTLE_ENDIAN)

View File

@ -29,10 +29,10 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.\" from: @(#)fsck.8 8.2 (Berkeley) 12/11/93 .\" from: @(#)fsck.8 8.3 (Berkeley) 11/29/94
.\" $Id: fsck.8,v 1.7 1994/06/08 19:00:20 mycroft Exp $ .\" $Id: fsck.8,v 1.8 1994/12/28 00:03:51 mycroft Exp $
.\" .\"
.Dd December 11, 1993 .Dd November 29, 1994
.Dt FSCK 8 .Dt FSCK 8
.Os BSD 4 .Os BSD 4
.Sh NAME .Sh NAME
@ -182,7 +182,7 @@ do not open the filesystem for writing.
Convert the filesystem to the specified level. Convert the filesystem to the specified level.
Note that the level of a filesystem can only be raised. Note that the level of a filesystem can only be raised.
.Bl -tag -width indent .Bl -tag -width indent
There are currently three levels defined: There are currently four levels defined:
.It 0 .It 0
The filesystem is in the old (static table) format. The filesystem is in the old (static table) format.
.It 1 .It 1
@ -191,6 +191,10 @@ The filesystem is in the new (dynamic table) format.
The filesystem supports 32-bit uid's and gid's, The filesystem supports 32-bit uid's and gid's,
short symbolic links are stored in the inode, short symbolic links are stored in the inode,
and directories have an added field showing the file type. and directories have an added field showing the file type.
.It 3
If maxcontig is greater than one,
build the free segment maps to aid in finding contiguous sets of blocks.
If maxcontig is equal to one, delete any existing segment maps.
.El .El
.Pp .Pp
In interactive mode, In interactive mode,

View File

@ -32,8 +32,8 @@
*/ */
#ifndef lint #ifndef lint
/*static char sccsid[] = "from: @(#)pass2.c 8.2 (Berkeley) 2/27/94";*/ /*static char sccsid[] = "from: @(#)pass2.c 8.6 (Berkeley) 10/27/94";*/
static char *rcsid = "$Id: pass2.c,v 1.9 1994/12/05 20:15:59 cgd Exp $"; static char *rcsid = "$Id: pass2.c,v 1.10 1994/12/28 00:03:53 mycroft Exp $";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -108,6 +108,10 @@ pass2()
errexit("BAD STATE %d FOR ROOT INODE", statemap[ROOTINO]); errexit("BAD STATE %d FOR ROOT INODE", statemap[ROOTINO]);
} }
statemap[ROOTINO] = DFOUND; statemap[ROOTINO] = DFOUND;
if (newinofmt) {
statemap[WINO] = FSTATE;
typemap[WINO] = DT_WHT;
}
/* /*
* Sort the directory list into disk block order. * Sort the directory list into disk block order.
*/ */
@ -241,15 +245,15 @@ pass2check(idesc)
proto.d_type = 0; proto.d_type = 0;
proto.d_namlen = 1; proto.d_namlen = 1;
(void)strcpy(proto.d_name, "."); (void)strcpy(proto.d_name, ".");
#if BYTE_ORDER == LITTLE_ENDIAN # if BYTE_ORDER == LITTLE_ENDIAN
if (!newinofmt) { if (!newinofmt) {
u_char tmp; u_char tmp;
tmp = proto.d_type; tmp = proto.d_type;
proto.d_type = proto.d_namlen; proto.d_type = proto.d_namlen;
proto.d_namlen = tmp; proto.d_namlen = tmp;
} }
#endif # endif
entrysize = DIRSIZ(0, &proto); entrysize = DIRSIZ(0, &proto);
if (dirp->d_ino != 0 && strcmp(dirp->d_name, "..") != 0) { if (dirp->d_ino != 0 && strcmp(dirp->d_name, "..") != 0) {
pfatal("CANNOT FIX, FIRST ENTRY IN DIRECTORY CONTAINS %s\n", pfatal("CANNOT FIX, FIRST ENTRY IN DIRECTORY CONTAINS %s\n",
@ -366,6 +370,14 @@ chk2:
if (dirp->d_ino > maxino) { if (dirp->d_ino > maxino) {
fileerror(idesc->id_number, dirp->d_ino, "I OUT OF RANGE"); fileerror(idesc->id_number, dirp->d_ino, "I OUT OF RANGE");
n = reply("REMOVE"); n = reply("REMOVE");
} else if (newinofmt &&
((dirp->d_ino == WINO && dirp->d_type != DT_WHT) ||
(dirp->d_ino != WINO && dirp->d_type == DT_WHT))) {
fileerror(idesc->id_number, dirp->d_ino, "BAD WHITEOUT ENTRY");
dirp->d_ino = WINO;
dirp->d_type = DT_WHT;
if (reply("FIX") == 1)
ret |= ALTERED;
} else { } else {
again: again:
switch (statemap[dirp->d_ino]) { switch (statemap[dirp->d_ino]) {

View File

@ -32,8 +32,8 @@
*/ */
#ifndef lint #ifndef lint
/*static char sccsid[] = "from: @(#)pass5.c 8.2 (Berkeley) 2/2/94";*/ /*static char sccsid[] = "from: @(#)pass5.c 8.6 (Berkeley) 11/30/94";*/
static char *rcsid = "$Id: pass5.c,v 1.11 1994/12/18 15:55:41 cgd Exp $"; static char *rcsid = "$Id: pass5.c,v 1.12 1994/12/28 00:03:54 mycroft Exp $";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -60,9 +60,10 @@ pass5()
register struct cg *newcg = (struct cg *)buf; register struct cg *newcg = (struct cg *)buf;
struct ocg *ocg = (struct ocg *)buf; struct ocg *ocg = (struct ocg *)buf;
statemap[WINO] = USTATE;
memset(newcg, 0, (size_t)fs->fs_cgsize); memset(newcg, 0, (size_t)fs->fs_cgsize);
newcg->cg_niblk = fs->fs_ipg; newcg->cg_niblk = fs->fs_ipg;
if (cvtlevel > 3) { if (cvtlevel >= 3) {
if (fs->fs_maxcontig < 2 && fs->fs_contigsumsize > 0) { if (fs->fs_maxcontig < 2 && fs->fs_contigsumsize > 0) {
if (preen) if (preen)
pwarn("DELETING CLUSTERING MAPS\n"); pwarn("DELETING CLUSTERING MAPS\n");
@ -106,8 +107,7 @@ pass5()
case FS_42POSTBLFMT: case FS_42POSTBLFMT:
basesize = (char *)(&ocg->cg_btot[0]) - basesize = (char *)(&ocg->cg_btot[0]) -
(char *)(&ocg->cg_firstfield); (char *)(&ocg->cg_firstfield);
sumsize = (char *)&ocg->cg_iused[0] - sumsize = &ocg->cg_iused[0] - (u_int8_t *)(&ocg->cg_btot[0]);
(char *)(&ocg->cg_btot[0]);
mapsize = &ocg->cg_free[howmany(fs->fs_fpg, NBBY)] - mapsize = &ocg->cg_free[howmany(fs->fs_fpg, NBBY)] -
(u_char *)&ocg->cg_iused[0]; (u_char *)&ocg->cg_iused[0];
ocg->cg_magic = CG_MAGIC; ocg->cg_magic = CG_MAGIC;

View File

@ -32,8 +32,8 @@
*/ */
#ifndef lint #ifndef lint
/*static char sccsid[] = "from: @(#)preen.c 8.1 (Berkeley) 6/5/93";*/ /*static char sccsid[] = "from: @(#)preen.c 8.3 (Berkeley) 12/6/94";*/
static char *rcsid = "$Id: preen.c,v 1.9 1994/12/05 20:16:04 cgd Exp $"; static char *rcsid = "$Id: preen.c,v 1.10 1994/12/28 00:03:55 mycroft Exp $";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -281,47 +281,51 @@ startdisk(dk, checkit)
} }
char * char *
blockcheck(name) blockcheck(origname)
char *name; char *origname;
{ {
struct stat stslash, stblock, stchar; struct stat stslash, stblock, stchar;
char *raw; char *newname, *raw;
int retried = 0; int retried = 0;
hotroot = 0; hotroot = 0;
if (stat("/", &stslash) < 0) { if (stat("/", &stslash) < 0) {
perror("/"); perror("/");
printf("Can't stat root\n"); printf("Can't stat root\n");
return (0); return (origname);
} }
newname = origname;
retry: retry:
if (stat(name, &stblock) < 0) { if (stat(newname, &stblock) < 0) {
perror(name); perror(newname);
printf("Can't stat %s\n", name); printf("Can't stat %s\n", newname);
return (0); return (origname);
} }
if (S_ISBLK(stblock.st_mode)) { if (S_ISBLK(stblock.st_mode)) {
if (stslash.st_dev == stblock.st_rdev) if (stslash.st_dev == stblock.st_rdev)
hotroot++; hotroot++;
raw = rawname(name); raw = rawname(newname);
if (stat(raw, &stchar) < 0) { if (stat(raw, &stchar) < 0) {
perror(raw); perror(raw);
printf("Can't stat %s\n", raw); printf("Can't stat %s\n", raw);
return (name); return (origname);
} }
if (S_ISCHR(stchar.st_mode)) { if (S_ISCHR(stchar.st_mode)) {
return (raw); return (raw);
} else { } else {
printf("%s is not a character device\n", raw); printf("%s is not a character device\n", raw);
return (name); return (origname);
} }
} else if (S_ISCHR(stblock.st_mode) && !retried) { } else if (S_ISCHR(stblock.st_mode) && !retried) {
name = unrawname(name); newname = unrawname(newname);
retried++; retried++;
goto retry; goto retry;
} }
printf("Can't make sense out of name %s\n", name); /*
return (0); * Not a block or character device, just return name and
* let the user decide whether to use it.
*/
return (origname);
} }
char * char *

View File

@ -32,8 +32,8 @@
*/ */
#ifndef lint #ifndef lint
/*static char sccsid[] = "from: @(#)setup.c 8.2 (Berkeley) 2/21/94";*/ /*static char sccsid[] = "from: @(#)setup.c 8.5 (Berkeley) 11/23/94";*/
static char *rcsid = "$Id: setup.c,v 1.17 1994/12/27 19:26:57 mycroft Exp $"; static char *rcsid = "$Id: setup.c,v 1.18 1994/12/28 00:03:57 mycroft Exp $";
#endif /* not lint */ #endif /* not lint */
#define DKTYPENAMES #define DKTYPENAMES
@ -360,9 +360,9 @@ readsb(listerr)
altsblock.fs_optim = sblock.fs_optim; altsblock.fs_optim = sblock.fs_optim;
altsblock.fs_rotdelay = sblock.fs_rotdelay; altsblock.fs_rotdelay = sblock.fs_rotdelay;
altsblock.fs_maxbpg = sblock.fs_maxbpg; altsblock.fs_maxbpg = sblock.fs_maxbpg;
altsblock.fs_maxcluster = sblock.fs_maxcluster;
memcpy(altsblock.fs_csp, sblock.fs_csp, memcpy(altsblock.fs_csp, sblock.fs_csp,
sizeof sblock.fs_csp); sizeof sblock.fs_csp);
altsblock.fs_maxcluster = sblock.fs_maxcluster;
memcpy(altsblock.fs_fsmnt, sblock.fs_fsmnt, memcpy(altsblock.fs_fsmnt, sblock.fs_fsmnt,
sizeof sblock.fs_fsmnt); sizeof sblock.fs_fsmnt);
memcpy(altsblock.fs_sparecon, sblock.fs_sparecon, memcpy(altsblock.fs_sparecon, sblock.fs_sparecon,
@ -374,11 +374,26 @@ readsb(listerr)
altsblock.fs_interleave = sblock.fs_interleave; altsblock.fs_interleave = sblock.fs_interleave;
altsblock.fs_npsect = sblock.fs_npsect; altsblock.fs_npsect = sblock.fs_npsect;
altsblock.fs_nrpos = sblock.fs_nrpos; altsblock.fs_nrpos = sblock.fs_nrpos;
altsblock.fs_state = sblock.fs_state;
altsblock.fs_qbmask = sblock.fs_qbmask; altsblock.fs_qbmask = sblock.fs_qbmask;
altsblock.fs_qfmask = sblock.fs_qfmask; altsblock.fs_qfmask = sblock.fs_qfmask;
altsblock.fs_state = sblock.fs_state; altsblock.fs_state = sblock.fs_state;
altsblock.fs_maxfilesize = sblock.fs_maxfilesize; altsblock.fs_maxfilesize = sblock.fs_maxfilesize;
if (memcmp(&sblock, &altsblock, (int)sblock.fs_sbsize)) { if (memcmp(&sblock, &altsblock, (int)sblock.fs_sbsize)) {
if (debug) {
long *nlp, *olp, *endlp;
printf("superblock mismatches\n");
nlp = (long *)&altsblock;
olp = (long *)&sblock;
endlp = olp + (sblock.fs_sbsize / sizeof *olp);
for ( ; olp < endlp; olp++, nlp++) {
if (*olp == *nlp)
continue;
printf("offset %d, original %d, alternate %d\n",
olp - (long *)&sblock, *olp, *nlp);
}
}
badsb(listerr, badsb(listerr,
"VALUES IN SUPER BLOCK DISAGREE WITH THOSE IN FIRST ALTERNATE"); "VALUES IN SUPER BLOCK DISAGREE WITH THOSE IN FIRST ALTERNATE");
return (0); return (0);

View File

@ -32,8 +32,8 @@
*/ */
#ifndef lint #ifndef lint
/*static char sccsid[] = "from: @(#)dir.c 8.1 (Berkeley) 6/5/93";*/ /*static char sccsid[] = "from: @(#)dir.c 8.5 (Berkeley) 12/8/94";*/
static char *rcsid = "$Id: dir.c,v 1.15 1994/12/05 20:15:44 cgd Exp $"; static char *rcsid = "$Id: dir.c,v 1.16 1994/12/28 00:03:49 mycroft Exp $";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -348,11 +348,11 @@ mkentry(idesc)
dirp->d_reclen = oldlen; dirp->d_reclen = oldlen;
dirp = (struct direct *)(((char *)dirp) + oldlen); dirp = (struct direct *)(((char *)dirp) + oldlen);
dirp->d_ino = idesc->id_parent; /* ino to be entered is in id_parent */ dirp->d_ino = idesc->id_parent; /* ino to be entered is in id_parent */
dirp->d_reclen = newent.d_reclen;
if (newinofmt) if (newinofmt)
dirp->d_type = typemap[idesc->id_parent]; dirp->d_type = typemap[idesc->id_parent];
else else
dirp->d_type = 0; dirp->d_type = 0;
dirp->d_reclen = newent.d_reclen;
dirp->d_namlen = newent.d_namlen; dirp->d_namlen = newent.d_namlen;
memcpy(dirp->d_name, idesc->id_name, (size_t)dirp->d_namlen + 1); memcpy(dirp->d_name, idesc->id_name, (size_t)dirp->d_namlen + 1);
# if (BYTE_ORDER == LITTLE_ENDIAN) # if (BYTE_ORDER == LITTLE_ENDIAN)

View File

@ -29,10 +29,10 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.\" from: @(#)fsck.8 8.2 (Berkeley) 12/11/93 .\" from: @(#)fsck.8 8.3 (Berkeley) 11/29/94
.\" $Id: fsck_ffs.8,v 1.7 1994/06/08 19:00:20 mycroft Exp $ .\" $Id: fsck_ffs.8,v 1.8 1994/12/28 00:03:51 mycroft Exp $
.\" .\"
.Dd December 11, 1993 .Dd November 29, 1994
.Dt FSCK 8 .Dt FSCK 8
.Os BSD 4 .Os BSD 4
.Sh NAME .Sh NAME
@ -182,7 +182,7 @@ do not open the filesystem for writing.
Convert the filesystem to the specified level. Convert the filesystem to the specified level.
Note that the level of a filesystem can only be raised. Note that the level of a filesystem can only be raised.
.Bl -tag -width indent .Bl -tag -width indent
There are currently three levels defined: There are currently four levels defined:
.It 0 .It 0
The filesystem is in the old (static table) format. The filesystem is in the old (static table) format.
.It 1 .It 1
@ -191,6 +191,10 @@ The filesystem is in the new (dynamic table) format.
The filesystem supports 32-bit uid's and gid's, The filesystem supports 32-bit uid's and gid's,
short symbolic links are stored in the inode, short symbolic links are stored in the inode,
and directories have an added field showing the file type. and directories have an added field showing the file type.
.It 3
If maxcontig is greater than one,
build the free segment maps to aid in finding contiguous sets of blocks.
If maxcontig is equal to one, delete any existing segment maps.
.El .El
.Pp .Pp
In interactive mode, In interactive mode,

View File

@ -32,8 +32,8 @@
*/ */
#ifndef lint #ifndef lint
/*static char sccsid[] = "from: @(#)pass2.c 8.2 (Berkeley) 2/27/94";*/ /*static char sccsid[] = "from: @(#)pass2.c 8.6 (Berkeley) 10/27/94";*/
static char *rcsid = "$Id: pass2.c,v 1.9 1994/12/05 20:15:59 cgd Exp $"; static char *rcsid = "$Id: pass2.c,v 1.10 1994/12/28 00:03:53 mycroft Exp $";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -108,6 +108,10 @@ pass2()
errexit("BAD STATE %d FOR ROOT INODE", statemap[ROOTINO]); errexit("BAD STATE %d FOR ROOT INODE", statemap[ROOTINO]);
} }
statemap[ROOTINO] = DFOUND; statemap[ROOTINO] = DFOUND;
if (newinofmt) {
statemap[WINO] = FSTATE;
typemap[WINO] = DT_WHT;
}
/* /*
* Sort the directory list into disk block order. * Sort the directory list into disk block order.
*/ */
@ -241,15 +245,15 @@ pass2check(idesc)
proto.d_type = 0; proto.d_type = 0;
proto.d_namlen = 1; proto.d_namlen = 1;
(void)strcpy(proto.d_name, "."); (void)strcpy(proto.d_name, ".");
#if BYTE_ORDER == LITTLE_ENDIAN # if BYTE_ORDER == LITTLE_ENDIAN
if (!newinofmt) { if (!newinofmt) {
u_char tmp; u_char tmp;
tmp = proto.d_type; tmp = proto.d_type;
proto.d_type = proto.d_namlen; proto.d_type = proto.d_namlen;
proto.d_namlen = tmp; proto.d_namlen = tmp;
} }
#endif # endif
entrysize = DIRSIZ(0, &proto); entrysize = DIRSIZ(0, &proto);
if (dirp->d_ino != 0 && strcmp(dirp->d_name, "..") != 0) { if (dirp->d_ino != 0 && strcmp(dirp->d_name, "..") != 0) {
pfatal("CANNOT FIX, FIRST ENTRY IN DIRECTORY CONTAINS %s\n", pfatal("CANNOT FIX, FIRST ENTRY IN DIRECTORY CONTAINS %s\n",
@ -366,6 +370,14 @@ chk2:
if (dirp->d_ino > maxino) { if (dirp->d_ino > maxino) {
fileerror(idesc->id_number, dirp->d_ino, "I OUT OF RANGE"); fileerror(idesc->id_number, dirp->d_ino, "I OUT OF RANGE");
n = reply("REMOVE"); n = reply("REMOVE");
} else if (newinofmt &&
((dirp->d_ino == WINO && dirp->d_type != DT_WHT) ||
(dirp->d_ino != WINO && dirp->d_type == DT_WHT))) {
fileerror(idesc->id_number, dirp->d_ino, "BAD WHITEOUT ENTRY");
dirp->d_ino = WINO;
dirp->d_type = DT_WHT;
if (reply("FIX") == 1)
ret |= ALTERED;
} else { } else {
again: again:
switch (statemap[dirp->d_ino]) { switch (statemap[dirp->d_ino]) {

View File

@ -32,8 +32,8 @@
*/ */
#ifndef lint #ifndef lint
/*static char sccsid[] = "from: @(#)pass5.c 8.2 (Berkeley) 2/2/94";*/ /*static char sccsid[] = "from: @(#)pass5.c 8.6 (Berkeley) 11/30/94";*/
static char *rcsid = "$Id: pass5.c,v 1.11 1994/12/18 15:55:41 cgd Exp $"; static char *rcsid = "$Id: pass5.c,v 1.12 1994/12/28 00:03:54 mycroft Exp $";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -60,9 +60,10 @@ pass5()
register struct cg *newcg = (struct cg *)buf; register struct cg *newcg = (struct cg *)buf;
struct ocg *ocg = (struct ocg *)buf; struct ocg *ocg = (struct ocg *)buf;
statemap[WINO] = USTATE;
memset(newcg, 0, (size_t)fs->fs_cgsize); memset(newcg, 0, (size_t)fs->fs_cgsize);
newcg->cg_niblk = fs->fs_ipg; newcg->cg_niblk = fs->fs_ipg;
if (cvtlevel > 3) { if (cvtlevel >= 3) {
if (fs->fs_maxcontig < 2 && fs->fs_contigsumsize > 0) { if (fs->fs_maxcontig < 2 && fs->fs_contigsumsize > 0) {
if (preen) if (preen)
pwarn("DELETING CLUSTERING MAPS\n"); pwarn("DELETING CLUSTERING MAPS\n");
@ -106,8 +107,7 @@ pass5()
case FS_42POSTBLFMT: case FS_42POSTBLFMT:
basesize = (char *)(&ocg->cg_btot[0]) - basesize = (char *)(&ocg->cg_btot[0]) -
(char *)(&ocg->cg_firstfield); (char *)(&ocg->cg_firstfield);
sumsize = (char *)&ocg->cg_iused[0] - sumsize = &ocg->cg_iused[0] - (u_int8_t *)(&ocg->cg_btot[0]);
(char *)(&ocg->cg_btot[0]);
mapsize = &ocg->cg_free[howmany(fs->fs_fpg, NBBY)] - mapsize = &ocg->cg_free[howmany(fs->fs_fpg, NBBY)] -
(u_char *)&ocg->cg_iused[0]; (u_char *)&ocg->cg_iused[0];
ocg->cg_magic = CG_MAGIC; ocg->cg_magic = CG_MAGIC;

View File

@ -32,8 +32,8 @@
*/ */
#ifndef lint #ifndef lint
/*static char sccsid[] = "from: @(#)preen.c 8.1 (Berkeley) 6/5/93";*/ /*static char sccsid[] = "from: @(#)preen.c 8.3 (Berkeley) 12/6/94";*/
static char *rcsid = "$Id: preen.c,v 1.9 1994/12/05 20:16:04 cgd Exp $"; static char *rcsid = "$Id: preen.c,v 1.10 1994/12/28 00:03:55 mycroft Exp $";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -281,47 +281,51 @@ startdisk(dk, checkit)
} }
char * char *
blockcheck(name) blockcheck(origname)
char *name; char *origname;
{ {
struct stat stslash, stblock, stchar; struct stat stslash, stblock, stchar;
char *raw; char *newname, *raw;
int retried = 0; int retried = 0;
hotroot = 0; hotroot = 0;
if (stat("/", &stslash) < 0) { if (stat("/", &stslash) < 0) {
perror("/"); perror("/");
printf("Can't stat root\n"); printf("Can't stat root\n");
return (0); return (origname);
} }
newname = origname;
retry: retry:
if (stat(name, &stblock) < 0) { if (stat(newname, &stblock) < 0) {
perror(name); perror(newname);
printf("Can't stat %s\n", name); printf("Can't stat %s\n", newname);
return (0); return (origname);
} }
if (S_ISBLK(stblock.st_mode)) { if (S_ISBLK(stblock.st_mode)) {
if (stslash.st_dev == stblock.st_rdev) if (stslash.st_dev == stblock.st_rdev)
hotroot++; hotroot++;
raw = rawname(name); raw = rawname(newname);
if (stat(raw, &stchar) < 0) { if (stat(raw, &stchar) < 0) {
perror(raw); perror(raw);
printf("Can't stat %s\n", raw); printf("Can't stat %s\n", raw);
return (name); return (origname);
} }
if (S_ISCHR(stchar.st_mode)) { if (S_ISCHR(stchar.st_mode)) {
return (raw); return (raw);
} else { } else {
printf("%s is not a character device\n", raw); printf("%s is not a character device\n", raw);
return (name); return (origname);
} }
} else if (S_ISCHR(stblock.st_mode) && !retried) { } else if (S_ISCHR(stblock.st_mode) && !retried) {
name = unrawname(name); newname = unrawname(newname);
retried++; retried++;
goto retry; goto retry;
} }
printf("Can't make sense out of name %s\n", name); /*
return (0); * Not a block or character device, just return name and
* let the user decide whether to use it.
*/
return (origname);
} }
char * char *

View File

@ -32,8 +32,8 @@
*/ */
#ifndef lint #ifndef lint
/*static char sccsid[] = "from: @(#)setup.c 8.2 (Berkeley) 2/21/94";*/ /*static char sccsid[] = "from: @(#)setup.c 8.5 (Berkeley) 11/23/94";*/
static char *rcsid = "$Id: setup.c,v 1.17 1994/12/27 19:26:57 mycroft Exp $"; static char *rcsid = "$Id: setup.c,v 1.18 1994/12/28 00:03:57 mycroft Exp $";
#endif /* not lint */ #endif /* not lint */
#define DKTYPENAMES #define DKTYPENAMES
@ -360,9 +360,9 @@ readsb(listerr)
altsblock.fs_optim = sblock.fs_optim; altsblock.fs_optim = sblock.fs_optim;
altsblock.fs_rotdelay = sblock.fs_rotdelay; altsblock.fs_rotdelay = sblock.fs_rotdelay;
altsblock.fs_maxbpg = sblock.fs_maxbpg; altsblock.fs_maxbpg = sblock.fs_maxbpg;
altsblock.fs_maxcluster = sblock.fs_maxcluster;
memcpy(altsblock.fs_csp, sblock.fs_csp, memcpy(altsblock.fs_csp, sblock.fs_csp,
sizeof sblock.fs_csp); sizeof sblock.fs_csp);
altsblock.fs_maxcluster = sblock.fs_maxcluster;
memcpy(altsblock.fs_fsmnt, sblock.fs_fsmnt, memcpy(altsblock.fs_fsmnt, sblock.fs_fsmnt,
sizeof sblock.fs_fsmnt); sizeof sblock.fs_fsmnt);
memcpy(altsblock.fs_sparecon, sblock.fs_sparecon, memcpy(altsblock.fs_sparecon, sblock.fs_sparecon,
@ -374,11 +374,26 @@ readsb(listerr)
altsblock.fs_interleave = sblock.fs_interleave; altsblock.fs_interleave = sblock.fs_interleave;
altsblock.fs_npsect = sblock.fs_npsect; altsblock.fs_npsect = sblock.fs_npsect;
altsblock.fs_nrpos = sblock.fs_nrpos; altsblock.fs_nrpos = sblock.fs_nrpos;
altsblock.fs_state = sblock.fs_state;
altsblock.fs_qbmask = sblock.fs_qbmask; altsblock.fs_qbmask = sblock.fs_qbmask;
altsblock.fs_qfmask = sblock.fs_qfmask; altsblock.fs_qfmask = sblock.fs_qfmask;
altsblock.fs_state = sblock.fs_state; altsblock.fs_state = sblock.fs_state;
altsblock.fs_maxfilesize = sblock.fs_maxfilesize; altsblock.fs_maxfilesize = sblock.fs_maxfilesize;
if (memcmp(&sblock, &altsblock, (int)sblock.fs_sbsize)) { if (memcmp(&sblock, &altsblock, (int)sblock.fs_sbsize)) {
if (debug) {
long *nlp, *olp, *endlp;
printf("superblock mismatches\n");
nlp = (long *)&altsblock;
olp = (long *)&sblock;
endlp = olp + (sblock.fs_sbsize / sizeof *olp);
for ( ; olp < endlp; olp++, nlp++) {
if (*olp == *nlp)
continue;
printf("offset %d, original %d, alternate %d\n",
olp - (long *)&sblock, *olp, *nlp);
}
}
badsb(listerr, badsb(listerr,
"VALUES IN SUPER BLOCK DISAGREE WITH THOSE IN FIRST ALTERNATE"); "VALUES IN SUPER BLOCK DISAGREE WITH THOSE IN FIRST ALTERNATE");
return (0); return (0);