Sat May 13 12:13:54 2023 UTC ()
Pull up following revision(s) (requested by chs in ticket #162):

	sbin/fsck_ffs/inode.c: revision 1.74
	sbin/fsck_ffs/utilities.c: revision 1.68
	sbin/fsck_ffs/fsck.h: revision 1.57
	sbin/fsck_ffs/pass4.c: revision 1.30

catch up with sign changes in the fs.h


(martin)
diff -r1.56 -r1.56.2.1 src/sbin/fsck_ffs/fsck.h
diff -r1.73 -r1.73.6.1 src/sbin/fsck_ffs/inode.c
diff -r1.28.38.1 -r1.28.38.2 src/sbin/fsck_ffs/pass4.c
diff -r1.67 -r1.67.2.1 src/sbin/fsck_ffs/utilities.c

cvs diff -r1.56 -r1.56.2.1 src/sbin/fsck_ffs/fsck.h (expand / switch to unified diff)

--- src/sbin/fsck_ffs/fsck.h 2022/11/17 06:40:38 1.56
+++ src/sbin/fsck_ffs/fsck.h 2023/05/13 12:13:54 1.56.2.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: fsck.h,v 1.56 2022/11/17 06:40:38 chs Exp $ */ 1/* $NetBSD: fsck.h,v 1.56.2.1 2023/05/13 12:13:54 martin 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 * 7 *
8 * This software was developed for the FreeBSD Project by Marshall 8 * This software was developed for the FreeBSD Project by Marshall
9 * Kirk McKusick and Network Associates Laboratories, the Security 9 * Kirk McKusick and Network Associates Laboratories, the Security
10 * Research Division of Network Associates, Inc. under DARPA/SPAWAR 10 * Research Division of Network Associates, Inc. under DARPA/SPAWAR
11 * contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS 11 * contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS
12 * research program 12 * research program
13 * 13 *
14 * Redistribution and use in source and binary forms, with or without 14 * Redistribution and use in source and binary forms, with or without
@@ -87,27 +87,27 @@ struct inostat { @@ -87,27 +87,27 @@ struct inostat {
87#define USTATE 01 /* inode not allocated */ 87#define USTATE 01 /* inode not allocated */
88#define FSTATE 02 /* inode is file */ 88#define FSTATE 02 /* inode is file */
89#define DSTATE 03 /* inode is directory */ 89#define DSTATE 03 /* inode is directory */
90#define DFOUND 04 /* directory found during descent */ 90#define DFOUND 04 /* directory found during descent */
91#define DCLEAR 05 /* directory is to be cleared */ 91#define DCLEAR 05 /* directory is to be cleared */
92#define FCLEAR 06 /* file is to be cleared */ 92#define FCLEAR 06 /* file is to be cleared */
93#define DMARK 07 /* used in propagate()'s traversal algorithm */ 93#define DMARK 07 /* used in propagate()'s traversal algorithm */
94 94
95/* 95/*
96 * Inode state information is contained on per cylinder group lists 96 * Inode state information is contained on per cylinder group lists
97 * which are described by the following structure. 97 * which are described by the following structure.
98 */ 98 */
99extern struct inostatlist { 99extern struct inostatlist {
100 long il_numalloced; /* number of inodes allocated in this cg */ 100 size_t il_numalloced; /* number of inodes allocated in this cg */
101 struct inostat *il_stat;/* inostat info for this cylinder group */ 101 struct inostat *il_stat;/* inostat info for this cylinder group */
102} *inostathead; 102} *inostathead;
103 103
104 104
105/* 105/*
106 * buffer cache structure. 106 * buffer cache structure.
107 */ 107 */
108struct bufarea { 108struct bufarea {
109 struct bufarea *b_next; /* free list queue */ 109 struct bufarea *b_next; /* free list queue */
110 struct bufarea *b_prev; /* free list queue */ 110 struct bufarea *b_prev; /* free list queue */
111 daddr_t b_bno; 111 daddr_t b_bno;
112 int b_size; 112 int b_size;
113 int b_errs; 113 int b_errs;

cvs diff -r1.73 -r1.73.6.1 src/sbin/fsck_ffs/inode.c (expand / switch to unified diff)

--- src/sbin/fsck_ffs/inode.c 2020/04/17 09:42:27 1.73
+++ src/sbin/fsck_ffs/inode.c 2023/05/13 12:13:54 1.73.6.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: inode.c,v 1.73 2020/04/17 09:42:27 jdolecek Exp $ */ 1/* $NetBSD: inode.c,v 1.73.6.1 2023/05/13 12:13:54 martin 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
35static char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95"; 35static char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95";
36#else 36#else
37__RCSID("$NetBSD: inode.c,v 1.73 2020/04/17 09:42:27 jdolecek Exp $"); 37__RCSID("$NetBSD: inode.c,v 1.73.6.1 2023/05/13 12:13:54 martin 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/time.h> 42#include <sys/time.h>
43#include <sys/stat.h> 43#include <sys/stat.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/ffs/ffs_extern.h> 48#include <ufs/ffs/ffs_extern.h>
49#include <ufs/ufs/ufs_bswap.h> 49#include <ufs/ufs/ufs_bswap.h>
50 50
@@ -721,31 +721,31 @@ allocino(ino_t request, int type) @@ -721,31 +721,31 @@ allocino(ino_t request, int type)
721 if (request == 0) 721 if (request == 0)
722 request = UFS_ROOTINO; 722 request = UFS_ROOTINO;
723 else if (inoinfo(request)->ino_state != USTATE) 723 else if (inoinfo(request)->ino_state != USTATE)
724 return (0); 724 return (0);
725 for (ino = request; ino < maxino; ino++) { 725 for (ino = request; ino < maxino; ino++) {
726 info = inoinfo(ino); 726 info = inoinfo(ino);
727 if (info->ino_state == USTATE) 727 if (info->ino_state == USTATE)
728 break; 728 break;
729 } 729 }
730 if (ino == maxino) 730 if (ino == maxino)
731 return (0); 731 return (0);
732 cg = ino_to_cg(sblock, ino); 732 cg = ino_to_cg(sblock, ino);
733 /* If necessary, extend the inoinfo array. grow exponentially */ 733 /* If necessary, extend the inoinfo array. grow exponentially */
734 if ((ino % sblock->fs_ipg) >= (uint64_t)inostathead[cg].il_numalloced) { 734 if ((ino % sblock->fs_ipg) >= inostathead[cg].il_numalloced) {
735 unsigned long newalloced, i; 735 size_t newalloced, i;
736 newalloced = MIN(sblock->fs_ipg, 736 newalloced = MIN(sblock->fs_ipg,
737 MAX(2 * inostathead[cg].il_numalloced, 10)); 737 MAX(2 * inostathead[cg].il_numalloced, 10));
738 info = calloc(newalloced, sizeof(struct inostat)); 738 info = calloc(newalloced, sizeof(*info));
739 if (info == NULL) { 739 if (info == NULL) {
740 pwarn("cannot alloc %lu bytes to extend inoinfo\n", 740 pwarn("cannot alloc %lu bytes to extend inoinfo\n",
741 sizeof(struct inostat) * newalloced); 741 sizeof(struct inostat) * newalloced);
742 return 0; 742 return 0;
743 } 743 }
744 memmove(info, inostathead[cg].il_stat, 744 memmove(info, inostathead[cg].il_stat,
745 inostathead[cg].il_numalloced * sizeof(*info)); 745 inostathead[cg].il_numalloced * sizeof(*info));
746 for (i = inostathead[cg].il_numalloced; i < newalloced; i++) { 746 for (i = inostathead[cg].il_numalloced; i < newalloced; i++) {
747 info[i].ino_state = USTATE; 747 info[i].ino_state = USTATE;
748 } 748 }
749 if (inostathead[cg].il_numalloced) 749 if (inostathead[cg].il_numalloced)
750 free(inostathead[cg].il_stat); 750 free(inostathead[cg].il_stat);
751 inostathead[cg].il_stat = info; 751 inostathead[cg].il_stat = info;

cvs diff -r1.28.38.1 -r1.28.38.2 src/sbin/fsck_ffs/pass4.c (expand / switch to unified diff)

--- src/sbin/fsck_ffs/pass4.c 2023/05/13 11:51:14 1.28.38.1
+++ src/sbin/fsck_ffs/pass4.c 2023/05/13 12:13:54 1.28.38.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pass4.c,v 1.28.38.1 2023/05/13 11:51:14 martin Exp $ */ 1/* $NetBSD: pass4.c,v 1.28.38.2 2023/05/13 12:13:54 martin 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
35static char sccsid[] = "@(#)pass4.c 8.4 (Berkeley) 4/28/95"; 35static char sccsid[] = "@(#)pass4.c 8.4 (Berkeley) 4/28/95";
36#else 36#else
37__RCSID("$NetBSD: pass4.c,v 1.28.38.1 2023/05/13 11:51:14 martin Exp $"); 37__RCSID("$NetBSD: pass4.c,v 1.28.38.2 2023/05/13 12:13:54 martin 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/time.h> 42#include <sys/time.h>
43#include <sys/stat.h> 43#include <sys/stat.h>
44 44
45#include <ufs/ufs/ufs_bswap.h> 45#include <ufs/ufs/ufs_bswap.h>
46#include <ufs/ufs/dinode.h> 46#include <ufs/ufs/dinode.h>
47#include <ufs/ffs/fs.h> 47#include <ufs/ffs/fs.h>
48#include <ufs/ffs/ffs_extern.h> 48#include <ufs/ffs/ffs_extern.h>
49 49
50#include <err.h> 50#include <err.h>
@@ -52,27 +52,28 @@ __RCSID("$NetBSD: pass4.c,v 1.28.38.1 20 @@ -52,27 +52,28 @@ __RCSID("$NetBSD: pass4.c,v 1.28.38.1 20
52#include <string.h> 52#include <string.h>
53 53
54#include "fsutil.h" 54#include "fsutil.h"
55#include "fsck.h" 55#include "fsck.h"
56#include "extern.h" 56#include "extern.h"
57 57
58void 58void
59pass4(void) 59pass4(void)
60{ 60{
61 ino_t inumber; 61 ino_t inumber;
62 struct zlncnt *zlnp; 62 struct zlncnt *zlnp;
63 union dinode *dp; 63 union dinode *dp;
64 struct inodesc idesc; 64 struct inodesc idesc;
65 int n, i; 65 int n;
 66 size_t i;
66 uint32_t cg; 67 uint32_t cg;
67 struct inostat *info; 68 struct inostat *info;
68 69
69 memset(&idesc, 0, sizeof(struct inodesc)); 70 memset(&idesc, 0, sizeof(struct inodesc));
70 idesc.id_func = pass4check; 71 idesc.id_func = pass4check;
71 72
72 for (cg = 0; cg < sblock->fs_ncg; cg++) { 73 for (cg = 0; cg < sblock->fs_ncg; cg++) {
73 if (got_siginfo) { 74 if (got_siginfo) {
74 fprintf(stderr, 75 fprintf(stderr,
75 "%s: phase 4: cyl group %d of %d (%d%%)\n", 76 "%s: phase 4: cyl group %d of %d (%d%%)\n",
76 cdevname(), cg, sblock->fs_ncg, 77 cdevname(), cg, sblock->fs_ncg,
77 cg * 100 / sblock->fs_ncg); 78 cg * 100 / sblock->fs_ncg);
78 got_siginfo = 0; 79 got_siginfo = 0;

cvs diff -r1.67 -r1.67.2.1 src/sbin/fsck_ffs/utilities.c (expand / switch to unified diff)

--- src/sbin/fsck_ffs/utilities.c 2022/11/17 06:40:38 1.67
+++ src/sbin/fsck_ffs/utilities.c 2023/05/13 12:13:54 1.67.2.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: utilities.c,v 1.67 2022/11/17 06:40:38 chs Exp $ */ 1/* $NetBSD: utilities.c,v 1.67.2.1 2023/05/13 12:13:54 martin 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
35static char sccsid[] = "@(#)utilities.c 8.6 (Berkeley) 5/19/95"; 35static char sccsid[] = "@(#)utilities.c 8.6 (Berkeley) 5/19/95";
36#else 36#else
37__RCSID("$NetBSD: utilities.c,v 1.67 2022/11/17 06:40:38 chs Exp $"); 37__RCSID("$NetBSD: utilities.c,v 1.67.2.1 2023/05/13 12:13:54 martin 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/time.h> 42#include <sys/time.h>
43 43
44#include <ufs/ufs/dinode.h> 44#include <ufs/ufs/dinode.h>
45#include <ufs/ufs/dir.h> 45#include <ufs/ufs/dir.h>
46#include <ufs/ffs/fs.h> 46#include <ufs/ffs/fs.h>
47#include <ufs/ffs/ffs_extern.h> 47#include <ufs/ffs/ffs_extern.h>
48#include <ufs/ufs/ufs_bswap.h> 48#include <ufs/ufs/ufs_bswap.h>
49#include <ufs/ufs/quota2.h> 49#include <ufs/ufs/quota2.h>
50 50
@@ -580,27 +580,27 @@ void @@ -580,27 +580,27 @@ void
580infohandler(int sig) 580infohandler(int sig)
581{ 581{
582 got_siginfo = 1; 582 got_siginfo = 1;
583} 583}
584 584
585/* 585/*
586 * Look up state information for an inode. 586 * Look up state information for an inode.
587 */ 587 */
588struct inostat * 588struct inostat *
589inoinfo(ino_t inum) 589inoinfo(ino_t inum)
590{ 590{
591 static struct inostat unallocated = { USTATE, 0, 0 }; 591 static struct inostat unallocated = { USTATE, 0, 0 };
592 struct inostatlist *ilp; 592 struct inostatlist *ilp;
593 int iloff; 593 size_t iloff;
594 594
595 if (inum > maxino) 595 if (inum > maxino)
596 errexit("inoinfo: inumber %llu out of range", 596 errexit("inoinfo: inumber %llu out of range",
597 (unsigned long long)inum); 597 (unsigned long long)inum);
598 ilp = &inostathead[inum / sblock->fs_ipg]; 598 ilp = &inostathead[inum / sblock->fs_ipg];
599 iloff = inum % sblock->fs_ipg; 599 iloff = inum % sblock->fs_ipg;
600 if (iloff >= ilp->il_numalloced) 600 if (iloff >= ilp->il_numalloced)
601 return (&unallocated); 601 return (&unallocated);
602 return (&ilp->il_stat[iloff]); 602 return (&ilp->il_stat[iloff]);
603} 603}
604 604
605void 605void
606sb_oldfscompat_read(struct fs *fs, struct fs **fssave) 606sb_oldfscompat_read(struct fs *fs, struct fs **fssave)