pass1.c (50476) | pass1.c (62668) |
---|---|
1/* 2 * Copyright (c) 1980, 1986, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 22 unchanged lines hidden (view full) --- 31 * SUCH DAMAGE. 32 */ 33 34#ifndef lint 35#if 0 36static const char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95"; 37#endif 38static const char rcsid[] = | 1/* 2 * Copyright (c) 1980, 1986, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 22 unchanged lines hidden (view full) --- 31 * SUCH DAMAGE. 32 */ 33 34#ifndef lint 35#if 0 36static const char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95"; 37#endif 38static const char rcsid[] = |
39 "$FreeBSD: head/sbin/fsck_ffs/pass1.c 50476 1999-08-28 00:22:10Z peter $"; | 39 "$FreeBSD: head/sbin/fsck_ffs/pass1.c 62668 2000-07-06 02:03:11Z mckusick $"; |
40#endif /* not lint */ 41 42#include <sys/param.h> | 40#endif /* not lint */ 41 42#include <sys/param.h> |
43#include <sys/stat.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 <string.h> 50 --- 26 unchanged lines hidden (view full) --- 77 i = cgsblock(&sblock, c); 78 for (; i < cgd; i++) 79 setbmap(i); 80 } 81 /* 82 * Find all allocated blocks. 83 */ 84 memset(&idesc, 0, sizeof(struct inodesc)); | 44 45#include <ufs/ufs/dinode.h> 46#include <ufs/ufs/dir.h> 47#include <ufs/ffs/fs.h> 48 49#include <err.h> 50#include <string.h> 51 --- 26 unchanged lines hidden (view full) --- 78 i = cgsblock(&sblock, c); 79 for (; i < cgd; i++) 80 setbmap(i); 81 } 82 /* 83 * Find all allocated blocks. 84 */ 85 memset(&idesc, 0, sizeof(struct inodesc)); |
85 idesc.id_type = ADDR; | |
86 idesc.id_func = pass1check; 87 n_files = n_blks = 0; 88 for (c = 0; c < sblock.fs_ncg; c++) { 89 inumber = c * sblock.fs_ipg; 90 setinodebuf(inumber); 91 inosused = sblock.fs_ipg; 92 /* 93 * If we are using soft updates, then we can trust the --- 207 unchanged lines hidden (view full) --- 301 dp->di_uid = dp->di_ouid; 302 dp->di_ouid = -1; 303 dp->di_gid = dp->di_ogid; 304 dp->di_ogid = -1; 305 inodirty(); 306 } 307 badblk = dupblk = 0; 308 idesc->id_number = inumber; | 86 idesc.id_func = pass1check; 87 n_files = n_blks = 0; 88 for (c = 0; c < sblock.fs_ncg; c++) { 89 inumber = c * sblock.fs_ipg; 90 setinodebuf(inumber); 91 inosused = sblock.fs_ipg; 92 /* 93 * If we are using soft updates, then we can trust the --- 207 unchanged lines hidden (view full) --- 301 dp->di_uid = dp->di_ouid; 302 dp->di_ouid = -1; 303 dp->di_gid = dp->di_ogid; 304 dp->di_ogid = -1; 305 inodirty(); 306 } 307 badblk = dupblk = 0; 308 idesc->id_number = inumber; |
309 if (dp->di_flags & SF_SNAPSHOT) 310 idesc->id_type = SNAP; 311 else 312 idesc->id_type = ADDR; |
|
309 (void)ckinode(dp, idesc); 310 idesc->id_entryno *= btodb(sblock.fs_fsize); 311 if (dp->di_blocks != idesc->id_entryno) { 312 pwarn("INCORRECT BLOCK COUNT I=%lu (%ld should be %ld)", 313 inumber, dp->di_blocks, idesc->id_entryno); 314 if (preen) 315 printf(" (CORRECTED)\n"); 316 else if (reply("CORRECT") == 0) --- 19 unchanged lines hidden (view full) --- 336 register struct inodesc *idesc; 337{ 338 int res = KEEPON; 339 int anyout, nfrags; 340 ufs_daddr_t blkno = idesc->id_blkno; 341 register struct dups *dlp; 342 struct dups *new; 343 | 313 (void)ckinode(dp, idesc); 314 idesc->id_entryno *= btodb(sblock.fs_fsize); 315 if (dp->di_blocks != idesc->id_entryno) { 316 pwarn("INCORRECT BLOCK COUNT I=%lu (%ld should be %ld)", 317 inumber, dp->di_blocks, idesc->id_entryno); 318 if (preen) 319 printf(" (CORRECTED)\n"); 320 else if (reply("CORRECT") == 0) --- 19 unchanged lines hidden (view full) --- 340 register struct inodesc *idesc; 341{ 342 int res = KEEPON; 343 int anyout, nfrags; 344 ufs_daddr_t blkno = idesc->id_blkno; 345 register struct dups *dlp; 346 struct dups *new; 347 |
348 if (idesc->id_type == SNAP) { 349 if (blkno == BLK_NOCOPY) 350 return (KEEPON); 351 if (idesc->id_number == cursnapshot) { 352 if (blkno == blkstofrags(&sblock, idesc->id_lbn)) 353 return (KEEPON); 354 if (blkno == BLK_SNAP) { 355 blkno = blkstofrags(&sblock, idesc->id_lbn); 356 idesc->id_entryno -= idesc->id_numfrags; 357 } 358 } else { 359 if (blkno == BLK_SNAP) 360 return (KEEPON); 361 } 362 } |
|
344 if ((anyout = chkrange(blkno, idesc->id_numfrags)) != 0) { 345 blkerror(idesc->id_number, "BAD", blkno); 346 if (badblk++ >= MAXBAD) { 347 pwarn("EXCESSIVE BAD BLKS I=%lu", 348 idesc->id_number); 349 if (preen) 350 printf(" (SKIPPING)\n"); 351 else if (reply("CONTINUE") == 0) { --- 55 unchanged lines hidden --- | 363 if ((anyout = chkrange(blkno, idesc->id_numfrags)) != 0) { 364 blkerror(idesc->id_number, "BAD", blkno); 365 if (badblk++ >= MAXBAD) { 366 pwarn("EXCESSIVE BAD BLKS I=%lu", 367 idesc->id_number); 368 if (preen) 369 printf(" (SKIPPING)\n"); 370 else if (reply("CONTINUE") == 0) { --- 55 unchanged lines hidden --- |