| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pass1.c,v 1.58 2018/02/13 11:20:08 hannken Exp $ */ | | 1 | /* $NetBSD: pass1.c,v 1.59 2020/04/19 19:37:06 christos Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1980, 1986, 1993 | | 4 | * Copyright (c) 1980, 1986, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -24,27 +24,27 @@ | | | @@ -24,27 +24,27 @@ |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 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 | | 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 | | 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 | | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
29 | * SUCH DAMAGE. | | 29 | * SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include <sys/cdefs.h> | | 32 | #include <sys/cdefs.h> |
33 | #ifndef lint | | 33 | #ifndef lint |
34 | #if 0 | | 34 | #if 0 |
35 | static char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95"; | | 35 | static char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95"; |
36 | #else | | 36 | #else |
37 | __RCSID("$NetBSD: pass1.c,v 1.58 2018/02/13 11:20:08 hannken Exp $"); | | 37 | __RCSID("$NetBSD: pass1.c,v 1.59 2020/04/19 19:37:06 christos Exp $"); |
38 | #endif | | 38 | #endif |
39 | #endif /* not lint */ | | 39 | #endif /* not lint */ |
40 | | | 40 | |
41 | #include <sys/param.h> | | 41 | #include <sys/param.h> |
42 | #include <sys/stat.h> | | 42 | #include <sys/stat.h> |
43 | #include <sys/time.h> | | 43 | #include <sys/time.h> |
44 | | | 44 | |
45 | #include <ufs/ufs/dinode.h> | | 45 | #include <ufs/ufs/dinode.h> |
46 | #include <ufs/ufs/dir.h> | | 46 | #include <ufs/ufs/dir.h> |
47 | #include <ufs/ffs/fs.h> | | 47 | #include <ufs/ffs/fs.h> |
48 | #include <ufs/ufs/ufs_bswap.h> | | 48 | #include <ufs/ufs/ufs_bswap.h> |
49 | #include <ufs/ffs/ffs_extern.h> | | 49 | #include <ufs/ffs/ffs_extern.h> |
50 | | | 50 | |
| @@ -413,47 +413,45 @@ checkinode(ino_t inumber, struct inodesc | | | @@ -413,47 +413,45 @@ checkinode(ino_t inumber, struct inodesc |
413 | dp->dp1.di_gid = iswap32(iswap16(dp->dp1.di_ogid)); | | 413 | dp->dp1.di_gid = iswap32(iswap16(dp->dp1.di_ogid)); |
414 | dp->dp1.di_ogid = iswap16(-1); | | 414 | dp->dp1.di_ogid = iswap16(-1); |
415 | inodirty(); | | 415 | inodirty(); |
416 | } | | 416 | } |
417 | badblk = dupblk = 0; | | 417 | badblk = dupblk = 0; |
418 | idesc->id_number = inumber; | | 418 | idesc->id_number = inumber; |
419 | idesc->id_uid = iswap32(DIP(dp, uid)); | | 419 | idesc->id_uid = iswap32(DIP(dp, uid)); |
420 | idesc->id_gid = iswap32(DIP(dp, gid)); | | 420 | idesc->id_gid = iswap32(DIP(dp, gid)); |
421 | if (iswap32(DIP(dp, flags)) & SF_SNAPSHOT) | | 421 | if (iswap32(DIP(dp, flags)) & SF_SNAPSHOT) |
422 | idesc->id_type = SNAP; | | 422 | idesc->id_type = SNAP; |
423 | else | | 423 | else |
424 | idesc->id_type = ADDR; | | 424 | idesc->id_type = ADDR; |
425 | (void)ckinode(dp, idesc); | | 425 | (void)ckinode(dp, idesc); |
426 | #ifdef notyet | | | |
427 | if (is_ufs2 && iswap32(dp->dp2.di_extsize) > 0) { | | 426 | if (is_ufs2 && iswap32(dp->dp2.di_extsize) > 0) { |
428 | int ret, offset; | | 427 | int ret, offset; |
429 | idesc->id_type = ADDR; | | 428 | idesc->id_type = ADDR; |
430 | ndb = howmany(iswap32(dp->dp2.di_extsize), sblock->fs_bsize); | | 429 | ndb = howmany(iswap32(dp->dp2.di_extsize), sblock->fs_bsize); |
431 | for (j = 0; j < UFS_NXADDR; j++) { | | 430 | for (j = 0; j < UFS_NXADDR; j++) { |
432 | if (--ndb == 0 && | | 431 | if (--ndb == 0 && |
433 | (offset = ffs_blkoff(sblock, iswap32(dp->dp2.di_extsize))) != 0) | | 432 | (offset = ffs_blkoff(sblock, iswap32(dp->dp2.di_extsize))) != 0) |
434 | idesc->id_numfrags = ffs_numfrags(sblock, | | 433 | idesc->id_numfrags = ffs_numfrags(sblock, |
435 | ffs_fragroundup(sblock, offset)); | | 434 | ffs_fragroundup(sblock, offset)); |
436 | else | | 435 | else |
437 | idesc->id_numfrags = sblock->fs_frag; | | 436 | idesc->id_numfrags = sblock->fs_frag; |
438 | if (dp->dp2.di_extb[j] == 0) | | 437 | if (dp->dp2.di_extb[j] == 0) |
439 | continue; | | 438 | continue; |
440 | idesc->id_blkno = iswap64(dp->dp2.di_extb[j]); | | 439 | idesc->id_blkno = iswap64(dp->dp2.di_extb[j]); |
441 | ret = (*idesc->id_func)(idesc); | | 440 | ret = (*idesc->id_func)(idesc); |
442 | if (ret & STOP) | | 441 | if (ret & STOP) |
443 | break; | | 442 | break; |
444 | } | | 443 | } |
445 | } | | 444 | } |
446 | #endif | | | |
447 | idesc->id_entryno *= btodb(sblock->fs_fsize); | | 445 | idesc->id_entryno *= btodb(sblock->fs_fsize); |
448 | if (is_ufs2) | | 446 | if (is_ufs2) |
449 | blocks = iswap64(dp->dp2.di_blocks); | | 447 | blocks = iswap64(dp->dp2.di_blocks); |
450 | else | | 448 | else |
451 | blocks = iswap32(dp->dp1.di_blocks); | | 449 | blocks = iswap32(dp->dp1.di_blocks); |
452 | if (blocks != idesc->id_entryno) { | | 450 | if (blocks != idesc->id_entryno) { |
453 | pwarn("INCORRECT BLOCK COUNT I=%llu (%lld should be %lld)", | | 451 | pwarn("INCORRECT BLOCK COUNT I=%llu (%lld should be %lld)", |
454 | (unsigned long long)inumber, (long long)blocks, | | 452 | (unsigned long long)inumber, (long long)blocks, |
455 | (long long)idesc->id_entryno); | | 453 | (long long)idesc->id_entryno); |
456 | if (preen) | | 454 | if (preen) |
457 | printf(" (CORRECTED)\n"); | | 455 | printf(" (CORRECTED)\n"); |
458 | else if (reply("CORRECT") == 0) { | | 456 | else if (reply("CORRECT") == 0) { |
459 | markclean = 0; | | 457 | markclean = 0; |