2002-09-29 00:11:05 +04:00
|
|
|
/* $NetBSD: pass1.c,v 1.25 2002/09/28 20:11:06 dbj Exp $ */
|
1995-03-18 17:54:19 +03:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
1994-06-08 22:57:30 +04:00
|
|
|
* Copyright (c) 1980, 1986, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
1993-03-21 12:45:37 +03:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
1997-09-14 18:36:29 +04:00
|
|
|
#include <sys/cdefs.h>
|
1993-03-21 12:45:37 +03:00
|
|
|
#ifndef lint
|
1995-03-18 17:54:19 +03:00
|
|
|
#if 0
|
1997-09-16 20:44:43 +04:00
|
|
|
static char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95";
|
1995-03-18 17:54:19 +03:00
|
|
|
#else
|
2002-09-29 00:11:05 +04:00
|
|
|
__RCSID("$NetBSD: pass1.c,v 1.25 2002/09/28 20:11:06 dbj Exp $");
|
1995-03-18 17:54:19 +03:00
|
|
|
#endif
|
1993-03-21 12:45:37 +03:00
|
|
|
#endif /* not lint */
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
1994-04-25 22:23:19 +04:00
|
|
|
#include <sys/time.h>
|
1997-09-16 20:44:43 +04:00
|
|
|
|
1994-06-08 22:57:30 +04:00
|
|
|
#include <ufs/ufs/dinode.h>
|
|
|
|
#include <ufs/ufs/dir.h>
|
|
|
|
#include <ufs/ffs/fs.h>
|
1994-12-05 23:15:31 +03:00
|
|
|
|
1997-09-16 20:44:43 +04:00
|
|
|
#include <err.h>
|
1997-09-20 10:16:23 +04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
1993-03-21 12:45:37 +03:00
|
|
|
#include <string.h>
|
1994-12-05 23:15:31 +03:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
#include "fsck.h"
|
1994-12-05 23:15:31 +03:00
|
|
|
#include "extern.h"
|
1996-09-28 02:45:10 +04:00
|
|
|
#include "fsutil.h"
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-09-16 20:44:43 +04:00
|
|
|
static ufs_daddr_t badblk;
|
|
|
|
static ufs_daddr_t dupblk;
|
1996-09-23 20:18:31 +04:00
|
|
|
static void checkinode __P((ino_t, struct inodesc *));
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1994-12-05 23:15:31 +03:00
|
|
|
void
|
1993-03-21 12:45:37 +03:00
|
|
|
pass1()
|
|
|
|
{
|
|
|
|
ino_t inumber;
|
1994-06-08 22:57:30 +04:00
|
|
|
int c, i, cgd;
|
|
|
|
struct inodesc idesc;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Set file system reserved blocks in used block map.
|
|
|
|
*/
|
1998-03-18 20:01:23 +03:00
|
|
|
for (c = 0; c < sblock->fs_ncg; c++) {
|
|
|
|
cgd = cgdmin(sblock, c);
|
1996-01-19 00:55:27 +03:00
|
|
|
if (c == 0)
|
1998-03-18 20:01:23 +03:00
|
|
|
i = cgbase(sblock, c);
|
1996-01-19 00:55:27 +03:00
|
|
|
else
|
1998-03-18 20:01:23 +03:00
|
|
|
i = cgsblock(sblock, c);
|
1993-03-21 12:45:37 +03:00
|
|
|
for (; i < cgd; i++)
|
|
|
|
setbmap(i);
|
|
|
|
}
|
1998-03-18 20:01:23 +03:00
|
|
|
i = sblock->fs_csaddr;
|
|
|
|
cgd = i + howmany(sblock->fs_cssize, sblock->fs_fsize);
|
1996-01-19 00:55:27 +03:00
|
|
|
for (; i < cgd; i++)
|
|
|
|
setbmap(i);
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
|
|
|
* Find all allocated blocks.
|
|
|
|
*/
|
1994-09-23 18:26:58 +04:00
|
|
|
memset(&idesc, 0, sizeof(struct inodesc));
|
1993-03-21 12:45:37 +03:00
|
|
|
idesc.id_type = ADDR;
|
|
|
|
idesc.id_func = pass1check;
|
|
|
|
inumber = 0;
|
|
|
|
n_files = n_blks = 0;
|
|
|
|
resetinodebuf();
|
1998-03-18 20:01:23 +03:00
|
|
|
for (c = 0; c < sblock->fs_ncg; c++) {
|
2002-05-06 07:17:43 +04:00
|
|
|
if (got_siginfo) {
|
|
|
|
fprintf(stderr,
|
|
|
|
"%s: phase 1: cyl group %d of %d (%d%%)\n",
|
|
|
|
cdevname(), c, sblock->fs_ncg,
|
|
|
|
c * 100 / sblock->fs_ncg);
|
|
|
|
got_siginfo = 0;
|
|
|
|
}
|
1998-03-18 20:01:23 +03:00
|
|
|
for (i = 0; i < sblock->fs_ipg; i++, inumber++) {
|
1993-03-21 12:45:37 +03:00
|
|
|
if (inumber < ROOTINO)
|
|
|
|
continue;
|
1994-06-08 22:57:30 +04:00
|
|
|
checkinode(inumber, &idesc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
freeinodebuf();
|
1998-03-18 20:01:23 +03:00
|
|
|
do_blkswap = 0; /* has been done */
|
1994-06-08 22:57:30 +04:00
|
|
|
}
|
|
|
|
|
1996-09-23 20:18:31 +04:00
|
|
|
static void
|
1994-06-08 22:57:30 +04:00
|
|
|
checkinode(inumber, idesc)
|
|
|
|
ino_t inumber;
|
1997-09-14 18:36:29 +04:00
|
|
|
struct inodesc *idesc;
|
1994-06-08 22:57:30 +04:00
|
|
|
{
|
1997-09-14 18:36:29 +04:00
|
|
|
struct dinode *dp;
|
1994-06-08 22:57:30 +04:00
|
|
|
struct zlncnt *zlnp;
|
|
|
|
int ndb, j;
|
|
|
|
mode_t mode;
|
1998-03-18 20:01:23 +03:00
|
|
|
u_int64_t size;
|
1997-09-16 20:44:43 +04:00
|
|
|
char symbuf[MAXSYMLINKLEN];
|
1994-06-08 22:57:30 +04:00
|
|
|
|
|
|
|
dp = getnextinode(inumber);
|
1998-03-18 20:01:23 +03:00
|
|
|
mode = iswap16(dp->di_mode) & IFMT;
|
|
|
|
size = iswap64(dp->di_size);
|
1994-06-08 22:57:30 +04:00
|
|
|
if (mode == 0) {
|
1997-09-16 20:44:43 +04: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)) ||
|
1994-06-08 22:57:30 +04:00
|
|
|
dp->di_mode || dp->di_size) {
|
1996-09-23 20:18:31 +04:00
|
|
|
pfatal("PARTIALLY ALLOCATED INODE I=%u", inumber);
|
1993-03-21 12:45:37 +03:00
|
|
|
if (reply("CLEAR") == 1) {
|
|
|
|
dp = ginode(inumber);
|
|
|
|
clearinode(dp);
|
|
|
|
inodirty();
|
1998-03-18 20:01:23 +03:00
|
|
|
} else
|
|
|
|
markclean = 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1994-06-08 22:57:30 +04:00
|
|
|
statemap[inumber] = USTATE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
lastino = inumber;
|
|
|
|
if (/* dp->di_size < 0 || */
|
1998-03-18 20:01:23 +03:00
|
|
|
size + sblock->fs_bsize - 1 < size ||
|
|
|
|
(mode == IFDIR && size > MAXDIRSIZE)) {
|
1994-06-08 22:57:30 +04:00
|
|
|
if (debug)
|
2001-01-05 05:02:57 +03:00
|
|
|
printf("bad size %llu:",(unsigned long long)size);
|
1994-06-08 22:57:30 +04:00
|
|
|
goto unknown;
|
|
|
|
}
|
|
|
|
if (!preen && mode == IFMT && reply("HOLD BAD BLOCK") == 1) {
|
|
|
|
dp = ginode(inumber);
|
1998-03-18 20:01:23 +03:00
|
|
|
dp->di_size = iswap64(sblock->fs_fsize);
|
|
|
|
size = sblock->fs_fsize;
|
|
|
|
dp->di_mode = iswap16(IFREG|0600);
|
1994-06-08 22:57:30 +04:00
|
|
|
inodirty();
|
|
|
|
}
|
1998-03-18 20:01:23 +03:00
|
|
|
ndb = howmany(size, sblock->fs_bsize);
|
1994-06-08 22:57:30 +04:00
|
|
|
if (ndb < 0) {
|
|
|
|
if (debug)
|
2001-01-05 05:02:57 +03:00
|
|
|
printf("bad size %llu ndb %d:",
|
1998-03-18 20:01:23 +03:00
|
|
|
(unsigned long long)size, ndb);
|
1994-06-08 22:57:30 +04:00
|
|
|
goto unknown;
|
|
|
|
}
|
|
|
|
if (mode == IFBLK || mode == IFCHR)
|
|
|
|
ndb++;
|
|
|
|
if (mode == IFLNK) {
|
|
|
|
/*
|
|
|
|
* Note that the old fastlink format always had di_blocks set
|
|
|
|
* to 0. Other than that we no longer use the `spare' field
|
|
|
|
* (which is now the extended uid) for sanity checking, the
|
|
|
|
* new format is the same as the old. We simply ignore the
|
|
|
|
* conversion altogether. - mycroft, 19MAY1994
|
|
|
|
*/
|
|
|
|
if (doinglevel2 &&
|
1998-03-18 20:01:23 +03:00
|
|
|
size > 0 && size < MAXSYMLINKLEN &&
|
1994-06-08 22:57:30 +04:00
|
|
|
dp->di_blocks != 0) {
|
|
|
|
if (bread(fsreadfd, symbuf,
|
1998-03-18 20:01:23 +03:00
|
|
|
fsbtodb(sblock, iswap32(dp->di_db[0])),
|
1994-06-29 15:01:35 +04:00
|
|
|
(long)secsize) != 0)
|
1997-09-16 20:44:43 +04:00
|
|
|
errx(EEXIT, "cannot read symlink");
|
1994-06-08 22:57:30 +04:00
|
|
|
if (debug) {
|
1998-03-18 20:01:23 +03:00
|
|
|
symbuf[size] = 0;
|
2001-01-05 05:02:57 +03:00
|
|
|
printf("convert symlink %u(%s) of size %lld\n",
|
1997-09-16 12:37:01 +04:00
|
|
|
inumber, symbuf,
|
1998-03-18 20:01:23 +03:00
|
|
|
(unsigned long long)size);
|
1994-06-08 22:57:30 +04:00
|
|
|
}
|
|
|
|
dp = ginode(inumber);
|
1998-03-18 20:01:23 +03:00
|
|
|
memmove(dp->di_shortlink, symbuf, (long)size);
|
1994-06-08 22:57:30 +04:00
|
|
|
dp->di_blocks = 0;
|
|
|
|
inodirty();
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Fake ndb value so direct/indirect block checks below
|
|
|
|
* will detect any garbage after symlink string.
|
|
|
|
*/
|
1998-03-18 20:01:23 +03:00
|
|
|
if (size < sblock->fs_maxsymlinklen ||
|
2002-09-29 00:11:05 +04:00
|
|
|
(isappleufs && (size < APPLEUFS_MAXSYMLINKLEN)) ||
|
1998-03-18 20:01:23 +03:00
|
|
|
(sblock->fs_maxsymlinklen == 0 && dp->di_blocks == 0)) {
|
|
|
|
ndb = howmany(size, sizeof(daddr_t));
|
1994-06-08 22:57:30 +04:00
|
|
|
if (ndb > NDADDR) {
|
|
|
|
j = ndb - NDADDR;
|
|
|
|
for (ndb = 1; j > 1; j--)
|
1998-03-18 20:01:23 +03:00
|
|
|
ndb *= NINDIR(sblock);
|
1994-06-08 22:57:30 +04:00
|
|
|
ndb += NDADDR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (j = ndb; j < NDADDR; j++)
|
|
|
|
if (dp->di_db[j] != 0) {
|
|
|
|
if (debug)
|
1999-11-15 22:18:24 +03:00
|
|
|
printf("bad direct addr ix %d: %d [ndb %d]\n",
|
|
|
|
j, iswap32(dp->di_db[j]), ndb);
|
1994-06-08 22:57:30 +04:00
|
|
|
goto unknown;
|
|
|
|
}
|
|
|
|
for (j = 0, ndb -= NDADDR; ndb > 0; j++)
|
1998-03-18 20:01:23 +03:00
|
|
|
ndb /= NINDIR(sblock);
|
1994-06-08 22:57:30 +04:00
|
|
|
for (; j < NIADDR; j++)
|
|
|
|
if (dp->di_ib[j] != 0) {
|
|
|
|
if (debug)
|
1996-09-23 20:18:31 +04:00
|
|
|
printf("bad indirect addr: %d\n",
|
1998-03-18 20:01:23 +03:00
|
|
|
iswap32(dp->di_ib[j]));
|
1994-06-08 22:57:30 +04:00
|
|
|
goto unknown;
|
|
|
|
}
|
|
|
|
if (ftypeok(dp) == 0)
|
|
|
|
goto unknown;
|
|
|
|
n_files++;
|
1998-03-18 20:01:23 +03:00
|
|
|
lncntp[inumber] = iswap16(dp->di_nlink);
|
|
|
|
if (lncntp[inumber] <= 0) {
|
1994-06-08 22:57:30 +04:00
|
|
|
zlnp = (struct zlncnt *)malloc(sizeof *zlnp);
|
|
|
|
if (zlnp == NULL) {
|
1998-03-18 20:01:23 +03:00
|
|
|
markclean = 0;
|
1994-06-08 22:57:30 +04:00
|
|
|
pfatal("LINK COUNT TABLE OVERFLOW");
|
1999-11-15 22:18:24 +03:00
|
|
|
if (reply("CONTINUE") == 0) {
|
|
|
|
ckfini();
|
1997-09-16 20:44:43 +04:00
|
|
|
exit(EEXIT);
|
1999-11-15 22:18:24 +03:00
|
|
|
}
|
1994-06-08 22:57:30 +04:00
|
|
|
} else {
|
|
|
|
zlnp->zlncnt = inumber;
|
|
|
|
zlnp->next = zlnhead;
|
|
|
|
zlnhead = zlnp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (mode == IFDIR) {
|
1998-03-18 20:01:23 +03:00
|
|
|
if (size == 0)
|
1994-06-08 22:57:30 +04:00
|
|
|
statemap[inumber] = DCLEAR;
|
|
|
|
else
|
|
|
|
statemap[inumber] = DSTATE;
|
|
|
|
cacheino(dp, inumber);
|
|
|
|
} else
|
|
|
|
statemap[inumber] = FSTATE;
|
|
|
|
typemap[inumber] = IFTODT(mode);
|
|
|
|
if (doinglevel2 &&
|
1998-03-18 20:01:23 +03:00
|
|
|
(iswap16(dp->di_ouid) != (u_short)-1 ||
|
|
|
|
iswap16(dp->di_ogid) != (u_short)-1)) {
|
1994-06-08 22:57:30 +04:00
|
|
|
dp = ginode(inumber);
|
1998-03-18 20:01:23 +03:00
|
|
|
dp->di_uid = iswap32(iswap16(dp->di_ouid));
|
|
|
|
dp->di_ouid = iswap16(-1);
|
|
|
|
dp->di_gid = iswap32(iswap16(dp->di_ogid));
|
|
|
|
dp->di_ogid = iswap16(-1);
|
1994-06-08 22:57:30 +04:00
|
|
|
inodirty();
|
|
|
|
}
|
|
|
|
badblk = dupblk = 0;
|
|
|
|
idesc->id_number = inumber;
|
|
|
|
(void)ckinode(dp, idesc);
|
1998-03-18 20:01:23 +03:00
|
|
|
idesc->id_entryno *= btodb(sblock->fs_fsize);
|
|
|
|
if (iswap32(dp->di_blocks) != idesc->id_entryno) {
|
1996-09-23 20:18:31 +04:00
|
|
|
pwarn("INCORRECT BLOCK COUNT I=%u (%d should be %d)",
|
1998-03-18 20:01:23 +03:00
|
|
|
inumber, iswap32(dp->di_blocks), idesc->id_entryno);
|
1994-06-08 22:57:30 +04:00
|
|
|
if (preen)
|
|
|
|
printf(" (CORRECTED)\n");
|
1998-03-18 20:01:23 +03:00
|
|
|
else if (reply("CORRECT") == 0) {
|
|
|
|
markclean = 0;
|
1994-06-08 22:57:30 +04:00
|
|
|
return;
|
1998-03-18 20:01:23 +03:00
|
|
|
}
|
1994-06-08 22:57:30 +04:00
|
|
|
dp = ginode(inumber);
|
1998-03-18 20:01:23 +03:00
|
|
|
dp->di_blocks = iswap32(idesc->id_entryno);
|
1994-06-08 22:57:30 +04:00
|
|
|
inodirty();
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
unknown:
|
1996-09-23 20:18:31 +04:00
|
|
|
pfatal("UNKNOWN FILE TYPE I=%u", inumber);
|
1994-06-08 22:57:30 +04:00
|
|
|
statemap[inumber] = FCLEAR;
|
|
|
|
if (reply("CLEAR") == 1) {
|
|
|
|
statemap[inumber] = USTATE;
|
|
|
|
dp = ginode(inumber);
|
|
|
|
clearinode(dp);
|
|
|
|
inodirty();
|
1998-03-18 20:01:23 +03:00
|
|
|
} else
|
|
|
|
markclean = 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
1994-12-05 23:15:31 +03:00
|
|
|
int
|
1993-03-21 12:45:37 +03:00
|
|
|
pass1check(idesc)
|
1997-09-14 18:36:29 +04:00
|
|
|
struct inodesc *idesc;
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
|
|
|
int res = KEEPON;
|
|
|
|
int anyout, nfrags;
|
1997-09-16 20:44:43 +04:00
|
|
|
ufs_daddr_t blkno = idesc->id_blkno;
|
1997-09-14 18:36:29 +04:00
|
|
|
struct dups *dlp;
|
1993-03-21 12:45:37 +03:00
|
|
|
struct dups *new;
|
|
|
|
|
|
|
|
if ((anyout = chkrange(blkno, idesc->id_numfrags)) != 0) {
|
|
|
|
blkerror(idesc->id_number, "BAD", blkno);
|
|
|
|
if (badblk++ >= MAXBAD) {
|
1996-09-23 20:18:31 +04:00
|
|
|
pwarn("EXCESSIVE BAD BLKS I=%u",
|
1993-03-21 12:45:37 +03:00
|
|
|
idesc->id_number);
|
|
|
|
if (preen)
|
|
|
|
printf(" (SKIPPING)\n");
|
1999-11-15 22:18:24 +03:00
|
|
|
else if (reply("CONTINUE") == 0) {
|
|
|
|
markclean = 0;
|
|
|
|
ckfini();
|
1997-09-16 20:44:43 +04:00
|
|
|
exit(EEXIT);
|
1999-11-15 22:18:24 +03:00
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
return (STOP);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (nfrags = idesc->id_numfrags; nfrags > 0; blkno++, nfrags--) {
|
|
|
|
if (anyout && chkrange(blkno, 1)) {
|
|
|
|
res = SKIP;
|
|
|
|
} else if (!testbmap(blkno)) {
|
|
|
|
n_blks++;
|
|
|
|
setbmap(blkno);
|
|
|
|
} else {
|
|
|
|
blkerror(idesc->id_number, "DUP", blkno);
|
|
|
|
if (dupblk++ >= MAXDUP) {
|
1996-09-23 20:18:31 +04:00
|
|
|
pwarn("EXCESSIVE DUP BLKS I=%u",
|
1993-03-21 12:45:37 +03:00
|
|
|
idesc->id_number);
|
|
|
|
if (preen)
|
|
|
|
printf(" (SKIPPING)\n");
|
1999-11-15 22:18:24 +03:00
|
|
|
else if (reply("CONTINUE") == 0) {
|
|
|
|
markclean = 0;
|
|
|
|
ckfini();
|
1997-09-16 20:44:43 +04:00
|
|
|
exit(EEXIT);
|
1999-11-15 22:18:24 +03:00
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
return (STOP);
|
|
|
|
}
|
|
|
|
new = (struct dups *)malloc(sizeof(struct dups));
|
|
|
|
if (new == NULL) {
|
1998-03-18 20:01:23 +03:00
|
|
|
markclean = 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
pfatal("DUP TABLE OVERFLOW.");
|
1999-11-15 22:18:24 +03:00
|
|
|
if (reply("CONTINUE") == 0) {
|
|
|
|
markclean = 0;
|
|
|
|
ckfini();
|
1997-09-16 20:44:43 +04:00
|
|
|
exit(EEXIT);
|
1999-11-15 22:18:24 +03:00
|
|
|
}
|
1993-03-21 12:45:37 +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
|
|
|
|
*/
|
|
|
|
idesc->id_entryno++;
|
|
|
|
}
|
|
|
|
return (res);
|
|
|
|
}
|