CVS commit: src/sbin/fsck_ext2fs
Module Name:src Committed By: mlelstv Date: Sun Mar 31 13:16:52 UTC 2019 Modified Files: src/sbin/fsck_ext2fs: setup.c Log Message: Ignore EXT4 'kbytes written' field when validating alternate superblock. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sbin/fsck_ext2fs/setup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ext2fs/setup.c diff -u src/sbin/fsck_ext2fs/setup.c:1.38 src/sbin/fsck_ext2fs/setup.c:1.39 --- src/sbin/fsck_ext2fs/setup.c:1.38 Sun Mar 31 10:55:58 2019 +++ src/sbin/fsck_ext2fs/setup.c Sun Mar 31 13:16:52 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: setup.c,v 1.38 2019/03/31 10:55:58 mlelstv Exp $ */ +/* $NetBSD: setup.c,v 1.39 2019/03/31 13:16:52 mlelstv Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -58,7 +58,7 @@ #if 0 static char sccsid[] = "@(#)setup.c 8.5 (Berkeley) 11/23/94"; #else -__RCSID("$NetBSD: setup.c,v 1.38 2019/03/31 10:55:58 mlelstv Exp $"); +__RCSID("$NetBSD: setup.c,v 1.39 2019/03/31 13:16:52 mlelstv Exp $"); #endif #endif /* not lint */ @@ -392,6 +392,8 @@ readsb(int listerr) sblk.b_un.b_fs->e2fs_features_rocompat & EXT2F_ROCOMPAT_LARGEFILE; memcpy(asblk.b_un.b_fs->e2fs_fsmnt, sblk.b_un.b_fs->e2fs_fsmnt, sizeof(asblk.b_un.b_fs->e2fs_fsmnt)); + asblk.b_un.b_fs->e4fs_kbytes_written = + sblk.b_un.b_fs->e4fs_kbytes_written; if (sblock.e2fs.e2fs_rev > E2FS_REV0 && ((sblock.e2fs.e2fs_features_incompat & ~EXT2F_INCOMPAT_SUPP_FSCK) || (sblock.e2fs.e2fs_features_rocompat & ~EXT2F_ROCOMPAT_SUPP_FSCK))) {
CVS commit: src/sbin/fsck_ext2fs
Module Name:src Committed By: mlelstv Date: Sun Mar 31 10:55:58 UTC 2019 Modified Files: src/sbin/fsck_ext2fs: Makefile setup.c Log Message: No longer rely on data in disklabel to deduce alternate superblock positions from block size. Instead use the same defaults as newfs_ext2fs. Side effect is that fsck_ext2fs now works with wedges. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sbin/fsck_ext2fs/Makefile cvs rdiff -u -r1.37 -r1.38 src/sbin/fsck_ext2fs/setup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ext2fs/Makefile diff -u src/sbin/fsck_ext2fs/Makefile:1.17 src/sbin/fsck_ext2fs/Makefile:1.18 --- src/sbin/fsck_ext2fs/Makefile:1.17 Tue Mar 4 21:07:22 2014 +++ src/sbin/fsck_ext2fs/Makefile Sun Mar 31 10:55:58 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.17 2014/03/04 21:07:22 joerg Exp $ +# $NetBSD: Makefile,v 1.18 2019/03/31 10:55:58 mlelstv Exp $ # @(#)Makefile 8.1 (Berkeley) 6/5/93 .include @@ -6,7 +6,8 @@ PROG= fsck_ext2fs MAN=fsck_ext2fs.8 SRCS= dir.c inode.c main.c pass1.c pass1b.c pass2.c pass3.c pass4.c \ - pass5.c fsutil.c setup.c utilities.c ext2fs_bswap.c + pass5.c fsutil.c setup.c utilities.c ext2fs_bswap.c \ + partutil.c FSCK= ${NETBSDSRCDIR}/sbin/fsck CPPFLAGS+= -I${FSCK} .PATH: ${NETBSDSRCDIR}/sys/ufs/ext2fs ${FSCK} @@ -17,3 +18,6 @@ CWARNFLAGS.clang+= -Wno-error=tautologic LDADD+=-lutil DPADD+=${LIBUTIL} + +LDADD+=-lprop +DPADD+=${LIBPROP} Index: src/sbin/fsck_ext2fs/setup.c diff -u src/sbin/fsck_ext2fs/setup.c:1.37 src/sbin/fsck_ext2fs/setup.c:1.38 --- src/sbin/fsck_ext2fs/setup.c:1.37 Sun Mar 31 10:52:00 2019 +++ src/sbin/fsck_ext2fs/setup.c Sun Mar 31 10:55:58 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: setup.c,v 1.37 2019/03/31 10:52:00 mlelstv Exp $ */ +/* $NetBSD: setup.c,v 1.38 2019/03/31 10:55:58 mlelstv Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -58,7 +58,7 @@ #if 0 static char sccsid[] = "@(#)setup.c 8.5 (Berkeley) 11/23/94"; #else -__RCSID("$NetBSD: setup.c,v 1.37 2019/03/31 10:52:00 mlelstv Exp $"); +__RCSID("$NetBSD: setup.c,v 1.38 2019/03/31 10:55:58 mlelstv Exp $"); #endif #endif /* not lint */ @@ -70,7 +70,7 @@ __RCSID("$NetBSD: setup.c,v 1.37 2019/03 #include #include #include -#include +#include #include #include @@ -84,19 +84,31 @@ __RCSID("$NetBSD: setup.c,v 1.37 2019/03 #include "fsck.h" #include "extern.h" #include "fsutil.h" +#include "partutil.h" #include "exitvalues.h" void badsb(int, const char *); int calcsb(const char *, int, struct m_ext2fs *); -static struct disklabel *getdisklabel(const char *, int); static int readsb(int); +/* + * For file systems smaller than SMALL_FSSIZE we use the S_DFL_* defaults, + * otherwise if less than MEDIUM_FSSIZE use M_DFL_*, otherwise use + * L_DFL_*. + */ +#define SMALL_FSSIZE((4 * 1024 * 1024) / secsize)/* 4MB */ +#define S_DFL_BSIZE 1024 +#define MEDIUM_FSSIZE ((512 * 1024 * 1024) / secsize) /* 512MB */ +#define M_DFL_BSIZE 1024 +#define L_DFL_BSIZE 4096 + int setup(const char *dev) { long cg, asked, i; long bmapsize; - struct disklabel *lp; + struct disk_geom geo; + struct dkwedge_info dkw; off_t sizepb; struct stat statb; struct m_ext2fs proto; @@ -137,8 +149,8 @@ setup(const char *dev) asblk.b_un.b_buf = malloc(SBSIZE); if (sblk.b_un.b_buf == NULL || asblk.b_un.b_buf == NULL) errexit("cannot allocate space for superblock"); - if ((lp = getdisklabel(NULL, fsreadfd)) != NULL) - dev_bsize = secsize = lp->d_secsize; + if (getdiskinfo(dev, fsreadfd, NULL, &geo, &dkw) != -1) + dev_bsize = secsize = geo.dg_secsize; else dev_bsize = secsize = DEV_BSIZE; /* @@ -488,35 +500,27 @@ badsb(int listerr, const char *s) int calcsb(const char *dev, int devfd, struct m_ext2fs *fs) { - struct disklabel *lp; - struct partition *pp; - char *cp; - - cp = strchr(dev, '\0'); - if (cp-- == dev || - ((*cp < 'a' || *cp > 'a' + MAXPARTITIONS - 1) && !isdigit((unsigned char)*cp))) { + struct dkwedge_info dkw; + struct disk_geom geo; + + if (getdiskinfo(dev, devfd, NULL, &geo, &dkw) == -1) + pfatal("%s: CANNOT FIGURE OUT FILE SYSTEM PARTITION\n", dev); + if (dkw.dkw_parent[0] == '\0') { pfatal("%s: CANNOT FIGURE OUT FILE SYSTEM PARTITION\n", dev); return 0; } - lp = getdisklabel(dev, devfd); - if (isdigit((unsigned char)*cp)) - pp = &lp->d_partitions[0]; - else - pp = &lp->d_partitions[*cp - 'a']; - if (pp->p_fstype != FS_EX2FS) { - pfatal("%s: NOT LABELED AS A EXT2 FILE SYSTEM (%s)\n", - dev, pp->p_fstype < FSMAXTYPES ? - fstypenames[pp->p_fstype] : "unknown"); - return 0; - } - if (pp->p_fsize == 0) { - pfatal("%s: PARTITION SIZE IS 0\n", dev); - return 0; - } + memset(fs, 0, sizeof(struct m_ext2fs)); - fs->e2fs_bsize = pp->p_fsize; - fs->e2fs.e2fs_log_bsize = ilog2(pp->p_fsize / 1024); - fs->e2fs.e2fs_bcount = (pp->p_size * DEV_BSIZE) / fs->e2
CVS commit: src/sbin/fsck_ext2fs
Module Name:src Committed By: mlelstv Date: Sun Mar 31 10:52:00 UTC 2019 Modified Files: src/sbin/fsck_ext2fs: setup.c Log Message: remove debug printfs from last commit. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sbin/fsck_ext2fs/setup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ext2fs/setup.c diff -u src/sbin/fsck_ext2fs/setup.c:1.36 src/sbin/fsck_ext2fs/setup.c:1.37 --- src/sbin/fsck_ext2fs/setup.c:1.36 Sat Mar 30 17:32:40 2019 +++ src/sbin/fsck_ext2fs/setup.c Sun Mar 31 10:52:00 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: setup.c,v 1.36 2019/03/30 17:32:40 mlelstv Exp $ */ +/* $NetBSD: setup.c,v 1.37 2019/03/31 10:52:00 mlelstv Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -58,7 +58,7 @@ #if 0 static char sccsid[] = "@(#)setup.c 8.5 (Berkeley) 11/23/94"; #else -__RCSID("$NetBSD: setup.c,v 1.36 2019/03/30 17:32:40 mlelstv Exp $"); +__RCSID("$NetBSD: setup.c,v 1.37 2019/03/31 10:52:00 mlelstv Exp $"); #endif #endif /* not lint */ @@ -514,10 +514,8 @@ calcsb(const char *dev, int devfd, struc return 0; } memset(fs, 0, sizeof(struct m_ext2fs)); -printf("partition fsize = %d\n", pp->p_fsize); fs->e2fs_bsize = pp->p_fsize; fs->e2fs.e2fs_log_bsize = ilog2(pp->p_fsize / 1024); -printf("log_bsize = %d\n", fs->e2fs.e2fs_log_bsize); fs->e2fs.e2fs_bcount = (pp->p_size * DEV_BSIZE) / fs->e2fs_bsize; fs->e2fs.e2fs_first_dblock = (fs->e2fs.e2fs_log_bsize == 0) ? 1 : 0; fs->e2fs.e2fs_bpg = fs->e2fs_bsize * NBBY;
CVS commit: src/sbin/fsck_ext2fs
Module Name:src Committed By: mlelstv Date: Sat Mar 30 17:32:40 UTC 2019 Modified Files: src/sbin/fsck_ext2fs: setup.c Log Message: Ignore recorded last mount point when validating alternate superblocks. Compute log_bsize correctly. This fixes computation of alternate superblock addresses. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sbin/fsck_ext2fs/setup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ext2fs/setup.c diff -u src/sbin/fsck_ext2fs/setup.c:1.35 src/sbin/fsck_ext2fs/setup.c:1.36 --- src/sbin/fsck_ext2fs/setup.c:1.35 Mon Aug 15 19:13:24 2016 +++ src/sbin/fsck_ext2fs/setup.c Sat Mar 30 17:32:40 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: setup.c,v 1.35 2016/08/15 19:13:24 jdolecek Exp $ */ +/* $NetBSD: setup.c,v 1.36 2019/03/30 17:32:40 mlelstv Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -58,13 +58,14 @@ #if 0 static char sccsid[] = "@(#)setup.c 8.5 (Berkeley) 11/23/94"; #else -__RCSID("$NetBSD: setup.c,v 1.35 2016/08/15 19:13:24 jdolecek Exp $"); +__RCSID("$NetBSD: setup.c,v 1.36 2019/03/30 17:32:40 mlelstv Exp $"); #endif #endif /* not lint */ #define FSTYPENAMES #include #include +#include #include #include #include @@ -320,8 +321,7 @@ readsb(int listerr) sblock.e2fs_ncg = howmany(sblock.e2fs.e2fs_bcount - sblock.e2fs.e2fs_first_dblock, sblock.e2fs.e2fs_bpg); - /* XXX assume hw bsize = 512 */ - sblock.e2fs_fsbtodb = sblock.e2fs.e2fs_log_bsize + 1; + sblock.e2fs_fsbtodb = sblock.e2fs.e2fs_log_bsize + ilog2(1024 / dev_bsize); sblock.e2fs_bsize = 1024 << sblock.e2fs.e2fs_log_bsize; sblock.e2fs_bshift = LOG_MINBSIZE + sblock.e2fs.e2fs_log_bsize; sblock.e2fs_qbmask = sblock.e2fs_bsize - 1; @@ -378,6 +378,8 @@ readsb(int listerr) asblk.b_un.b_fs->e2fs_features_rocompat &= ~EXT2F_ROCOMPAT_LARGEFILE; asblk.b_un.b_fs->e2fs_features_rocompat |= sblk.b_un.b_fs->e2fs_features_rocompat & EXT2F_ROCOMPAT_LARGEFILE; + memcpy(asblk.b_un.b_fs->e2fs_fsmnt, sblk.b_un.b_fs->e2fs_fsmnt, + sizeof(asblk.b_un.b_fs->e2fs_fsmnt)); if (sblock.e2fs.e2fs_rev > E2FS_REV0 && ((sblock.e2fs.e2fs_features_incompat & ~EXT2F_INCOMPAT_SUPP_FSCK) || (sblock.e2fs.e2fs_features_rocompat & ~EXT2F_ROCOMPAT_SUPP_FSCK))) { @@ -492,7 +494,7 @@ calcsb(const char *dev, int devfd, struc cp = strchr(dev, '\0'); if (cp-- == dev || - ((*cp < 'a' || *cp > 'h') && !isdigit((unsigned char)*cp))) { + ((*cp < 'a' || *cp > 'a' + MAXPARTITIONS - 1) && !isdigit((unsigned char)*cp))) { pfatal("%s: CANNOT FIGURE OUT FILE SYSTEM PARTITION\n", dev); return 0; } @@ -512,8 +514,10 @@ calcsb(const char *dev, int devfd, struc return 0; } memset(fs, 0, sizeof(struct m_ext2fs)); +printf("partition fsize = %d\n", pp->p_fsize); fs->e2fs_bsize = pp->p_fsize; - fs->e2fs.e2fs_log_bsize = pp->p_fsize / 1024; + fs->e2fs.e2fs_log_bsize = ilog2(pp->p_fsize / 1024); +printf("log_bsize = %d\n", fs->e2fs.e2fs_log_bsize); fs->e2fs.e2fs_bcount = (pp->p_size * DEV_BSIZE) / fs->e2fs_bsize; fs->e2fs.e2fs_first_dblock = (fs->e2fs.e2fs_log_bsize == 0) ? 1 : 0; fs->e2fs.e2fs_bpg = fs->e2fs_bsize * NBBY;
CVS commit: src/sbin/fsck_ext2fs
Module Name:src Committed By: sevan Date: Mon Aug 27 15:16:49 UTC 2018 Modified Files: src/sbin/fsck_ext2fs: fsck_ext2fs.8 main.c Log Message: Remove references to -c flag which was never included. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sbin/fsck_ext2fs/fsck_ext2fs.8 cvs rdiff -u -r1.37 -r1.38 src/sbin/fsck_ext2fs/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ext2fs/fsck_ext2fs.8 diff -u src/sbin/fsck_ext2fs/fsck_ext2fs.8:1.20 src/sbin/fsck_ext2fs/fsck_ext2fs.8:1.21 --- src/sbin/fsck_ext2fs/fsck_ext2fs.8:1.20 Sun Sep 11 03:56:00 2016 +++ src/sbin/fsck_ext2fs/fsck_ext2fs.8 Mon Aug 27 15:16:49 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: fsck_ext2fs.8,v 1.20 2016/09/11 03:56:00 sevan Exp $ +.\" $NetBSD: fsck_ext2fs.8,v 1.21 2018/08/27 15:16:49 sevan Exp $ .\" .\" Copyright (c) 1980, 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -51,7 +51,7 @@ .\" .\" @(#)fsck.8 8.3 (Berkeley) 11/29/94 .\" -.Dd September 11, 2016 +.Dd August 27, 2018 .Dt FSCK_EXT2FS 8 .Os .Sh NAME @@ -61,7 +61,6 @@ .Nm .Op Fl dfnpUy .Op Fl b Ar block# -.Op Fl c Ar level .Op Fl m Ar mode .Ar filesystem ... .Sh DESCRIPTION Index: src/sbin/fsck_ext2fs/main.c diff -u src/sbin/fsck_ext2fs/main.c:1.37 src/sbin/fsck_ext2fs/main.c:1.38 --- src/sbin/fsck_ext2fs/main.c:1.37 Thu Jun 9 19:57:51 2011 +++ src/sbin/fsck_ext2fs/main.c Mon Aug 27 15:16:49 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.37 2011/06/09 19:57:51 christos Exp $ */ +/* $NetBSD: main.c,v 1.38 2018/08/27 15:16:49 sevan Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -63,7 +63,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/23/94"; #else -__RCSID("$NetBSD: main.c,v 1.37 2011/06/09 19:57:51 christos Exp $"); +__RCSID("$NetBSD: main.c,v 1.38 2018/08/27 15:16:49 sevan Exp $"); #endif #endif /* not lint */ @@ -349,7 +349,7 @@ usage(void) { (void) fprintf(stderr, - "usage: %s [-dfnpUy] [-b block] [-c level] [-m mode] filesystem ...\n", + "usage: %s [-dfnpUy] [-b block] [-m mode] filesystem ...\n", getprogname()); exit(FSCK_EXIT_USAGE); }
CVS commit: src/sbin/fsck_ext2fs
Module Name:src Committed By: christos Date: Fri Apr 21 19:33:56 UTC 2017 Modified Files: src/sbin/fsck_ext2fs: pass1.c Log Message: Fix previous properly (wrong variable was tested) thanks riastradh@ To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sbin/fsck_ext2fs/pass1.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ext2fs/pass1.c diff -u src/sbin/fsck_ext2fs/pass1.c:1.25 src/sbin/fsck_ext2fs/pass1.c:1.26 --- src/sbin/fsck_ext2fs/pass1.c:1.25 Fri Apr 21 13:33:04 2017 +++ src/sbin/fsck_ext2fs/pass1.c Fri Apr 21 15:33:56 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: pass1.c,v 1.25 2017/04/21 17:33:04 christos Exp $ */ +/* $NetBSD: pass1.c,v 1.26 2017/04/21 19:33:56 christos Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -58,7 +58,7 @@ #if 0 static char sccsid[] = "@(#)pass1.c 8.1 (Berkeley) 6/5/93"; #else -__RCSID("$NetBSD: pass1.c,v 1.25 2017/04/21 17:33:04 christos Exp $"); +__RCSID("$NetBSD: pass1.c,v 1.26 2017/04/21 19:33:56 christos Exp $"); #endif #endif /* not lint */ @@ -239,7 +239,7 @@ checkinode(ino_t inumber, struct inodesc * will detect any garbage after symlink string. */ if (inosize(dp) < EXT2_MAXSYMLINKLEN || - EXT2_MAXSYMLINKLEN == 0) { + (EXT2_MAXSYMLINKLEN == 0 && inonblock(dp) == 0)) { ndb = howmany(inosize(dp), sizeof(u_int32_t)); if (ndb > EXT2FS_NDADDR) { j = ndb - EXT2FS_NDADDR;
CVS commit: src/sbin/fsck_ext2fs
Module Name:src Committed By: christos Date: Fri Apr 21 17:33:04 UTC 2017 Modified Files: src/sbin/fsck_ext2fs: pass1.c Log Message: e2di_block is an array; can't be NULL, (clang) To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sbin/fsck_ext2fs/pass1.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ext2fs/pass1.c diff -u src/sbin/fsck_ext2fs/pass1.c:1.24 src/sbin/fsck_ext2fs/pass1.c:1.25 --- src/sbin/fsck_ext2fs/pass1.c:1.24 Wed Jun 19 13:51:25 2013 +++ src/sbin/fsck_ext2fs/pass1.c Fri Apr 21 13:33:04 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: pass1.c,v 1.24 2013/06/19 17:51:25 dholland Exp $ */ +/* $NetBSD: pass1.c,v 1.25 2017/04/21 17:33:04 christos Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -58,7 +58,7 @@ #if 0 static char sccsid[] = "@(#)pass1.c 8.1 (Berkeley) 6/5/93"; #else -__RCSID("$NetBSD: pass1.c,v 1.24 2013/06/19 17:51:25 dholland Exp $"); +__RCSID("$NetBSD: pass1.c,v 1.25 2017/04/21 17:33:04 christos Exp $"); #endif #endif /* not lint */ @@ -239,7 +239,7 @@ checkinode(ino_t inumber, struct inodesc * will detect any garbage after symlink string. */ if (inosize(dp) < EXT2_MAXSYMLINKLEN || - (EXT2_MAXSYMLINKLEN == 0 && dp->e2di_blocks == 0)) { + EXT2_MAXSYMLINKLEN == 0) { ndb = howmany(inosize(dp), sizeof(u_int32_t)); if (ndb > EXT2FS_NDADDR) { j = ndb - EXT2FS_NDADDR;
CVS commit: src/sbin/fsck_ext2fs
Module Name:src Committed By: sevan Date: Sun Sep 11 03:56:00 UTC 2016 Modified Files: src/sbin/fsck_ext2fs: fsck_ext2fs.8 Log Message: Document the author and the version fsck_ext2fs first appeared. Bump date. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sbin/fsck_ext2fs/fsck_ext2fs.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ext2fs/fsck_ext2fs.8 diff -u src/sbin/fsck_ext2fs/fsck_ext2fs.8:1.19 src/sbin/fsck_ext2fs/fsck_ext2fs.8:1.20 --- src/sbin/fsck_ext2fs/fsck_ext2fs.8:1.19 Sun Feb 21 13:26:45 2010 +++ src/sbin/fsck_ext2fs/fsck_ext2fs.8 Sun Sep 11 03:56:00 2016 @@ -1,4 +1,4 @@ -.\" $NetBSD: fsck_ext2fs.8,v 1.19 2010/02/21 13:26:45 wiz Exp $ +.\" $NetBSD: fsck_ext2fs.8,v 1.20 2016/09/11 03:56:00 sevan Exp $ .\" .\" Copyright (c) 1980, 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -51,7 +51,7 @@ .\" .\" @(#)fsck.8 8.3 (Berkeley) 11/29/94 .\" -.Dd October 9, 2008 +.Dd September 11, 2016 .Dt FSCK_EXT2FS 8 .Os .Sh NAME @@ -251,3 +251,12 @@ are fully enumerated and explained in Ap .Xr fsdb 8 , .Xr newfs 8 , .Xr reboot 8 +.Sh HISTORY +A +.Nm +utility appeared in +.Nx 1.3 . +.Sh AUTHORS +.Nm +was written by +.An Manuel Bouyer Aq Mt bou...@netbsd.org .
CVS commit: src/sbin/fsck_ext2fs
Module Name:src Committed By: jdolecek Date: Mon Aug 15 19:13:24 UTC 2016 Modified Files: src/sbin/fsck_ext2fs: setup.c Log Message: more informative debug output for unsupported features To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sbin/fsck_ext2fs/setup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ext2fs/setup.c diff -u src/sbin/fsck_ext2fs/setup.c:1.34 src/sbin/fsck_ext2fs/setup.c:1.35 --- src/sbin/fsck_ext2fs/setup.c:1.34 Mon Aug 15 18:57:06 2016 +++ src/sbin/fsck_ext2fs/setup.c Mon Aug 15 19:13:24 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: setup.c,v 1.34 2016/08/15 18:57:06 jdolecek Exp $ */ +/* $NetBSD: setup.c,v 1.35 2016/08/15 19:13:24 jdolecek Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -58,7 +58,7 @@ #if 0 static char sccsid[] = "@(#)setup.c 8.5 (Berkeley) 11/23/94"; #else -__RCSID("$NetBSD: setup.c,v 1.34 2016/08/15 18:57:06 jdolecek Exp $"); +__RCSID("$NetBSD: setup.c,v 1.35 2016/08/15 19:13:24 jdolecek Exp $"); #endif #endif /* not lint */ @@ -78,6 +78,8 @@ __RCSID("$NetBSD: setup.c,v 1.34 2016/08 #include #include +#include + #include "fsck.h" #include "extern.h" #include "fsutil.h" @@ -385,6 +387,21 @@ readsb(int listerr) sblock.e2fs.e2fs_features_compat, sblock.e2fs.e2fs_features_incompat, sblock.e2fs.e2fs_features_rocompat); + + if ((sblock.e2fs.e2fs_features_rocompat & ~EXT2F_ROCOMPAT_SUPP_FSCK)) { +char buf[512]; + +snprintb(buf, sizeof(buf), EXT2F_ROCOMPAT_BITS, + sblock.e2fs.e2fs_features_rocompat & ~EXT2F_ROCOMPAT_SUPP_FSCK); +printf("unsupported rocompat features: %s\n", buf); + } + if ((sblock.e2fs.e2fs_features_incompat & ~EXT2F_INCOMPAT_SUPP_FSCK)) { +char buf[512]; + +snprintb(buf, sizeof(buf), EXT2F_INCOMPAT_BITS, + sblock.e2fs.e2fs_features_incompat & ~EXT2F_INCOMPAT_SUPP_FSCK); +printf("unsupported incompat features: %s\n", buf); + } } badsb(listerr, "INCOMPATIBLE FEATURE BITS IN SUPER BLOCK"); return 0;
CVS commit: src/sbin/fsck_ext2fs
Module Name:src Committed By: jdolecek Date: Mon Aug 15 18:57:07 UTC 2016 Modified Files: src/sbin/fsck_ext2fs: setup.c Log Message: adjust inode size check to compare against EXT2_REV0_DINODE_SIZE, rather then sizeof(struct ext2fs_dinode), as the structure definition was expanded with the optional fields To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sbin/fsck_ext2fs/setup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ext2fs/setup.c diff -u src/sbin/fsck_ext2fs/setup.c:1.33 src/sbin/fsck_ext2fs/setup.c:1.34 --- src/sbin/fsck_ext2fs/setup.c:1.33 Mon Aug 15 18:42:15 2016 +++ src/sbin/fsck_ext2fs/setup.c Mon Aug 15 18:57:06 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: setup.c,v 1.33 2016/08/15 18:42:15 jdolecek Exp $ */ +/* $NetBSD: setup.c,v 1.34 2016/08/15 18:57:06 jdolecek Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -58,7 +58,7 @@ #if 0 static char sccsid[] = "@(#)setup.c 8.5 (Berkeley) 11/23/94"; #else -__RCSID("$NetBSD: setup.c,v 1.33 2016/08/15 18:42:15 jdolecek Exp $"); +__RCSID("$NetBSD: setup.c,v 1.34 2016/08/15 18:57:06 jdolecek Exp $"); #endif #endif /* not lint */ @@ -306,7 +306,7 @@ readsb(int listerr) } if (sblock.e2fs.e2fs_rev > E2FS_REV0 && (!powerof2(sblock.e2fs.e2fs_inode_size) || - sblock.e2fs.e2fs_inode_size < sizeof(struct ext2fs_dinode) || + sblock.e2fs.e2fs_inode_size < EXT2_REV0_DINODE_SIZE || sblock.e2fs.e2fs_inode_size > (1024 << sblock.e2fs.e2fs_log_bsize))) { badsb(listerr, "BAD INODE_SIZE");
CVS commit: src/sbin/fsck_ext2fs
Module Name:src Committed By: jdolecek Date: Mon Aug 15 18:42:15 UTC 2016 Modified Files: src/sbin/fsck_ext2fs: fsck.h setup.c Log Message: divorce list of features supported by fsck_ext2fs from the kernel; while kernel might support e.g. extents, extra_isize or dir_nlink, fsck could actually have no idea about the features To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sbin/fsck_ext2fs/fsck.h cvs rdiff -u -r1.32 -r1.33 src/sbin/fsck_ext2fs/setup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ext2fs/fsck.h diff -u src/sbin/fsck_ext2fs/fsck.h:1.15 src/sbin/fsck_ext2fs/fsck.h:1.16 --- src/sbin/fsck_ext2fs/fsck.h:1.15 Mon Oct 19 18:41:08 2009 +++ src/sbin/fsck_ext2fs/fsck.h Mon Aug 15 18:42:15 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: fsck.h,v 1.15 2009/10/19 18:41:08 bouyer Exp $ */ +/* $NetBSD: fsck.h,v 1.16 2016/08/15 18:42:15 jdolecek Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -230,6 +230,17 @@ struct ext2fs_dinode zino; #define ALTERED 0x08 #define FOUND 0x10 +/* + * Kernel support for features doesn't imply fsck support + */ +#define EXT2F_COMPAT_SUPP_FSCK 0x00 +#define EXT2F_ROCOMPAT_SUPP_FSCK (EXT2F_ROCOMPAT_SPARSESUPER \ + | EXT2F_ROCOMPAT_LARGEFILE \ + | EXT2F_ROCOMPAT_HUGE_FILE \ + ) +#define EXT2F_INCOMPAT_SUPP_FSCK (EXT2F_INCOMPAT_FTYPE \ + ) + struct ext2fs_dinode *ginode(ino_t); struct inoinfo *getinoinfo(ino_t); void getblk(struct bufarea *, daddr_t, long); Index: src/sbin/fsck_ext2fs/setup.c diff -u src/sbin/fsck_ext2fs/setup.c:1.32 src/sbin/fsck_ext2fs/setup.c:1.33 --- src/sbin/fsck_ext2fs/setup.c:1.32 Thu Dec 4 01:41:37 2014 +++ src/sbin/fsck_ext2fs/setup.c Mon Aug 15 18:42:15 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: setup.c,v 1.32 2014/12/04 01:41:37 christos Exp $ */ +/* $NetBSD: setup.c,v 1.33 2016/08/15 18:42:15 jdolecek Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -58,7 +58,7 @@ #if 0 static char sccsid[] = "@(#)setup.c 8.5 (Berkeley) 11/23/94"; #else -__RCSID("$NetBSD: setup.c,v 1.32 2014/12/04 01:41:37 christos Exp $"); +__RCSID("$NetBSD: setup.c,v 1.33 2016/08/15 18:42:15 jdolecek Exp $"); #endif #endif /* not lint */ @@ -377,8 +377,8 @@ readsb(int listerr) asblk.b_un.b_fs->e2fs_features_rocompat |= sblk.b_un.b_fs->e2fs_features_rocompat & EXT2F_ROCOMPAT_LARGEFILE; if (sblock.e2fs.e2fs_rev > E2FS_REV0 && - ((sblock.e2fs.e2fs_features_incompat & ~EXT2F_INCOMPAT_SUPP) || - (sblock.e2fs.e2fs_features_rocompat & ~EXT2F_ROCOMPAT_SUPP))) { + ((sblock.e2fs.e2fs_features_incompat & ~EXT2F_INCOMPAT_SUPP_FSCK) || + (sblock.e2fs.e2fs_features_rocompat & ~EXT2F_ROCOMPAT_SUPP_FSCK))) { if (debug) { printf("compat 0x%08x, incompat 0x%08x, compat_ro " "0x%08x\n",
CVS commit: src/sbin/fsck_ext2fs
Module Name:src Committed By: christos Date: Thu Dec 4 01:41:37 UTC 2014 Modified Files: src/sbin/fsck_ext2fs: setup.c Log Message: Instead of zerodivide, give a useful error message. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sbin/fsck_ext2fs/setup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ext2fs/setup.c diff -u src/sbin/fsck_ext2fs/setup.c:1.31 src/sbin/fsck_ext2fs/setup.c:1.32 --- src/sbin/fsck_ext2fs/setup.c:1.31 Sat Jun 22 22:06:04 2013 +++ src/sbin/fsck_ext2fs/setup.c Wed Dec 3 20:41:37 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: setup.c,v 1.31 2013/06/23 02:06:04 dholland Exp $ */ +/* $NetBSD: setup.c,v 1.32 2014/12/04 01:41:37 christos Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -58,7 +58,7 @@ #if 0 static char sccsid[] = "@(#)setup.c 8.5 (Berkeley) 11/23/94"; #else -__RCSID("$NetBSD: setup.c,v 1.31 2013/06/23 02:06:04 dholland Exp $"); +__RCSID("$NetBSD: setup.c,v 1.32 2014/12/04 01:41:37 christos Exp $"); #endif #endif /* not lint */ @@ -490,6 +490,10 @@ calcsb(const char *dev, int devfd, struc fstypenames[pp->p_fstype] : "unknown"); return 0; } + if (pp->p_fsize == 0) { + pfatal("%s: PARTITION SIZE IS 0\n", dev); + return 0; + } memset(fs, 0, sizeof(struct m_ext2fs)); fs->e2fs_bsize = pp->p_fsize; fs->e2fs.e2fs_log_bsize = pp->p_fsize / 1024;
CVS commit: src/sbin/fsck_ext2fs
Module Name:src Committed By: joerg Date: Tue Mar 4 21:07:22 UTC 2014 Modified Files: src/sbin/fsck_ext2fs: Makefile Log Message: Make pointer NULL check non-fatal for a bogus condition. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sbin/fsck_ext2fs/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ext2fs/Makefile diff -u src/sbin/fsck_ext2fs/Makefile:1.16 src/sbin/fsck_ext2fs/Makefile:1.17 --- src/sbin/fsck_ext2fs/Makefile:1.16 Sat Aug 6 16:42:41 2011 +++ src/sbin/fsck_ext2fs/Makefile Tue Mar 4 21:07:22 2014 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.16 2011/08/06 16:42:41 dholland Exp $ +# $NetBSD: Makefile,v 1.17 2014/03/04 21:07:22 joerg Exp $ # @(#)Makefile 8.1 (Berkeley) 6/5/93 .include @@ -11,6 +11,8 @@ FSCK= ${NETBSDSRCDIR}/sbin/fsck CPPFLAGS+= -I${FSCK} .PATH: ${NETBSDSRCDIR}/sys/ufs/ext2fs ${FSCK} +CWARNFLAGS.clang+= -Wno-error=tautological-pointer-compare + .include LDADD+=-lutil
CVS commit: src/sbin/fsck_ext2fs
Module Name:src Committed By: jakllsch Date: Sun Nov 25 19:42:14 UTC 2012 Modified Files: src/sbin/fsck_ext2fs: dir.c extern.h inode.c pass1.c Log Message: Catch up to the kernel with respect to Ext2 huge_file feature. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sbin/fsck_ext2fs/dir.c cvs rdiff -u -r1.7 -r1.8 src/sbin/fsck_ext2fs/extern.h cvs rdiff -u -r1.31 -r1.32 src/sbin/fsck_ext2fs/inode.c cvs rdiff -u -r1.21 -r1.22 src/sbin/fsck_ext2fs/pass1.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ext2fs/dir.c diff -u src/sbin/fsck_ext2fs/dir.c:1.24 src/sbin/fsck_ext2fs/dir.c:1.25 --- src/sbin/fsck_ext2fs/dir.c:1.24 Sun Nov 25 19:36:23 2012 +++ src/sbin/fsck_ext2fs/dir.c Sun Nov 25 19:42:14 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.24 2012/11/25 19:36:23 jakllsch Exp $ */ +/* $NetBSD: dir.c,v 1.25 2012/11/25 19:42:14 jakllsch Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -58,7 +58,7 @@ #if 0 static char sccsid[] = "@(#)dir.c 8.5 (Berkeley) 12/8/94"; #else -__RCSID("$NetBSD: dir.c,v 1.24 2012/11/25 19:36:23 jakllsch Exp $"); +__RCSID("$NetBSD: dir.c,v 1.25 2012/11/25 19:42:14 jakllsch Exp $"); #endif #endif /* not lint */ @@ -569,8 +569,7 @@ expanddir(struct ext2fs_dinode *dp, char dp->e2di_blocks[lastbn + 1] = dp->e2di_blocks[lastbn]; dp->e2di_blocks[lastbn] = h2fs32(newblk); inossize(dp, inosize(dp) + sblock.e2fs_bsize); - dp->e2di_nblock = h2fs32(fs2h32(dp->e2di_nblock) + - btodb(sblock.e2fs_bsize)); + inosnblock(dp, inonblock(dp) + btodb(sblock.e2fs_bsize)); bp = getdirblk(fs2h32(dp->e2di_blocks[lastbn + 1]), sblock.e2fs_bsize); if (bp->b_errs) @@ -604,8 +603,7 @@ bad: dp->e2di_blocks[lastbn] = dp->e2di_blocks[lastbn + 1]; dp->e2di_blocks[lastbn + 1] = 0; inossize(dp, inosize(dp) - sblock.e2fs_bsize); - dp->e2di_nblock = h2fs32(fs2h32(dp->e2di_nblock) - - btodb(sblock.e2fs_bsize)); + inosnblock(dp, inonblock(dp) - btodb(sblock.e2fs_bsize)); freeblk(newblk); return (0); } Index: src/sbin/fsck_ext2fs/extern.h diff -u src/sbin/fsck_ext2fs/extern.h:1.7 src/sbin/fsck_ext2fs/extern.h:1.8 --- src/sbin/fsck_ext2fs/extern.h:1.7 Thu Jun 9 19:57:50 2011 +++ src/sbin/fsck_ext2fs/extern.h Sun Nov 25 19:42:14 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.7 2011/06/09 19:57:50 christos Exp $ */ +/* $NetBSD: extern.h,v 1.8 2012/11/25 19:42:14 jakllsch Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -71,3 +71,5 @@ int reply(const char *); void resetinodebuf(void); int setup(const char *); struct ext2fs_dinode * getnextinode(ino_t); +uint64_t inonblock(struct ext2fs_dinode *); +void inosnblock(struct ext2fs_dinode *, uint64_t); Index: src/sbin/fsck_ext2fs/inode.c diff -u src/sbin/fsck_ext2fs/inode.c:1.31 src/sbin/fsck_ext2fs/inode.c:1.32 --- src/sbin/fsck_ext2fs/inode.c:1.31 Thu Feb 4 23:55:42 2010 +++ src/sbin/fsck_ext2fs/inode.c Sun Nov 25 19:42:14 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: inode.c,v 1.31 2010/02/04 23:55:42 christos Exp $ */ +/* $NetBSD: inode.c,v 1.32 2012/11/25 19:42:14 jakllsch Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -58,7 +58,7 @@ #if 0 static char sccsid[] = "@(#)inode.c 8.5 (Berkeley) 2/8/95"; #else -__RCSID("$NetBSD: inode.c,v 1.31 2010/02/04 23:55:42 christos Exp $"); +__RCSID("$NetBSD: inode.c,v 1.32 2012/11/25 19:42:14 jakllsch Exp $"); #endif #endif /* not lint */ @@ -97,6 +97,8 @@ static int iblock(struct inodesc *, long static int setlarge(void); +static int sethuge(void); + static int setlarge(void) { @@ -115,6 +117,24 @@ setlarge(void) return 1; } +static int +sethuge(void) +{ + if (sblock.e2fs.e2fs_rev < E2FS_REV1) { + pfatal("HUGE FILES UNSUPPORTED ON REVISION 0 FILESYSTEMS"); + return 0; + } + if (!(sblock.e2fs.e2fs_features_rocompat & EXT2F_ROCOMPAT_HUGE_FILE)) { + if (preen) + pwarn("SETTING HUGE FILE FEATURE\n"); + else if (!reply("SET HUGE FILE FEATURE")) + return 0; + sblock.e2fs.e2fs_features_rocompat |= EXT2F_ROCOMPAT_HUGE_FILE; + sbdirty(); + } + return 1; +} + u_int64_t inosize(struct ext2fs_dinode *dp) { @@ -707,7 +727,7 @@ allocino(ino_t request, int type) dp->e2di_mtime = dp->e2di_ctime = dp->e2di_atime; dp->e2di_dtime = 0; inossize(dp, sblock.e2fs_bsize); - dp->e2di_nblock = h2fs32(btodb(sblock.e2fs_bsize)); + inosnblock(dp, btodb(sblock.e2fs_bsize)); n_files++; inodirty(); typemap[ino] = E2IFTODT(type); @@ -734,3 +754,59 @@ freeino(ino_t ino) statemap[ino] = USTATE; n_files--; } + +uint64_t +inonblock(struct ext2fs_dinode *dp) +{ + uint64_t nblock; + + /* XXX check for EXT2_HUGE_FILE without EXT2F_ROCOMPAT_HUGE_FILE? */ + + nblock = fs2h32(dp->e2di_nblock); + + if ((sblock.e2fs.e2fs_features_rocompat & EXT2F_ROCOMPAT_HUGE_FILE)) { + nblock |= (uint64_t)fs2h16(dp->e2di_nblock_high) << 32; + if (fs2h32(dp->e2di_flags) & EXT2_HUGE_FILE) { + nblock = fsbtodb(&sblock, nblock); + } + } + + return nblock; +} + +vo
CVS commit: src/sbin/fsck_ext2fs
Module Name:src Committed By: jakllsch Date: Sun Nov 25 19:36:23 UTC 2012 Modified Files: src/sbin/fsck_ext2fs: dir.c Log Message: e2di_nblock is (assuming the huge_file feature is not active) stored in DEV_BSIZE units, not fs block size units. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sbin/fsck_ext2fs/dir.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ext2fs/dir.c diff -u src/sbin/fsck_ext2fs/dir.c:1.23 src/sbin/fsck_ext2fs/dir.c:1.24 --- src/sbin/fsck_ext2fs/dir.c:1.23 Mon Oct 19 18:41:07 2009 +++ src/sbin/fsck_ext2fs/dir.c Sun Nov 25 19:36:23 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.23 2009/10/19 18:41:07 bouyer Exp $ */ +/* $NetBSD: dir.c,v 1.24 2012/11/25 19:36:23 jakllsch Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -58,7 +58,7 @@ #if 0 static char sccsid[] = "@(#)dir.c 8.5 (Berkeley) 12/8/94"; #else -__RCSID("$NetBSD: dir.c,v 1.23 2009/10/19 18:41:07 bouyer Exp $"); +__RCSID("$NetBSD: dir.c,v 1.24 2012/11/25 19:36:23 jakllsch Exp $"); #endif #endif /* not lint */ @@ -569,7 +569,8 @@ expanddir(struct ext2fs_dinode *dp, char dp->e2di_blocks[lastbn + 1] = dp->e2di_blocks[lastbn]; dp->e2di_blocks[lastbn] = h2fs32(newblk); inossize(dp, inosize(dp) + sblock.e2fs_bsize); - dp->e2di_nblock = h2fs32(fs2h32(dp->e2di_nblock) + 1); + dp->e2di_nblock = h2fs32(fs2h32(dp->e2di_nblock) + + btodb(sblock.e2fs_bsize)); bp = getdirblk(fs2h32(dp->e2di_blocks[lastbn + 1]), sblock.e2fs_bsize); if (bp->b_errs) @@ -603,7 +604,8 @@ bad: dp->e2di_blocks[lastbn] = dp->e2di_blocks[lastbn + 1]; dp->e2di_blocks[lastbn + 1] = 0; inossize(dp, inosize(dp) - sblock.e2fs_bsize); - dp->e2di_nblock = h2fs32(fs2h32(dp->e2di_nblock) - 1); + dp->e2di_nblock = h2fs32(fs2h32(dp->e2di_nblock) - + btodb(sblock.e2fs_bsize)); freeblk(newblk); return (0); }
CVS commit: src/sbin/fsck_ext2fs
Module Name:src Committed By: dholland Date: Sun Aug 26 09:33:19 UTC 2012 Modified Files: src/sbin/fsck_ext2fs: pass5.c Log Message: stdlib.h, not malloc.h To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sbin/fsck_ext2fs/pass5.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ext2fs/pass5.c diff -u src/sbin/fsck_ext2fs/pass5.c:1.19 src/sbin/fsck_ext2fs/pass5.c:1.20 --- src/sbin/fsck_ext2fs/pass5.c:1.19 Sat Aug 6 16:42:41 2011 +++ src/sbin/fsck_ext2fs/pass5.c Sun Aug 26 09:33:18 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pass5.c,v 1.19 2011/08/06 16:42:41 dholland Exp $ */ +/* $NetBSD: pass5.c,v 1.20 2012/08/26 09:33:18 dholland Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -58,7 +58,7 @@ #if 0 static char sccsid[] = "@(#)pass5.c 8.6 (Berkeley) 11/30/94"; #else -__RCSID("$NetBSD: pass5.c,v 1.19 2011/08/06 16:42:41 dholland Exp $"); +__RCSID("$NetBSD: pass5.c,v 1.20 2012/08/26 09:33:18 dholland Exp $"); #endif #endif /* not lint */ @@ -69,7 +69,7 @@ __RCSID("$NetBSD: pass5.c,v 1.19 2011/08 #include #include #include -#include +#include #include #include "fsutil.h"
CVS commit: src/sbin/fsck_ext2fs
Module Name:src Committed By: dholland Date: Sat Aug 6 16:42:41 UTC 2011 Modified Files: src/sbin/fsck_ext2fs: Makefile pass5.c Log Message: Avoid -Wno-pointer-sign. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sbin/fsck_ext2fs/Makefile cvs rdiff -u -r1.18 -r1.19 src/sbin/fsck_ext2fs/pass5.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ext2fs/Makefile diff -u src/sbin/fsck_ext2fs/Makefile:1.15 src/sbin/fsck_ext2fs/Makefile:1.16 --- src/sbin/fsck_ext2fs/Makefile:1.15 Mon Jun 20 07:44:00 2011 +++ src/sbin/fsck_ext2fs/Makefile Sat Aug 6 16:42:41 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.15 2011/06/20 07:44:00 mrg Exp $ +# $NetBSD: Makefile,v 1.16 2011/08/06 16:42:41 dholland Exp $ # @(#)Makefile 8.1 (Berkeley) 6/5/93 .include @@ -15,9 +15,3 @@ LDADD+=-lutil DPADD+=${LIBUTIL} - -.if defined(HAVE_GCC) || defined(HAVE_PCC) -.for f in pass5 utilities -COPTS.${f}.c+= -Wno-pointer-sign -.endfor -.endif Index: src/sbin/fsck_ext2fs/pass5.c diff -u src/sbin/fsck_ext2fs/pass5.c:1.18 src/sbin/fsck_ext2fs/pass5.c:1.19 --- src/sbin/fsck_ext2fs/pass5.c:1.18 Sat Aug 6 16:39:40 2011 +++ src/sbin/fsck_ext2fs/pass5.c Sat Aug 6 16:42:41 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pass5.c,v 1.18 2011/08/06 16:39:40 dholland Exp $ */ +/* $NetBSD: pass5.c,v 1.19 2011/08/06 16:42:41 dholland Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -58,7 +58,7 @@ #if 0 static char sccsid[] = "@(#)pass5.c 8.6 (Berkeley) 11/30/94"; #else -__RCSID("$NetBSD: pass5.c,v 1.18 2011/08/06 16:39:40 dholland Exp $"); +__RCSID("$NetBSD: pass5.c,v 1.19 2011/08/06 16:42:41 dholland Exp $"); #endif #endif /* not lint */ @@ -77,7 +77,7 @@ #include "extern.h" -static void print_bmap(u_char *,u_int32_t); +static void print_bmap(char *, uint32_t); void pass5(void) @@ -263,7 +263,7 @@ } static void -print_bmap(u_char *map, u_int32_t size) +print_bmap(char *map, uint32_t size) { uint32_t i, j; @@ -271,7 +271,7 @@ while (i < size) { printf("%04x: ",i); for (j = 0; j < 16; j++, i++) - printf("%02x ", (u_int)map[i] & 0xff); + printf("%02x ", (unsigned char)map[i] & 0xff); printf("\n"); } }
CVS commit: src/sbin/fsck_ext2fs
Module Name:src Committed By: dholland Date: Sat Aug 6 16:39:40 UTC 2011 Modified Files: src/sbin/fsck_ext2fs: pass5.c Log Message: Add static to a private function. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sbin/fsck_ext2fs/pass5.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ext2fs/pass5.c diff -u src/sbin/fsck_ext2fs/pass5.c:1.17 src/sbin/fsck_ext2fs/pass5.c:1.18 --- src/sbin/fsck_ext2fs/pass5.c:1.17 Mon Oct 19 18:41:08 2009 +++ src/sbin/fsck_ext2fs/pass5.c Sat Aug 6 16:39:40 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pass5.c,v 1.17 2009/10/19 18:41:08 bouyer Exp $ */ +/* $NetBSD: pass5.c,v 1.18 2011/08/06 16:39:40 dholland Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -58,7 +58,7 @@ #if 0 static char sccsid[] = "@(#)pass5.c 8.6 (Berkeley) 11/30/94"; #else -__RCSID("$NetBSD: pass5.c,v 1.17 2009/10/19 18:41:08 bouyer Exp $"); +__RCSID("$NetBSD: pass5.c,v 1.18 2011/08/06 16:39:40 dholland Exp $"); #endif #endif /* not lint */ @@ -77,7 +77,7 @@ #include "extern.h" -void print_bmap(u_char *,u_int32_t); +static void print_bmap(u_char *,u_int32_t); void pass5(void) @@ -262,7 +262,7 @@ free(bbmap); } -void +static void print_bmap(u_char *map, u_int32_t size) { uint32_t i, j;
CVS commit: src/sbin/fsck_ext2fs
Module Name:src Committed By: tron Date: Sun Aug 16 13:50:54 UTC 2009 Modified Files: src/sbin/fsck_ext2fs: main.c Log Message: Ignore the "-P" option as intended to make this work with e.g. "fsck_flags=-pP" in "/etc/rc.conf". Patch supplied by Pierre Pronchery in PR bin/41490. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sbin/fsck_ext2fs/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ext2fs/main.c diff -u src/sbin/fsck_ext2fs/main.c:1.32 src/sbin/fsck_ext2fs/main.c:1.33 --- src/sbin/fsck_ext2fs/main.c:1.32 Sun Oct 12 20:49:43 2008 +++ src/sbin/fsck_ext2fs/main.c Sun Aug 16 13:50:54 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.32 2008/10/12 20:49:43 wiz Exp $ */ +/* $NetBSD: main.c,v 1.33 2009/08/16 13:50:54 tron Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -68,7 +68,7 @@ #if 0 static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/23/94"; #else -__RCSID("$NetBSD: main.c,v 1.32 2008/10/12 20:49:43 wiz Exp $"); +__RCSID("$NetBSD: main.c,v 1.33 2009/08/16 13:50:54 tron Exp $"); #endif #endif /* not lint */ @@ -107,7 +107,7 @@ sync(); skipclean = 1; - while ((ch = getopt(argc, argv, "b:dfm:npqUy")) != -1) { + while ((ch = getopt(argc, argv, "b:dfm:npPqUy")) != -1) { switch (ch) { case 'b': skipclean = 0;
CVS commit: src/sbin/fsck_ext2fs
Module Name:src Committed By: lukem Date: Mon Apr 6 12:50:37 UTC 2009 Modified Files: src/sbin/fsck_ext2fs: inode.c pass1.c pass1b.c pass5.c Log Message: fix sign-compare issues To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sbin/fsck_ext2fs/inode.c cvs rdiff -u -r1.18 -r1.19 src/sbin/fsck_ext2fs/pass1.c cvs rdiff -u -r1.6 -r1.7 src/sbin/fsck_ext2fs/pass1b.c cvs rdiff -u -r1.15 -r1.16 src/sbin/fsck_ext2fs/pass5.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ext2fs/inode.c diff -u src/sbin/fsck_ext2fs/inode.c:1.28 src/sbin/fsck_ext2fs/inode.c:1.29 --- src/sbin/fsck_ext2fs/inode.c:1.28 Mon Mar 2 11:31:59 2009 +++ src/sbin/fsck_ext2fs/inode.c Mon Apr 6 12:50:36 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: inode.c,v 1.28 2009/03/02 11:31:59 tsutsui Exp $ */ +/* $NetBSD: inode.c,v 1.29 2009/04/06 12:50:36 lukem Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -63,7 +63,7 @@ #if 0 static char sccsid[] = "@(#)inode.c 8.5 (Berkeley) 2/8/95"; #else -__RCSID("$NetBSD: inode.c,v 1.28 2009/03/02 11:31:59 tsutsui Exp $"); +__RCSID("$NetBSD: inode.c,v 1.29 2009/04/06 12:50:36 lukem Exp $"); #endif #endif /* not lint */ @@ -240,7 +240,8 @@ int32_t *ap; int32_t *aplim; struct bufarea *bp; - int i, n, (*func)(struct inodesc *), nif; + int i, n, (*func)(struct inodesc *); + size_t nif; u_int64_t sizepb; char buf[BUFSIZ]; char pathbuf[MAXPATHLEN + 1]; Index: src/sbin/fsck_ext2fs/pass1.c diff -u src/sbin/fsck_ext2fs/pass1.c:1.18 src/sbin/fsck_ext2fs/pass1.c:1.19 --- src/sbin/fsck_ext2fs/pass1.c:1.18 Mon Nov 24 18:05:25 2008 +++ src/sbin/fsck_ext2fs/pass1.c Mon Apr 6 12:50:37 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pass1.c,v 1.18 2008/11/24 18:05:25 tsutsui Exp $ */ +/* $NetBSD: pass1.c,v 1.19 2009/04/06 12:50:37 lukem Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -63,7 +63,7 @@ #if 0 static char sccsid[] = "@(#)pass1.c 8.1 (Berkeley) 6/5/93"; #else -__RCSID("$NetBSD: pass1.c,v 1.18 2008/11/24 18:05:25 tsutsui Exp $"); +__RCSID("$NetBSD: pass1.c,v 1.19 2009/04/06 12:50:37 lukem Exp $"); #endif #endif /* not lint */ @@ -94,6 +94,7 @@ { ino_t inumber; int c, i; + size_t j; daddr_t dbase; struct inodesc idesc; @@ -144,9 +145,9 @@ n_files = n_blks = 0; resetinodebuf(); for (c = 0; c < sblock.e2fs_ncg; c++) { - for (i = 0; - i < sblock.e2fs.e2fs_ipg && inumber <= sblock.e2fs.e2fs_icount; - i++, inumber++) { + for (j = 0; + j < sblock.e2fs.e2fs_ipg && inumber <= sblock.e2fs.e2fs_icount; + j++, inumber++) { if (inumber < EXT2_ROOTINO) /* XXX */ continue; checkinode(inumber, &idesc); @@ -307,7 +308,7 @@ idesc->id_number = inumber; (void)ckinode(dp, idesc); idesc->id_entryno *= btodb(sblock.e2fs_bsize); - if (fs2h32(dp->e2di_nblock) != idesc->id_entryno) { + if (fs2h32(dp->e2di_nblock) != (uint32_t)idesc->id_entryno) { pwarn("INCORRECT BLOCK COUNT I=%llu (%d should be %d)", (unsigned long long)inumber, fs2h32(dp->e2di_nblock), idesc->id_entryno); Index: src/sbin/fsck_ext2fs/pass1b.c diff -u src/sbin/fsck_ext2fs/pass1b.c:1.6 src/sbin/fsck_ext2fs/pass1b.c:1.7 --- src/sbin/fsck_ext2fs/pass1b.c:1.6 Wed Jan 19 19:31:28 2005 +++ src/sbin/fsck_ext2fs/pass1b.c Mon Apr 6 12:50:37 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pass1b.c,v 1.6 2005/01/19 19:31:28 xtraeme Exp $ */ +/* $NetBSD: pass1b.c,v 1.7 2009/04/06 12:50:37 lukem Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -63,7 +63,7 @@ #if 0 static char sccsid[] = "@(#)pass1b.c 8.1 (Berkeley) 6/5/93"; #else -__RCSID("$NetBSD: pass1b.c,v 1.6 2005/01/19 19:31:28 xtraeme Exp $"); +__RCSID("$NetBSD: pass1b.c,v 1.7 2009/04/06 12:50:37 lukem Exp $"); #endif #endif /* not lint */ @@ -82,7 +82,8 @@ void pass1b(void) { - int c, i; + int c; + uint32_t i; struct ext2fs_dinode *dp; struct inodesc idesc; ino_t inumber; Index: src/sbin/fsck_ext2fs/pass5.c diff -u src/sbin/fsck_ext2fs/pass5.c:1.15 src/sbin/fsck_ext2fs/pass5.c:1.16 --- src/sbin/fsck_ext2fs/pass5.c:1.15 Sun Mar 16 23:17:55 2008 +++ src/sbin/fsck_ext2fs/pass5.c Mon Apr 6 12:50:37 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pass5.c,v 1.15 2008/03/16 23:17:55 lukem Exp $ */ +/* $NetBSD: pass5.c,v 1.16 2009/04/06 12:50:37 lukem Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -63,7 +63,7 @@ #if 0 static char sccsid[] = "@(#)pass5.c 8.6 (Berkeley) 11/30/94"; #else -__RCSID("$NetBSD: pass5.c,v 1.15 2008/03/16 23:17:55 lukem Exp $"); +__RCSID("$NetBSD: pass5.c,v 1.16 2009/04/06 12:50:37 lukem Exp $"); #endif #endif /* not lint */ @@ -72,6 +72,7 @@ #include #include #include +#include #include #include #include @@ -90,7 +91,7 @@ struct m_ext2fs *fs = &sblock; daddr_t dbase, dmax; daddr_t d; - long i, j; + uint32_t i, j; struct inodesc idesc[3]; struct bufarea *ino_bitmap = NULL, *blk_bitmap = NULL; char *ibmap, *bbmap; @@ -167,13 +168,13 @@ break; default: -