]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/fsck_ffs/pass1.c
OpenSSL: Merge OpenSSL 1.1.1t
[FreeBSD/FreeBSD.git] / sbin / fsck_ffs / pass1.c
1 /*-
2  * SPDX-License-Identifier: BSD-3-Clause
3  *
4  * Copyright (c) 1980, 1986, 1993
5  *      The Regents of the University of California.  All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. Neither the name of the University nor the names of its contributors
16  *    may be used to endorse or promote products derived from this software
17  *    without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29  * SUCH DAMAGE.
30  */
31
32 #if 0
33 #ifndef lint
34 static const char sccsid[] = "@(#)pass1.c       8.6 (Berkeley) 4/28/95";
35 #endif /* not lint */
36 #endif
37 #include <sys/cdefs.h>
38 __FBSDID("$FreeBSD$");
39
40 #include <sys/param.h>
41 #include <sys/stat.h>
42 #include <sys/sysctl.h>
43
44 #include <ufs/ufs/dinode.h>
45 #include <ufs/ufs/dir.h>
46 #include <ufs/ffs/fs.h>
47
48 #include <err.h>
49 #include <limits.h>
50 #include <stdint.h>
51 #include <string.h>
52
53 #include "fsck.h"
54
55 static ufs2_daddr_t badblk;
56 static ufs2_daddr_t dupblk;
57 static ino_t lastino;           /* last inode in use */
58
59 static int checkinode(ino_t inumber, struct inodesc *, int rebuildcg);
60
61 void
62 pass1(void)
63 {
64         struct inostat *info;
65         struct inodesc idesc;
66         struct bufarea *cgbp;
67         struct cg *cgp;
68         ino_t inumber, inosused, mininos;
69         ufs2_daddr_t i, cgd;
70         u_int8_t *cp;
71         int c, rebuildcg;
72
73         badblk = dupblk = lastino = 0;
74
75         /*
76          * Set file system reserved blocks in used block map.
77          */
78         for (c = 0; c < sblock.fs_ncg; c++) {
79                 cgd = cgdmin(&sblock, c);
80                 if (c == 0) {
81                         i = cgbase(&sblock, c);
82                 } else
83                         i = cgsblock(&sblock, c);
84                 for (; i < cgd; i++)
85                         setbmap(i);
86         }
87         i = sblock.fs_csaddr;
88         cgd = i + howmany(sblock.fs_cssize, sblock.fs_fsize);
89         for (; i < cgd; i++)
90                 setbmap(i);
91
92         /*
93          * Find all allocated blocks.
94          */
95         memset(&idesc, 0, sizeof(struct inodesc));
96         idesc.id_func = pass1check;
97         n_files = n_blks = 0;
98         for (c = 0; c < sblock.fs_ncg; c++) {
99                 inumber = c * sblock.fs_ipg;
100                 cgbp = cglookup(c);
101                 cgp = cgbp->b_un.b_cg;
102                 rebuildcg = 0;
103                 if (!check_cgmagic(c, cgbp, 1))
104                         rebuildcg = 1;
105                 if (!rebuildcg && sblock.fs_magic == FS_UFS2_MAGIC) {
106                         inosused = cgp->cg_initediblk;
107                         if (inosused > sblock.fs_ipg) {
108                                 pfatal("Too many initialized inodes (%ju > %d) "
109                                     "in cylinder group %d\nReset to %d\n",
110                                     (uintmax_t)inosused, sblock.fs_ipg, c,
111                                     sblock.fs_ipg);
112                                 inosused = sblock.fs_ipg;
113                         }
114                 } else {
115                         inosused = sblock.fs_ipg;
116                 }
117                 if (got_siginfo) {
118                         printf("%s: phase 1: cyl group %d of %d (%d%%)\n",
119                             cdevname, c, sblock.fs_ncg,
120                             c * 100 / sblock.fs_ncg);
121                         got_siginfo = 0;
122                 }
123                 if (got_sigalarm) {
124                         setproctitle("%s p1 %d%%", cdevname,
125                              c * 100 / sblock.fs_ncg);
126                         got_sigalarm = 0;
127                 }
128                 /*
129                  * If we are using soft updates, then we can trust the
130                  * cylinder group inode allocation maps to tell us which
131                  * inodes are allocated. We will scan the used inode map
132                  * to find the inodes that are really in use, and then
133                  * read only those inodes in from disk.
134                  */
135                 if ((preen || inoopt) && usedsoftdep && !rebuildcg) {
136                         cp = &cg_inosused(cgp)[(inosused - 1) / CHAR_BIT];
137                         for ( ; inosused != 0; cp--) {
138                                 if (*cp == 0) {
139                                         if (inosused > CHAR_BIT)
140                                                 inosused -= CHAR_BIT;
141                                         else
142                                                 inosused = 0;
143                                         continue;
144                                 }
145                                 for (i = 1 << (CHAR_BIT - 1); i > 0; i >>= 1) {
146                                         if (*cp & i)
147                                                 break;
148                                         inosused--;
149                                 }
150                                 break;
151                         }
152                 }
153                 /*
154                  * Allocate inoinfo structures for the allocated inodes.
155                  */
156                 inostathead[c].il_numalloced = inosused;
157                 if (inosused == 0) {
158                         inostathead[c].il_stat = NULL;
159                         continue;
160                 }
161                 info = Calloc((unsigned)inosused, sizeof(struct inostat));
162                 if (info == NULL)
163                         errx(EEXIT, "cannot alloc %u bytes for inoinfo",
164                             (unsigned)(sizeof(struct inostat) * inosused));
165                 inostathead[c].il_stat = info;
166                 /*
167                  * Scan the allocated inodes.
168                  */
169                 setinodebuf(c, inosused);
170                 for (i = 0; i < inosused; i++, inumber++) {
171                         if (inumber < UFS_ROOTINO) {
172                                 (void)getnextinode(inumber, rebuildcg);
173                                 continue;
174                         }
175                         /*
176                          * NULL return indicates probable end of allocated
177                          * inodes during cylinder group rebuild attempt.
178                          * We always keep trying until we get to the minimum
179                          * valid number for this cylinder group.
180                          */
181                         if (checkinode(inumber, &idesc, rebuildcg) == 0 &&
182                             i > cgp->cg_initediblk)
183                                 break;
184                 }
185                 /*
186                  * This optimization speeds up future runs of fsck
187                  * by trimming down the number of inodes in cylinder
188                  * groups that formerly had many inodes but now have
189                  * fewer in use.
190                  */
191                 mininos = roundup(inosused + INOPB(&sblock), INOPB(&sblock));
192                 if (inoopt && !preen && !rebuildcg &&
193                     sblock.fs_magic == FS_UFS2_MAGIC &&
194                     cgp->cg_initediblk > 2 * INOPB(&sblock) &&
195                     mininos < cgp->cg_initediblk) {
196                         i = cgp->cg_initediblk;
197                         if (mininos < 2 * INOPB(&sblock))
198                                 cgp->cg_initediblk = 2 * INOPB(&sblock);
199                         else
200                                 cgp->cg_initediblk = mininos;
201                         pwarn("CYLINDER GROUP %d: RESET FROM %ju TO %d %s\n",
202                             c, i, cgp->cg_initediblk, "VALID INODES");
203                         cgdirty(cgbp);
204                 }
205                 if (inosused < sblock.fs_ipg)
206                         continue;
207                 lastino += 1;
208                 if (lastino < (c * sblock.fs_ipg))
209                         inosused = 0;
210                 else
211                         inosused = lastino - (c * sblock.fs_ipg);
212                 if (rebuildcg && inosused > cgp->cg_initediblk &&
213                     sblock.fs_magic == FS_UFS2_MAGIC) {
214                         cgp->cg_initediblk = roundup(inosused, INOPB(&sblock));
215                         pwarn("CYLINDER GROUP %d: FOUND %d VALID INODES\n", c,
216                             cgp->cg_initediblk);
217                 }
218                 /*
219                  * If we were not able to determine in advance which inodes
220                  * were in use, then reduce the size of the inoinfo structure
221                  * to the size necessary to describe the inodes that we
222                  * really found.
223                  */
224                 if (inumber == lastino)
225                         continue;
226                 inostathead[c].il_numalloced = inosused;
227                 if (inosused == 0) {
228                         free(inostathead[c].il_stat);
229                         inostathead[c].il_stat = NULL;
230                         continue;
231                 }
232                 info = Calloc((unsigned)inosused, sizeof(struct inostat));
233                 if (info == NULL)
234                         errx(EEXIT, "cannot alloc %u bytes for inoinfo",
235                             (unsigned)(sizeof(struct inostat) * inosused));
236                 memmove(info, inostathead[c].il_stat, inosused * sizeof(*info));
237                 free(inostathead[c].il_stat);
238                 inostathead[c].il_stat = info;
239         }
240         freeinodebuf();
241 }
242
243 static int
244 checkinode(ino_t inumber, struct inodesc *idesc, int rebuildcg)
245 {
246         struct inode ip;
247         union dinode *dp;
248         off_t kernmaxfilesize;
249         ufs2_daddr_t ndb;
250         mode_t mode;
251         intmax_t size, fixsize;
252         int j, ret, offset;
253
254         if ((dp = getnextinode(inumber, rebuildcg)) == NULL) {
255                 pfatal("INVALID INODE");
256                 goto unknown;
257         }
258         mode = DIP(dp, di_mode) & IFMT;
259         if (mode == 0) {
260                 if ((sblock.fs_magic == FS_UFS1_MAGIC &&
261                      (memcmp(dp->dp1.di_db, zino.dp1.di_db,
262                         UFS_NDADDR * sizeof(ufs1_daddr_t)) ||
263                       memcmp(dp->dp1.di_ib, zino.dp1.di_ib,
264                         UFS_NIADDR * sizeof(ufs1_daddr_t)) ||
265                       dp->dp1.di_mode || dp->dp1.di_size)) ||
266                     (sblock.fs_magic == FS_UFS2_MAGIC &&
267                      (memcmp(dp->dp2.di_db, zino.dp2.di_db,
268                         UFS_NDADDR * sizeof(ufs2_daddr_t)) ||
269                       memcmp(dp->dp2.di_ib, zino.dp2.di_ib,
270                         UFS_NIADDR * sizeof(ufs2_daddr_t)) ||
271                       dp->dp2.di_mode || dp->dp2.di_size))) {
272                         pfatal("PARTIALLY ALLOCATED INODE I=%lu",
273                             (u_long)inumber);
274                         if (reply("CLEAR") == 1) {
275                                 ginode(inumber, &ip);
276                                 clearinode(ip.i_dp);
277                                 inodirty(&ip);
278                                 irelse(&ip);
279                         }
280                 }
281                 inoinfo(inumber)->ino_state = USTATE;
282                 return (1);
283         }
284         lastino = inumber;
285         /* This should match the file size limit in ffs_mountfs(). */
286         if (sblock.fs_magic == FS_UFS1_MAGIC)
287                 kernmaxfilesize = (off_t)0x40000000 * sblock.fs_bsize - 1;
288         else
289                 kernmaxfilesize = sblock.fs_maxfilesize;
290         if (DIP(dp, di_size) > kernmaxfilesize ||
291             DIP(dp, di_size) > sblock.fs_maxfilesize ||
292             (mode == IFDIR && DIP(dp, di_size) > MAXDIRSIZE)) {
293                 if (debug)
294                         printf("bad size %ju:", (uintmax_t)DIP(dp, di_size));
295                 pfatal("BAD FILE SIZE");
296                 goto unknown;
297         }
298         if (!preen && mode == IFMT && reply("HOLD BAD BLOCK") == 1) {
299                 ginode(inumber, &ip);
300                 dp = ip.i_dp;
301                 DIP_SET(dp, di_size, sblock.fs_fsize);
302                 DIP_SET(dp, di_mode, IFREG|0600);
303                 inodirty(&ip);
304                 irelse(&ip);
305         }
306         if ((mode == IFBLK || mode == IFCHR || mode == IFIFO ||
307              mode == IFSOCK) && DIP(dp, di_size) != 0) {
308                 if (debug)
309                         printf("bad special-file size %ju:",
310                             (uintmax_t)DIP(dp, di_size));
311                 pfatal("BAD SPECIAL-FILE SIZE");
312                 goto unknown;
313         }
314         if ((mode == IFBLK || mode == IFCHR) &&
315             (dev_t)DIP(dp, di_rdev) == NODEV) {
316                 if (debug)
317                         printf("bad special-file rdev NODEV:");
318                 pfatal("BAD SPECIAL-FILE RDEV");
319                 goto unknown;
320         }
321         ndb = howmany(DIP(dp, di_size), sblock.fs_bsize);
322         if (ndb < 0) {
323                 if (debug)
324                         printf("negative size %ju ndb %ju:",
325                                 (uintmax_t)DIP(dp, di_size), (uintmax_t)ndb);
326                 pfatal("NEGATIVE FILE SIZE");
327                 goto unknown;
328         }
329         if (mode == IFBLK || mode == IFCHR)
330                 ndb++;
331         if (mode == IFLNK) {
332                 /*
333                  * Fake ndb value so direct/indirect block checks below
334                  * will detect any garbage after symlink string.
335                  */
336                 if (DIP(dp, di_size) < (off_t)sblock.fs_maxsymlinklen) {
337                         if (sblock.fs_magic == FS_UFS1_MAGIC)
338                                 ndb = howmany(DIP(dp, di_size),
339                                     sizeof(ufs1_daddr_t));
340                         else
341                                 ndb = howmany(DIP(dp, di_size),
342                                     sizeof(ufs2_daddr_t));
343                         if (ndb > UFS_NDADDR) {
344                                 j = ndb - UFS_NDADDR;
345                                 for (ndb = 1; j > 1; j--)
346                                         ndb *= NINDIR(&sblock);
347                                 ndb += UFS_NDADDR;
348                         }
349                 }
350         }
351         for (j = ndb; ndb < UFS_NDADDR && j < UFS_NDADDR; j++)
352                 if (DIP(dp, di_db[j]) != 0) {
353                         if (debug)
354                                 printf("invalid direct addr[%d]: %ju\n", j,
355                                     (uintmax_t)DIP(dp, di_db[j]));
356                         pfatal("INVALID DIRECT BLOCK");
357                         goto unknown;
358                 }
359         for (j = 0, ndb -= UFS_NDADDR; ndb > 0; j++)
360                 ndb /= NINDIR(&sblock);
361         for (; j < UFS_NIADDR; j++)
362                 if (DIP(dp, di_ib[j]) != 0) {
363                         if (debug)
364                                 printf("invalid indirect addr: %ju\n",
365                                     (uintmax_t)DIP(dp, di_ib[j]));
366                         pfatal("INVALID INDIRECT BLOCK");
367                         goto unknown;
368                 }
369         if (ftypeok(dp) == 0) {
370                 pfatal("UNKNOWN FILE TYPE");
371                 goto unknown;
372         }
373         n_files++;
374         inoinfo(inumber)->ino_linkcnt = DIP(dp, di_nlink);
375         if (mode == IFDIR) {
376                 if (DIP(dp, di_size) == 0)
377                         inoinfo(inumber)->ino_state = DCLEAR;
378                 else if (DIP(dp, di_nlink) <= 0)
379                         inoinfo(inumber)->ino_state = DZLINK;
380                 else
381                         inoinfo(inumber)->ino_state = DSTATE;
382                 cacheino(dp, inumber);
383                 countdirs++;
384         } else if (DIP(dp, di_nlink) <= 0)
385                 inoinfo(inumber)->ino_state = FZLINK;
386         else
387                 inoinfo(inumber)->ino_state = FSTATE;
388         inoinfo(inumber)->ino_type = IFTODT(mode);
389         badblk = dupblk = 0;
390         idesc->id_number = inumber;
391         if (DIP(dp, di_flags) & SF_SNAPSHOT)
392                 inoinfo(inumber)->ino_idtype = SNAP;
393         else
394                 inoinfo(inumber)->ino_idtype = ADDR;
395         idesc->id_type = inoinfo(inumber)->ino_idtype;
396         (void)ckinode(dp, idesc);
397         if (sblock.fs_magic == FS_UFS2_MAGIC && dp->dp2.di_extsize > 0) {
398                 ndb = howmany(dp->dp2.di_extsize, sblock.fs_bsize);
399                 for (j = 0; j < UFS_NXADDR; j++) {
400                         if (--ndb == 0 &&
401                             (offset = blkoff(&sblock, dp->dp2.di_extsize)) != 0)
402                                 idesc->id_numfrags = numfrags(&sblock,
403                                     fragroundup(&sblock, offset));
404                         else
405                                 idesc->id_numfrags = sblock.fs_frag;
406                         if (dp->dp2.di_extb[j] == 0)
407                                 continue;
408                         idesc->id_blkno = dp->dp2.di_extb[j];
409                         ret = (*idesc->id_func)(idesc);
410                         if (ret & STOP)
411                                 break;
412                 }
413         }
414         if (sblock.fs_magic == FS_UFS2_MAGIC)
415                 eascan(idesc, &dp->dp2);
416         idesc->id_entryno *= btodb(sblock.fs_fsize);
417         if (DIP(dp, di_blocks) != idesc->id_entryno) {
418                 pwarn("INCORRECT BLOCK COUNT I=%lu (%ju should be %ju)",
419                     (u_long)inumber, (uintmax_t)DIP(dp, di_blocks),
420                     (uintmax_t)idesc->id_entryno);
421                 if (preen)
422                         printf(" (CORRECTED)\n");
423                 else if (reply("CORRECT") == 0)
424                         return (1);
425                 if (bkgrdflag == 0) {
426                         ginode(inumber, &ip);
427                         DIP_SET(ip.i_dp, di_blocks, idesc->id_entryno);
428                         inodirty(&ip);
429                         irelse(&ip);
430                 } else {
431                         cmd.value = idesc->id_number;
432                         cmd.size = idesc->id_entryno - DIP(dp, di_blocks);
433                         if (debug)
434                                 printf("adjblkcnt ino %ju amount %lld\n",
435                                     (uintmax_t)cmd.value, (long long)cmd.size);
436                         if (sysctl(adjblkcnt, MIBSIZE, 0, 0,
437                             &cmd, sizeof cmd) == -1)
438                                 rwerror("ADJUST INODE BLOCK COUNT", cmd.value);
439                 }
440         }
441         /*
442          * UFS does not allow files to end with a hole; it requires that
443          * the last block of a file be allocated. The last allocated block
444          * in a file is tracked in id_lballoc. Here, we check for a size
445          * past the last allocated block of the file and if that is found,
446          * shorten the file to reference the last allocated block to avoid
447          * having it reference a hole at its end.
448          * 
449          * Soft updates will always ensure that the file size is correct
450          * for files that contain only direct block pointers. However
451          * soft updates does not roll back sizes for files with indirect
452          * blocks that it has set to unallocated because their contents
453          * have not yet been written to disk. Hence, the file can appear
454          * to have a hole at its end because the block pointer has been
455          * rolled back to zero. Thus finding a hole at the end of a file
456          * that is located in an indirect block receives only a warning
457          * while finding a hole at the end of a file in a direct block
458          * receives a fatal error message.
459          */
460         size = DIP(dp, di_size);
461         if (idesc->id_lballoc < lblkno(&sblock, size - 1) &&
462             /* exclude embedded symbolic links */
463             ((mode != IFLNK) || size >= sblock.fs_maxsymlinklen)) {
464                 fixsize = lblktosize(&sblock, idesc->id_lballoc + 1);
465                 if (size > UFS_NDADDR * sblock.fs_bsize)
466                         pwarn("INODE %lu: FILE SIZE %ju BEYOND END OF "
467                               "ALLOCATED FILE, SIZE SHOULD BE %ju",
468                               (u_long)inumber, size, fixsize);
469                 else
470                         pfatal("INODE %lu: FILE SIZE %ju BEYOND END OF "
471                               "ALLOCATED FILE, SIZE SHOULD BE %ju",
472                               (u_long)inumber, size, fixsize);
473                 if (preen)
474                         printf(" (ADJUSTED)\n");
475                 else if (reply("ADJUST") == 0)
476                         return (1);
477                 if (bkgrdflag == 0) {
478                         ginode(inumber, &ip);
479                         DIP_SET(ip.i_dp, di_size, fixsize);
480                         inodirty(&ip);
481                         irelse(&ip);
482                 } else {
483                         cmd.value = idesc->id_number;
484                         cmd.size = fixsize;
485                         if (debug)
486                                 printf("setsize ino %ju size set to %ju\n",
487                                     (uintmax_t)cmd.value, (uintmax_t)cmd.size);
488                         if (sysctl(setsize, MIBSIZE, 0, 0,
489                             &cmd, sizeof cmd) == -1)
490                                 rwerror("SET INODE SIZE", cmd.value);
491                 }
492
493         }
494         return (1);
495 unknown:
496         ginode(inumber, &ip);
497         prtinode(&ip);
498         inoinfo(inumber)->ino_state = USTATE;
499         if (reply("CLEAR") == 1) {
500                 clearinode(ip.i_dp);
501                 inodirty(&ip);
502         }
503         irelse(&ip);
504         return (1);
505 }
506
507 int
508 pass1check(struct inodesc *idesc)
509 {
510         int res = KEEPON;
511         int anyout, nfrags;
512         ufs2_daddr_t blkno = idesc->id_blkno;
513         struct dups *dlp;
514         struct dups *new;
515
516         if (idesc->id_type == SNAP) {
517                 if (blkno == BLK_NOCOPY)
518                         return (KEEPON);
519                 if (idesc->id_number == cursnapshot) {
520                         if (blkno == blkstofrags(&sblock, idesc->id_lbn))
521                                 return (KEEPON);
522                         if (blkno == BLK_SNAP) {
523                                 blkno = blkstofrags(&sblock, idesc->id_lbn);
524                                 idesc->id_entryno -= idesc->id_numfrags;
525                         }
526                 } else {
527                         if (blkno == BLK_SNAP)
528                                 return (KEEPON);
529                 }
530         }
531         if ((anyout = chkrange(blkno, idesc->id_numfrags)) != 0) {
532                 blkerror(idesc->id_number, "BAD", blkno);
533                 if (badblk++ >= MAXBAD) {
534                         pwarn("EXCESSIVE BAD BLKS I=%lu",
535                             (u_long)idesc->id_number);
536                         if (preen)
537                                 printf(" (SKIPPING)\n");
538                         else if (reply("CONTINUE") == 0) {
539                                 ckfini(0);
540                                 exit(EEXIT);
541                         }
542                         rerun = 1;
543                         return (STOP);
544                 }
545         }
546         for (nfrags = idesc->id_numfrags; nfrags > 0; blkno++, nfrags--) {
547                 if (anyout && chkrange(blkno, 1)) {
548                         res = SKIP;
549                 } else if (!testbmap(blkno)) {
550                         n_blks++;
551                         setbmap(blkno);
552                 } else {
553                         blkerror(idesc->id_number, "DUP", blkno);
554                         if (dupblk++ >= MAXDUP) {
555                                 pwarn("EXCESSIVE DUP BLKS I=%lu",
556                                         (u_long)idesc->id_number);
557                                 if (preen)
558                                         printf(" (SKIPPING)\n");
559                                 else if (reply("CONTINUE") == 0) {
560                                         ckfini(0);
561                                         exit(EEXIT);
562                                 }
563                                 rerun = 1;
564                                 return (STOP);
565                         }
566                         new = (struct dups *)Malloc(sizeof(struct dups));
567                         if (new == NULL) {
568                                 pfatal("DUP TABLE OVERFLOW.");
569                                 if (reply("CONTINUE") == 0) {
570                                         ckfini(0);
571                                         exit(EEXIT);
572                                 }
573                                 rerun = 1;
574                                 return (STOP);
575                         }
576                         new->dup = blkno;
577                         if (muldup == NULL) {
578                                 duplist = muldup = new;
579                                 new->next = NULL;
580                         } else {
581                                 new->next = muldup->next;
582                                 muldup->next = new;
583                         }
584                         for (dlp = duplist; dlp != muldup; dlp = dlp->next)
585                                 if (dlp->dup == blkno)
586                                         break;
587                         if (dlp == muldup && dlp->dup != blkno)
588                                 muldup = new;
589                 }
590                 /*
591                  * count the number of blocks found in id_entryno
592                  */
593                 idesc->id_entryno++;
594         }
595         if (idesc->id_level == 0 && idesc->id_lballoc < idesc->id_lbn)
596                 idesc->id_lballoc = idesc->id_lbn;
597         return (res);
598 }