projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
restore keywords
[unix-history]
/
usr
/
src
/
sbin
/
fsck
/
pass1.c
diff --git
a/usr/src/sbin/fsck/pass1.c
b/usr/src/sbin/fsck/pass1.c
index
2a68b1e
..
b63a85d
100644
(file)
--- a/
usr/src/sbin/fsck/pass1.c
+++ b/
usr/src/sbin/fsck/pass1.c
@@
-1,6
+1,12
@@
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved. The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
#ifndef lint
#ifndef lint
-static char
version[] = "@(#)pass1.c 3.5
(Berkeley) %G%";
-#endif
+static char
sccsid[] = "@(#)pass1.c 5.3
(Berkeley) %G%";
+#endif
not lint
#include <sys/param.h>
#include <sys/inode.h>
#include <sys/param.h>
#include <sys/inode.h>
@@
-15,6
+21,7
@@
pass1()
{
register int c, i, j;
register DINODE *dp;
{
register int c, i, j;
register DINODE *dp;
+ struct zlncnt *zlnp;
int ndb, partial, cgd;
struct inodesc idesc;
ino_t inumber;
int ndb, partial, cgd;
struct inodesc idesc;
ino_t inumber;
@@
-67,6
+74,12
@@
pass1()
printf("bad size %d:", dp->di_size);
goto unknown;
}
printf("bad size %d:", dp->di_size);
goto unknown;
}
+ if (!preen && (dp->di_mode & IFMT) == IFMT &&
+ reply("HOLD BAD BLOCK") == 1) {
+ dp->di_size = sblock.fs_fsize;
+ dp->di_mode = IFREG|0600;
+ inodirty();
+ }
ndb = howmany(dp->di_size, sblock.fs_bsize);
if (SPECIAL(dp))
ndb++;
ndb = howmany(dp->di_size, sblock.fs_bsize);
if (SPECIAL(dp))
ndb++;
@@
-86,22
+99,20
@@
pass1()
dp->di_ib[j]);
goto unknown;
}
dp->di_ib[j]);
goto unknown;
}
- if (!preen && (dp->di_mode & IFMT) == IFMT &&
- reply("HOLD BAD BLOCK") == 1) {
- dp->di_size = sblock.fs_fsize;
- dp->di_mode = IFREG|0600;
- inodirty();
- } else if (ftypeok(dp) == 0)
+ if (ftypeok(dp) == 0)
goto unknown;
n_files++;
lncntp[inumber] = dp->di_nlink;
if (dp->di_nlink <= 0) {
goto unknown;
n_files++;
lncntp[inumber] = dp->di_nlink;
if (dp->di_nlink <= 0) {
- if (badlnp < &badlncnt[MAXLNCNT])
- *badlnp++ = inumber;
- else {
+ zlnp = (struct zlncnt *)malloc(sizeof *zlnp);
+ if (zlnp == NULL) {
pfatal("LINK COUNT TABLE OVERFLOW");
if (reply("CONTINUE") == 0)
errexit("");
pfatal("LINK COUNT TABLE OVERFLOW");
if (reply("CONTINUE") == 0)
errexit("");
+ } else {
+ zlnp->zlncnt = inumber;
+ zlnp->next = zlnhead;
+ zlnhead = zlnp;
}
}
statemap[inumber] = DIRCT(dp) ? DSTATE : FSTATE;
}
}
statemap[inumber] = DIRCT(dp) ? DSTATE : FSTATE;
@@
-122,7
+133,9
@@
pass1()
continue;
unknown:
pfatal("UNKNOWN FILE TYPE I=%u", inumber);
continue;
unknown:
pfatal("UNKNOWN FILE TYPE I=%u", inumber);
+ statemap[inumber] = FCLEAR;
if (reply("CLEAR") == 1) {
if (reply("CLEAR") == 1) {
+ statemap[inumber] = USTATE;
zapino(dp);
inodirty();
}
zapino(dp);
inodirty();
}
@@
-133,10
+146,11
@@
pass1()
pass1check(idesc)
register struct inodesc *idesc;
{
pass1check(idesc)
register struct inodesc *idesc;
{
- register daddr_t *dlp;
int res = KEEPON;
int anyout, nfrags;
daddr_t blkno = idesc->id_blkno;
int res = KEEPON;
int anyout, nfrags;
daddr_t blkno = idesc->id_blkno;
+ register struct dups *dlp;
+ struct dups *new;
if ((anyout = outrange(blkno, idesc->id_numfrags)) != 0) {
blkerr(idesc->id_number, "BAD", blkno);
if ((anyout = outrange(blkno, idesc->id_numfrags)) != 0) {
blkerr(idesc->id_number, "BAD", blkno);
@@
-167,21
+181,26
@@
pass1check(idesc)
errexit("");
return (STOP);
}
errexit("");
return (STOP);
}
- if (enddup >= &duplist[DUPTBLSIZE]) {
+ new = (struct dups *)malloc(sizeof(struct dups));
+ if (new == NULL) {
pfatal("DUP TABLE OVERFLOW.");
if (reply("CONTINUE") == 0)
errexit("");
return (STOP);
}
pfatal("DUP TABLE OVERFLOW.");
if (reply("CONTINUE") == 0)
errexit("");
return (STOP);
}
- for (dlp = duplist; dlp < muldup; dlp++)
- if (*dlp == blkno) {
- *enddup++ = blkno;
- break;
- }
- if (dlp >= muldup) {
- *enddup++ = *muldup;
- *muldup++ = blkno;
+ new->dup = blkno;
+ if (muldup == 0) {
+ duplist = muldup = new;
+ new->next = 0;
+ } else {
+ new->next = muldup->next;
+ muldup->next = new;
}
}
+ for (dlp = duplist; dlp != muldup; dlp = dlp->next)
+ if (dlp->dup == blkno)
+ break;
+ if (dlp == muldup && dlp->dup != blkno)
+ muldup = new;
}
/*
* count the number of blocks found in id_entryno
}
/*
* count the number of blocks found in id_entryno