2003-08-07 14:04:22 +04:00
|
|
|
/* $NetBSD: pass1.c,v 1.17 2003/08/07 10:04:23 agc Exp $ */
|
1999-03-18 05:02:18 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1980, 1986, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2003-08-07 14:04:22 +04:00
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
1999-03-18 05:02:18 +03:00
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/mount.h>
|
2003-03-28 11:09:52 +03:00
|
|
|
#include <sys/buf.h>
|
|
|
|
|
|
|
|
#include <ufs/ufs/inode.h>
|
|
|
|
#include <ufs/ufs/dir.h>
|
|
|
|
#define vnode uvnode
|
1999-03-18 05:02:18 +03:00
|
|
|
#include <ufs/lfs/lfs.h>
|
2003-03-28 11:09:52 +03:00
|
|
|
#undef vnode
|
1999-03-18 05:02:18 +03:00
|
|
|
|
2003-03-28 11:09:52 +03:00
|
|
|
#include <err.h>
|
1999-03-18 05:02:18 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <signal.h>
|
|
|
|
|
2003-03-28 11:09:52 +03:00
|
|
|
#include "bufcache.h"
|
|
|
|
#include "vnode.h"
|
|
|
|
#include "lfs.h"
|
|
|
|
|
1999-03-18 05:02:18 +03:00
|
|
|
#include "fsck.h"
|
|
|
|
#include "extern.h"
|
|
|
|
#include "fsutil.h"
|
|
|
|
|
2003-03-28 11:09:52 +03:00
|
|
|
SEGUSE *seg_table;
|
|
|
|
extern ufs_daddr_t *din_table;
|
1999-03-18 05:02:18 +03:00
|
|
|
|
2003-03-28 11:09:52 +03:00
|
|
|
ufs_daddr_t badblk;
|
|
|
|
static ufs_daddr_t dupblk;
|
|
|
|
static int i_d_cmp(const void *, const void *);
|
1999-03-18 05:02:18 +03:00
|
|
|
|
2000-05-16 08:55:58 +04:00
|
|
|
struct ino_daddr {
|
2003-03-28 11:09:52 +03:00
|
|
|
ino_t ino;
|
|
|
|
ufs_daddr_t daddr;
|
2000-05-16 08:55:58 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
|
|
|
i_d_cmp(const void *va, const void *vb)
|
|
|
|
{
|
|
|
|
struct ino_daddr *a, *b;
|
|
|
|
|
2003-03-28 11:09:52 +03:00
|
|
|
a = *((struct ino_daddr **) va);
|
|
|
|
b = *((struct ino_daddr **) vb);
|
2000-05-16 08:55:58 +04:00
|
|
|
|
|
|
|
if (a->daddr == b->daddr) {
|
|
|
|
return (a->ino - b->ino);
|
|
|
|
}
|
|
|
|
if (a->daddr > b->daddr) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
1999-03-18 05:02:18 +03:00
|
|
|
void
|
|
|
|
pass1()
|
|
|
|
{
|
2003-03-28 11:09:52 +03:00
|
|
|
ino_t inumber;
|
|
|
|
int i;
|
|
|
|
struct inodesc idesc;
|
2003-04-02 14:39:19 +04:00
|
|
|
struct ufs1_dinode *tinode;
|
2003-03-28 11:09:52 +03:00
|
|
|
struct ifile *ifp;
|
|
|
|
struct ubuf *bp;
|
2000-05-16 08:55:58 +04:00
|
|
|
struct ino_daddr **dins;
|
1999-03-18 05:02:18 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Find all allocated blocks, initialize numdirs.
|
|
|
|
*/
|
|
|
|
memset(&idesc, 0, sizeof(struct inodesc));
|
|
|
|
idesc.id_type = ADDR;
|
|
|
|
idesc.id_func = pass1check;
|
|
|
|
idesc.id_lblkno = 0;
|
|
|
|
inumber = 0;
|
|
|
|
n_files = n_blks = 0;
|
|
|
|
|
2000-05-16 08:55:58 +04:00
|
|
|
if (debug)
|
2003-03-28 11:09:52 +03:00
|
|
|
printf("creating sorted inode address table...\n");
|
2000-05-16 08:55:58 +04:00
|
|
|
/* Sort by daddr */
|
2003-03-28 11:09:52 +03:00
|
|
|
dins = (struct ino_daddr **) malloc(maxino * sizeof(*dins));
|
2000-06-14 22:43:57 +04:00
|
|
|
for (i = 0; i < maxino; i++) {
|
2000-05-16 08:55:58 +04:00
|
|
|
dins[i] = malloc(sizeof(**dins));
|
|
|
|
dins[i]->ino = i;
|
2003-03-28 11:09:52 +03:00
|
|
|
if (i == fs->lfs_ifile)
|
|
|
|
dins[i]->daddr = fs->lfs_idaddr;
|
|
|
|
else {
|
|
|
|
LFS_IENTRY(ifp, fs, i, bp);
|
|
|
|
dins[i]->daddr = ifp->if_daddr;
|
|
|
|
brelse(bp);
|
|
|
|
}
|
2000-05-16 08:55:58 +04:00
|
|
|
}
|
2000-06-14 22:43:57 +04:00
|
|
|
qsort(dins, maxino, sizeof(*dins), i_d_cmp);
|
2000-05-16 08:55:58 +04:00
|
|
|
|
|
|
|
/* find a value for numdirs, fill in din_table */
|
|
|
|
if (debug)
|
|
|
|
printf("counting dirs...\n");
|
2000-05-23 05:48:52 +04:00
|
|
|
numdirs = 0;
|
2000-06-14 22:43:57 +04:00
|
|
|
for (i = 0; i < maxino; i++) {
|
2000-05-16 08:55:58 +04:00
|
|
|
inumber = dins[i]->ino;
|
2000-05-23 05:48:52 +04:00
|
|
|
if (inumber == 0 || dins[i]->daddr == 0)
|
2000-05-16 08:55:58 +04:00
|
|
|
continue;
|
2003-03-28 11:09:52 +03:00
|
|
|
tinode = ginode(inumber);
|
2000-05-23 05:48:52 +04:00
|
|
|
if (tinode && (tinode->di_mode & IFMT) == IFDIR)
|
2000-05-16 08:55:58 +04:00
|
|
|
numdirs++;
|
1999-03-18 05:02:18 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* from setup.c */
|
2000-05-23 05:48:52 +04:00
|
|
|
inplast = 0;
|
|
|
|
listmax = numdirs + 10;
|
2003-03-28 11:09:52 +03:00
|
|
|
inpsort = (struct inoinfo **) calloc((unsigned) listmax,
|
|
|
|
sizeof(struct inoinfo *));
|
|
|
|
inphead = (struct inoinfo **) calloc((unsigned) numdirs,
|
|
|
|
sizeof(struct inoinfo *));
|
2000-05-23 05:48:52 +04:00
|
|
|
if (inpsort == NULL || inphead == NULL) {
|
|
|
|
printf("cannot alloc %lu bytes for inphead\n",
|
2003-03-28 11:09:52 +03:00
|
|
|
(unsigned long) numdirs * sizeof(struct inoinfo *));
|
1999-03-18 05:02:18 +03:00
|
|
|
exit(1);
|
2000-05-23 05:48:52 +04:00
|
|
|
}
|
2000-05-16 08:55:58 +04:00
|
|
|
if (debug)
|
|
|
|
printf("counting blocks...\n");
|
2003-03-28 11:09:52 +03:00
|
|
|
|
2000-06-14 22:43:57 +04:00
|
|
|
for (i = 0; i < maxino; i++) {
|
2000-05-16 08:55:58 +04:00
|
|
|
inumber = dins[i]->ino;
|
2000-05-30 08:33:14 +04:00
|
|
|
if (inumber == 0 || dins[i]->daddr == 0) {
|
|
|
|
statemap[inumber] = USTATE;
|
2000-05-16 08:55:58 +04:00
|
|
|
continue;
|
2000-05-30 08:33:14 +04:00
|
|
|
}
|
2003-03-28 11:09:52 +03:00
|
|
|
if (dins[i]->daddr != LFS_UNUSED_DADDR) {
|
2000-05-16 08:55:58 +04:00
|
|
|
checkinode(inumber, &idesc);
|
|
|
|
} else {
|
|
|
|
statemap[inumber] = USTATE;
|
|
|
|
}
|
|
|
|
free(dins[i]);
|
2000-05-23 05:48:52 +04:00
|
|
|
}
|
2000-05-16 08:55:58 +04:00
|
|
|
free(dins);
|
1999-03-18 05:02:18 +03:00
|
|
|
}
|
|
|
|
|
2003-03-28 11:09:52 +03:00
|
|
|
void
|
2000-05-23 05:48:52 +04:00
|
|
|
checkinode(ino_t inumber, struct inodesc * idesc)
|
1999-03-18 05:02:18 +03:00
|
|
|
{
|
2003-04-02 14:39:19 +04:00
|
|
|
struct ufs1_dinode *dp;
|
2003-03-28 11:09:52 +03:00
|
|
|
struct uvnode *vp;
|
|
|
|
struct zlncnt *zlnp;
|
|
|
|
int ndb, j;
|
|
|
|
mode_t mode;
|
1999-03-18 05:02:18 +03:00
|
|
|
|
2003-03-28 11:09:52 +03:00
|
|
|
vp = vget(fs, inumber);
|
2003-07-12 15:49:04 +04:00
|
|
|
if (vp)
|
|
|
|
dp = VTOD(vp);
|
|
|
|
else
|
|
|
|
dp = NULL;
|
1999-03-18 05:02:18 +03:00
|
|
|
|
2000-05-23 05:48:52 +04:00
|
|
|
if (dp == NULL) {
|
|
|
|
/* pwarn("Could not find inode %ld\n",(long)inumber); */
|
|
|
|
statemap[inumber] = USTATE;
|
|
|
|
return;
|
|
|
|
}
|
1999-03-18 05:02:18 +03:00
|
|
|
mode = dp->di_mode & IFMT;
|
|
|
|
|
2000-05-23 05:48:52 +04:00
|
|
|
/* XXX - LFS doesn't have this particular problem (?) */
|
1999-03-18 05:02:18 +03:00
|
|
|
if (mode == 0) {
|
2003-03-28 11:09:52 +03:00
|
|
|
if (memcmp(dp->di_db, zino.di_db, NDADDR * sizeof(ufs_daddr_t)) ||
|
|
|
|
memcmp(dp->di_ib, zino.di_ib, NIADDR * sizeof(ufs_daddr_t)) ||
|
1999-03-18 05:02:18 +03:00
|
|
|
dp->di_mode || dp->di_size) {
|
|
|
|
pwarn("mode=o%o, ifmt=o%o\n", dp->di_mode, mode);
|
|
|
|
pfatal("PARTIALLY ALLOCATED INODE I=%u", inumber);
|
|
|
|
if (reply("CLEAR") == 1) {
|
2003-03-28 11:09:52 +03:00
|
|
|
vp = vget(fs, inumber);
|
|
|
|
dp = VTOD(vp);
|
1999-03-18 05:02:18 +03:00
|
|
|
clearinode(dp);
|
2003-03-28 11:09:52 +03:00
|
|
|
inodirty(VTOI(vp));
|
1999-03-18 05:02:18 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
statemap[inumber] = USTATE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
lastino = inumber;
|
2003-03-28 11:09:52 +03:00
|
|
|
if (dp->di_size < 0 || dp->di_size + fs->lfs_bsize - 1 < dp->di_size) {
|
1999-03-18 05:02:18 +03:00
|
|
|
if (debug)
|
2001-01-05 05:02:57 +03:00
|
|
|
printf("bad size %llu:",
|
2003-03-28 11:09:52 +03:00
|
|
|
(unsigned long long) dp->di_size);
|
1999-03-18 05:02:18 +03:00
|
|
|
goto unknown;
|
|
|
|
}
|
|
|
|
if (!preen && mode == IFMT && reply("HOLD BAD BLOCK") == 1) {
|
2003-03-28 11:09:52 +03:00
|
|
|
vp = vget(fs, inumber);
|
|
|
|
dp = VTOD(vp);
|
|
|
|
dp->di_size = fs->lfs_fsize;
|
2000-05-23 05:48:52 +04:00
|
|
|
dp->di_mode = IFREG | 0600;
|
2003-03-28 11:09:52 +03:00
|
|
|
inodirty(VTOI(vp));
|
1999-03-18 05:02:18 +03:00
|
|
|
}
|
2003-03-28 11:09:52 +03:00
|
|
|
ndb = howmany(dp->di_size, fs->lfs_bsize);
|
1999-03-18 05:02:18 +03:00
|
|
|
if (ndb < 0) {
|
|
|
|
if (debug)
|
2001-01-05 05:02:57 +03:00
|
|
|
printf("bad size %llu ndb %d:",
|
2003-03-28 11:09:52 +03:00
|
|
|
(unsigned long long) dp->di_size, ndb);
|
1999-03-18 05:02:18 +03:00
|
|
|
goto unknown;
|
|
|
|
}
|
|
|
|
if (mode == IFBLK || mode == IFCHR)
|
|
|
|
ndb++;
|
|
|
|
if (mode == IFLNK) {
|
|
|
|
/*
|
|
|
|
* Fake ndb value so direct/indirect block checks below
|
|
|
|
* will detect any garbage after symlink string.
|
|
|
|
*/
|
2003-03-28 11:09:52 +03:00
|
|
|
if (dp->di_size < fs->lfs_maxsymlinklen ||
|
|
|
|
(fs->lfs_maxsymlinklen == 0 && dp->di_blocks == 0)) {
|
|
|
|
ndb = howmany(dp->di_size, sizeof(ufs_daddr_t));
|
1999-03-18 05:02:18 +03:00
|
|
|
if (ndb > NDADDR) {
|
|
|
|
j = ndb - NDADDR;
|
|
|
|
for (ndb = 1; j > 1; j--)
|
2003-03-28 11:09:52 +03:00
|
|
|
ndb *= NINDIR(fs);
|
1999-03-18 05:02:18 +03:00
|
|
|
ndb += NDADDR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (j = ndb; j < NDADDR; j++)
|
|
|
|
if (dp->di_db[j] != 0) {
|
|
|
|
if (debug)
|
|
|
|
printf("bad direct addr: %d\n", dp->di_db[j]);
|
|
|
|
goto unknown;
|
|
|
|
}
|
|
|
|
for (j = 0, ndb -= NDADDR; ndb > 0; j++)
|
2003-03-28 11:09:52 +03:00
|
|
|
ndb /= NINDIR(fs);
|
1999-03-18 05:02:18 +03:00
|
|
|
for (; j < NIADDR; j++)
|
|
|
|
if (dp->di_ib[j] != 0) {
|
|
|
|
if (debug)
|
|
|
|
printf("bad indirect addr: %d\n",
|
2003-03-28 11:09:52 +03:00
|
|
|
dp->di_ib[j]);
|
2000-05-16 08:55:58 +04:00
|
|
|
/* goto unknown; */
|
1999-03-18 05:02:18 +03:00
|
|
|
}
|
|
|
|
if (ftypeok(dp) == 0)
|
|
|
|
goto unknown;
|
|
|
|
n_files++;
|
|
|
|
lncntp[inumber] = dp->di_nlink;
|
|
|
|
if (dp->di_nlink <= 0) {
|
2003-03-28 11:09:52 +03:00
|
|
|
zlnp = (struct zlncnt *) malloc(sizeof *zlnp);
|
1999-03-18 05:02:18 +03:00
|
|
|
if (zlnp == NULL) {
|
|
|
|
pfatal("LINK COUNT TABLE OVERFLOW");
|
|
|
|
if (reply("CONTINUE") == 0)
|
2003-03-28 11:09:52 +03:00
|
|
|
err(8, "%s", "");
|
1999-03-18 05:02:18 +03:00
|
|
|
} else {
|
|
|
|
zlnp->zlncnt = inumber;
|
|
|
|
zlnp->next = zlnhead;
|
|
|
|
zlnhead = zlnp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (mode == IFDIR) {
|
|
|
|
if (dp->di_size == 0)
|
|
|
|
statemap[inumber] = DCLEAR;
|
|
|
|
else
|
|
|
|
statemap[inumber] = DSTATE;
|
|
|
|
cacheino(dp, inumber);
|
|
|
|
} else
|
|
|
|
statemap[inumber] = FSTATE;
|
|
|
|
typemap[inumber] = IFTODT(mode);
|
|
|
|
badblk = dupblk = 0;
|
|
|
|
idesc->id_number = inumber;
|
2003-03-28 11:09:52 +03:00
|
|
|
(void) ckinode(VTOD(vp), idesc);
|
1999-03-18 05:02:18 +03:00
|
|
|
if (dp->di_blocks != idesc->id_entryno) {
|
|
|
|
pwarn("INCORRECT BLOCK COUNT I=%u (%d should be %d)",
|
2003-03-28 11:09:52 +03:00
|
|
|
inumber, dp->di_blocks, idesc->id_entryno);
|
1999-03-18 05:02:18 +03:00
|
|
|
if (preen)
|
|
|
|
printf(" (CORRECTED)\n");
|
|
|
|
else if (reply("CORRECT") == 0)
|
|
|
|
return;
|
2003-04-02 14:39:19 +04:00
|
|
|
VTOI(vp)->i_ffs1_blocks = idesc->id_entryno;
|
2003-03-28 11:09:52 +03:00
|
|
|
inodirty(VTOI(vp));
|
1999-03-18 05:02:18 +03:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
unknown:
|
|
|
|
pfatal("UNKNOWN FILE TYPE I=%u", inumber);
|
|
|
|
statemap[inumber] = FCLEAR;
|
|
|
|
if (reply("CLEAR") == 1) {
|
|
|
|
statemap[inumber] = USTATE;
|
2003-03-28 11:09:52 +03:00
|
|
|
vp = vget(fs, inumber);
|
|
|
|
dp = VTOD(vp);
|
1999-03-18 05:02:18 +03:00
|
|
|
clearinode(dp);
|
2003-03-28 11:09:52 +03:00
|
|
|
inodirty(VTOI(vp));
|
1999-03-18 05:02:18 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2003-03-28 11:09:52 +03:00
|
|
|
pass1check(struct inodesc *idesc)
|
1999-03-18 05:02:18 +03:00
|
|
|
{
|
2003-03-28 11:09:52 +03:00
|
|
|
int res = KEEPON;
|
|
|
|
int anyout, ndblks;
|
|
|
|
daddr_t blkno = idesc->id_blkno;
|
1999-03-18 05:02:18 +03:00
|
|
|
register struct dups *dlp;
|
2003-03-28 11:09:52 +03:00
|
|
|
struct dups *new;
|
1999-03-18 05:02:18 +03:00
|
|
|
|
2003-03-28 11:09:52 +03:00
|
|
|
if ((anyout = chkrange(blkno, fragstofsb(fs, idesc->id_numfrags))) != 0) {
|
1999-03-18 05:02:18 +03:00
|
|
|
blkerror(idesc->id_number, "BAD", blkno);
|
|
|
|
if (badblk++ >= MAXBAD) {
|
|
|
|
pwarn("EXCESSIVE BAD BLKS I=%u",
|
2003-03-28 11:09:52 +03:00
|
|
|
idesc->id_number);
|
1999-03-18 05:02:18 +03:00
|
|
|
if (preen)
|
|
|
|
printf(" (SKIPPING)\n");
|
|
|
|
else if (reply("CONTINUE") == 0)
|
2003-03-28 11:09:52 +03:00
|
|
|
err(8, "%s", "");
|
1999-03-18 05:02:18 +03:00
|
|
|
return (STOP);
|
|
|
|
}
|
2000-06-14 22:43:57 +04:00
|
|
|
} else if (!testbmap(blkno)) {
|
2003-03-28 11:09:52 +03:00
|
|
|
seg_table[dtosn(fs, blkno)].su_nbytes += idesc->id_numfrags * fs->lfs_fsize;
|
1999-03-18 05:02:18 +03:00
|
|
|
}
|
2003-03-28 11:09:52 +03:00
|
|
|
for (ndblks = fragstofsb(fs, idesc->id_numfrags); ndblks > 0; blkno++, ndblks--) {
|
1999-03-18 05:02:18 +03:00
|
|
|
if (anyout && chkrange(blkno, 1)) {
|
|
|
|
res = SKIP;
|
|
|
|
} else if (!testbmap(blkno)) {
|
|
|
|
n_blks++;
|
|
|
|
#ifndef VERBOSE_BLOCKMAP
|
|
|
|
setbmap(blkno);
|
|
|
|
#else
|
2000-05-23 05:48:52 +04:00
|
|
|
setbmap(blkno, idesc->id_number);
|
1999-03-18 05:02:18 +03:00
|
|
|
#endif
|
|
|
|
} else {
|
|
|
|
blkerror(idesc->id_number, "DUP", blkno);
|
|
|
|
#ifdef VERBOSE_BLOCKMAP
|
2000-05-23 05:48:52 +04:00
|
|
|
pwarn("(lbn %d: Holder is %d)\n", idesc->id_lblkno,
|
2003-03-28 11:09:52 +03:00
|
|
|
testbmap(blkno));
|
1999-03-18 05:02:18 +03:00
|
|
|
#endif
|
|
|
|
if (dupblk++ >= MAXDUP) {
|
|
|
|
pwarn("EXCESSIVE DUP BLKS I=%u",
|
2003-03-28 11:09:52 +03:00
|
|
|
idesc->id_number);
|
1999-03-18 05:02:18 +03:00
|
|
|
if (preen)
|
|
|
|
printf(" (SKIPPING)\n");
|
|
|
|
else if (reply("CONTINUE") == 0)
|
2003-03-28 11:09:52 +03:00
|
|
|
err(8, "%s", "");
|
1999-03-18 05:02:18 +03:00
|
|
|
return (STOP);
|
|
|
|
}
|
2003-03-28 11:09:52 +03:00
|
|
|
new = (struct dups *) malloc(sizeof(struct dups));
|
1999-03-18 05:02:18 +03:00
|
|
|
if (new == NULL) {
|
|
|
|
pfatal("DUP TABLE OVERFLOW.");
|
|
|
|
if (reply("CONTINUE") == 0)
|
2003-03-28 11:09:52 +03:00
|
|
|
err(8, "%s", "");
|
1999-03-18 05:02:18 +03:00
|
|
|
return (STOP);
|
|
|
|
}
|
|
|
|
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
|
|
|
|
*/
|
2000-05-23 05:48:52 +04:00
|
|
|
idesc->id_entryno++;
|
1999-03-18 05:02:18 +03:00
|
|
|
}
|
|
|
|
return (res);
|
|
|
|
}
|