Home | History | Annotate | only in /src/sbin/fsck
History log of /src/sbin/fsck
RevisionDateAuthorComments
 1.18 05-Jun-2009  haad Add support for DIOCGDISKINFO to disk like device drivers. Change
partutil.c::getdiskinfo to use it to get disk geometry info.
Use DIOCGWEDGEINFO ioctl to get information about partition size, if disk
driver doesn't support it use old DIOCGDINFO. This patch adds support for
wedge like devices(lvm logical volumes, ZFS zvol partitions) to newfs and
other tools.

No objections on tech-userlevel@.
 1.17 26-Aug-2006  christos Programs that use efun.
 1.16 19-Aug-2004  christos Remove special case for RESCUEDIR
 1.15 23-Aug-2002  lukem if RESCUEDIR is defined, set _PATH_RESCUE to that
 1.14 27-Sep-1996  christos - Rename util.c and util.h to fsutil.c and fsutil.h to avoid conflict with
<util.h>
- Change checkfstab so that the checkit function takes the name of the
mount point too (needed by quotacheck).
- Remove globals debug, verbose and preen
 1.13 23-Sep-1996  christos - added -T fstype:fsoptions per cgd's suggestion.
- handle parallelism in preening here using the original preening code from
fsck_ffs.
- move common code from fsck_ffs and fsck_msdos here.
 1.12 11-Sep-1996  christos New version of filesystem independent fsck(8) program similar to mount(8).
 1.11 05-Apr-1996  cgd check in changes proposed in PR 2006 (approved by J.T.), to rename fsck
to fsck_ffs, so that in the future 'fsck' can be a wrapper than invokes
appropriate filesystem-specific checker programs. For now, the only
user-visible change is that the names have changed in the manual page
and in error messages; fsck and fsck.8 are now links to fsck_ffs and
fsck_ffs.8, until the rest of the transition is complete.
 1.10 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.9 22-Dec-1994  cgd specify man pages the new way.
 1.8 30-Jun-1994  cgd deal with new share/doc strategy
 1.7 25-Jun-1994  cgd update for new doc-make/install strategy
 1.6 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.5 01-Aug-1993  mycroft Add RCS identifiers.
 1.4 28-Apr-1993  cgd i don't think we're in sys.386bsd any more...
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 16-Sep-1997  lukem imported from lite-2
 1.1.1.2 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.2 18-Mar-1998  bouyer This is now in libutil.
 1.1 09-Oct-1997  bouyer Ext2 metadata are always stored on disk in little-endian byte order,
so do byte-swapping on big-endian system. The byte-swap routines are in
fsck/bswap.c because they will also be used in fsck_ffs in future.
Tested on i386 and sparc.
 1.18 05-Apr-1996  cgd check in changes proposed in PR 2006 (approved by J.T.), to rename fsck
to fsck_ffs, so that in the future 'fsck' can be a wrapper than invokes
appropriate filesystem-specific checker programs. For now, the only
user-visible change is that the names have changed in the manual page
and in error messages; fsck and fsck.8 are now links to fsck_ffs and
fsck_ffs.8, until the rest of the transition is complete.
 1.17 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.16 28-Dec-1994  mycroft Mostly sync with CSRG.
 1.15 05-Dec-1994  cgd more cleanups from Jim Jegers, passed over by me.
 1.14 28-Oct-1994  mycroft On a recursive call to fsck_readdir() through getpathname(), don't attempt to
fix a problem that's already being fixed.
 1.13 06-Oct-1994  mycroft dircheck() shouldn't be looking at d_type or d_namlen in blank entries
*at all*. Not only is it wrong, but it causes a serious problem on
little-endian machines, since after -c2 conversion, d_type will often
be > 15.
 1.12 23-Sep-1994  mycroft Remove some more uses of obsolete functions.
 1.11 23-Sep-1994  mycroft Eliminate uses of some obsolete functions.
 1.10 20-Sep-1994  mycroft A correct fix for the byte order problem when reconnecting.
 1.9 29-Jul-1994  mycroft Fix oversight in last patch.
 1.8 28-Jul-1994  mycroft Fix byte-order problem with directory entry creation.
 1.7 08-Jun-1994  mycroft branches: 1.7.2;
Update from 4.4-Lite, with local changes.
 1.6 25-Apr-1994  cgd need <sys/time.h>
 1.5 05-Nov-1993  mycroft Patch from Bruce Evans to deal with file names with NULs in them.
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 16-Sep-1997  lukem imported from lite-2
 1.1.1.2 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.7.2.5 07-Nov-1994  cgd for patch #2
 1.7.2.4 06-Oct-1994  mycroft dircheck() shouldn't be looking at d_type or d_namlen in blank entries
*at all*. Not only is it wrong, but it causes a serious problem on
little-endian machines, since after -c2 conversion, d_type will often
be > 15.
 1.7.2.3 20-Sep-1994  mycroft A correct fix for the byte order problem when reconnecting.
 1.7.2.2 29-Jul-1994  cgd from trunk.
 1.7.2.1 28-Jul-1994  cgd from trunk.
 1.3 21-Jun-2015  dholland add missing rcsid
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 23-Feb-2008  christos branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Make sure that the exit values are always sane, and use symbolic instead
of magic constants. Reviewed by go@
 1.1.8.1 18-May-2008  yamt sync with head.
 1.1.6.3 02-Jun-2008  mjf Sync with HEAD.
 1.1.6.2 03-Apr-2008  mjf Sync with HEAD.
 1.1.6.1 23-Feb-2008  mjf file exitvalues.h was added on branch mjf-devfs2 on 2008-04-03 13:54:10 +0000
 1.1.4.2 24-Mar-2008  keiichi sync with head.
 1.1.4.1 23-Feb-2008  keiichi file exitvalues.h was added on branch keiichi-mipv6 on 2008-03-24 07:14:48 +0000
 1.1.2.2 23-Mar-2008  matt sync with HEAD
 1.1.2.1 23-Feb-2008  matt file exitvalues.h was added on branch matt-armv6 on 2008-03-23 00:44:23 +0000
 1.7 27-Sep-1996  christos - Rename util.c and util.h to fsutil.c and fsutil.h to avoid conflict with
<util.h>
- Change checkfstab so that the checkit function takes the name of the
mount point too (needed by quotacheck).
- Remove globals debug, verbose and preen
 1.6 23-Sep-1996  christos - added -T fstype:fsoptions per cgd's suggestion.
- handle parallelism in preening here using the original preening code from
fsck_ffs.
- move common code from fsck_ffs and fsck_msdos here.
 1.5 05-Apr-1996  cgd check in changes proposed in PR 2006 (approved by J.T.), to rename fsck
to fsck_ffs, so that in the future 'fsck' can be a wrapper than invokes
appropriate filesystem-specific checker programs. For now, the only
user-visible change is that the names have changed in the manual page
and in error messages; fsck and fsck.8 are now links to fsck_ffs and
fsck_ffs.8, until the rest of the transition is complete.
 1.4 12-Apr-1995  mycroft Set the clean flag if necessary. If preening, don't check `clean' file
systems.
 1.3 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.2 06-Dec-1994  cgd adjust; from jimj.
 1.1 05-Dec-1994  cgd more cleanups from Jim Jegers, passed over by me.
 1.41 18-Apr-2020  sevan grammar
 1.40 11-Sep-2016  wiz branches: 1.40.14;
file system police.
 1.39 11-Sep-2016  sevan Document the version fsck first appeared.
Bump date.
 1.38 28-Apr-2011  wiz New sentence, new line. Sort sections.
 1.37 18-Feb-2010  wiz Use Dq for double quotes; remove trailing whitespace.
 1.36 17-Feb-2010  christos Add -x <mountpoint> ``exclude'' option.
 1.35 21-Oct-2009  snj Remove 3rd and 4th clauses in christos' license. OK christos.
 1.34 24-Feb-2008  reed Fix typo.
 1.33 23-Feb-2008  christos Say what our exit values mean (this is not correct right now, because not
all fsck programs have been fixed but it will be soon).
 1.32 23-Feb-2007  rumble branches: 1.32.4; 1.32.10; 1.32.12;
Cross-reference fsck_lfs and fsck_ext2fs.
 1.31 19-Jan-2005  wiz Sort options.
 1.30 13-Jan-2005  christos Add a progress meter to fsck_ffs based on the work by thorpej presented
to the mailing lists last January. This is optional.
 1.29 20-Oct-2003  dsl Add a -q (quiet) option to print nothing for clean filesystems.
Support in fsck_ffs and stub in fsck_xxx.
Push a few more messages through pwarn() instead of printf() to ensure
disk name is shown.
 1.28 25-Feb-2003  wiz .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
 1.27 01-Oct-2002  wiz New sentence, new line. By Robert Elz with minimal fixes.
 1.26 20-Dec-2001  soren Sync getopt() / man page with actual getopt options.
 1.25 16-Nov-2001  wiz Sort SEE ALSO.
 1.24 18-Jun-2001  lukem - Don't attempt to fsck a file system that is mounted read-write unless -f
(force) is given. fsck(8) will return with a zero exit status if "fsck -p"
is used in this circumstance, but all other invocations (e.g, "fsck",
"fsck /filesystem", "fsck -p /filesystem") will return with a non-zero exit
status in this circumstance.
Per discussions with various people including Bill Sommerfeld.
- Use "file system" instead of "filesystem"
 1.23 18-Jun-2001  lukem -d is always compiled in; there's no specific #define to remove it
 1.22 05-Jun-2001  wiz Drop arguments of .Os.
 1.21 03-Apr-2001  wiz Xref exit 3, not 2. Whitespace fixes while I'm here.
 1.20 07-Mar-2001  fair Clarify the description of "preen" mode, per PR 12110
 1.19 10-Mar-1999  erh branches: 1.19.12;
Add missing .El
 1.18 07-Mar-1999  mycroft Clean up SYNOPSIS formatting.
 1.17 09-Nov-1996  perry Fix more cosmetic problems -- changed .Nm fsck to just .Nm (thats the
whole point of the .Nm macro), replaced naked "fsck"s with .Nm's,
fixed another "the the", and .Dq'ed the "no" in the -t
description. Note that the description of -t is still ambiguous --
needs to be cleaned up by someone like Christos that actually knows it
well.
 1.16 09-Nov-1996  lukem fixed typos, from SAITOH Masanobu <msaitoh@spa.is.uec.ac.jp> in [misc/2924]
 1.15 22-Oct-1996  christos - Move some pieces from the fsck_ffs manual page that are appropriate for
fsck now.
- Correct the usage.
 1.14 03-Oct-1996  christos Document -f flag.
 1.13 23-Sep-1996  christos - added -T fstype:fsoptions per cgd's suggestion.
- handle parallelism in preening here using the original preening code from
fsck_ffs.
- move common code from fsck_ffs and fsck_msdos here.
 1.12 11-Sep-1996  christos New version of filesystem independent fsck(8) program similar to mount(8).
 1.11 05-Apr-1996  cgd check in changes proposed in PR 2006 (approved by J.T.), to rename fsck
to fsck_ffs, so that in the future 'fsck' can be a wrapper than invokes
appropriate filesystem-specific checker programs. For now, the only
user-visible change is that the names have changed in the manual page
and in error messages; fsck and fsck.8 are now links to fsck_ffs and
fsck_ffs.8, until the rest of the transition is complete.
 1.10 12-Jul-1995  cgd implement a 'force check' flag, '-f'. I used the SunOS name, but the Digital
semantics. now:
(1) dirty file systems will always be checked; nothing new there.
(2) if not '-f' clean file systems will _NEVER_ be checked,
i.e. they won't be checked even if -p isn't specified. This
allows one to 'fsck -p ; fsck' to preen, then clean up
anything that 'fsck -p' barfs on, without waiting for the
clean file systems to be checked again.
(3) if '-f' clean file systems will ALWAYS be checked. This
allows people to put 'fsck -fp' into /etc/rc on systems
where they're leery of the FS clean flag state, need
the extra reliability, and can afford time 'wasted'
in checks.
The assumption made here is that if a file system is marked clean, it
_IS CLEAN_, really, and shouldn't be checked unless fsck is explicitly
told to (with -f). This should be a valid assumption, but may not be in
the presence of file system bugs. Documentation updated to note '-f'.
 1.9 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.8 28-Dec-1994  mycroft Mostly sync with CSRG.
 1.7 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.6 13-Apr-1994  deraadt typo
 1.5 05-Aug-1993  jtc Updated to -mandoc macros.
 1.4 01-Aug-1993  mycroft Add RCS indentifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 16-Sep-1997  lukem imported from lite-2
 1.1.1.2 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.19.12.1 04-Apr-2001  he Pull up revision 1.21 (requested by wiz):
Some whitespace fixes.
 1.32.12.1 03-Apr-2008  mjf Sync with HEAD.
 1.32.10.1 24-Mar-2008  keiichi sync with head.
 1.32.4.1 23-Mar-2008  matt sync with HEAD
 1.40.14.1 21-Apr-2020  martin Sync with HEAD
 1.53 24-Jan-2023  mlelstv Use opendisk when looking for filesystem type, otherwise the detection
only works if the correct device path is given as an argument.
 1.52 25-Oct-2014  mlelstv branches: 1.52.26;
fix logic that handles command line arguments. Now you can:

fsck /mnt/point
fsck dkX
fsck rdkX
fsck /dev/dkX
fsck /dev/rdkX
fsck NAME=wedge
 1.51 07-Apr-2012  christos branches: 1.51.10;
use getfsspecname()
 1.50 27-Aug-2011  joerg branches: 1.50.2;
Use __dead and __printflike.
 1.49 24-Feb-2010  hannken Dont pass option -x down to fsck_xxxfs.

Hi christos ...
 1.48 17-Feb-2010  christos Add -x <mountpoint> ``exclude'' option.
 1.47 23-Feb-2008  christos Make sure that the exit values are always sane, and use symbolic instead
of magic constants. Reviewed by go@
 1.46 17-Jul-2007  christos branches: 1.46.4; 1.46.10; 1.46.12;
kill MFSNAMELEN
 1.45 13-Dec-2006  christos Sprinkle volatile, instead of using the (void)&foo; which does not work on
gcc 4.
 1.44 16-Oct-2006  christos - add volatile
- static before const
 1.43 26-Aug-2006  christos Programs that use efun.
 1.42 20-Mar-2006  christos Coverity CID 1745: Fix memory leak.
 1.41 27-Jun-2005  christos Move WARNS=3 to the Makefile.inc, and add a little const to the remaining
programs that did not compile before.
 1.40 19-Jan-2005  xtraeme Add 'P' (progress meter flag) to getopt()'s optstring, remove
main() prototype.
 1.39 19-Jan-2005  wiz Sync usage with reality.
 1.38 13-Jan-2005  christos When we run with 'fsck -f -n' we should go over all the filesystems, not
exit on the first one that fails. Add a new flag CHECK_NOFIX so that we
specify -n, we keep going.
 1.37 13-Jan-2005  christos Add a progress meter to fsck_ffs based on the work by thorpej presented
to the mailing lists last January. This is optional.
 1.36 25-Sep-2004  thorpej Try the DIOCGWEDGEINFO ioctl first. If that succeeds (i.e. the block
device is a wedge), use the partition type string from the dkwedge_info
structure to get the file system type.
 1.35 19-Aug-2004  christos Deal with RESCUEDIR
 1.34 21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.33 20-Mar-2004  christos Remove my license.
 1.32 05-Jan-2004  jmmv Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
 1.31 20-Oct-2003  dsl Add a -q (quiet) option to print nothing for clean filesystems.
Support in fsck_ffs and stub in fsck_xxx.
Push a few more messages through pwarn() instead of printf() to ensure
disk name is shown.
 1.30 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22308, verified by myself.
 1.29 23-Aug-2002  lukem if _PATH_RESCUE is defined, try that before _PATH_SBIN & _PATH_USRSBIN
 1.28 20-Dec-2001  soren Sync getopt() / man page with actual getopt options.
 1.27 01-Nov-2001  lukem fix a couple of -Wshadow warnings
 1.26 18-Jun-2001  lukem - Don't attempt to fsck a file system that is mounted read-write unless -f
(force) is given. fsck(8) will return with a zero exit status if "fsck -p"
is used in this circumstance, but all other invocations (e.g, "fsck",
"fsck /filesystem", "fsck -p /filesystem") will return with a non-zero exit
status in this circumstance.
Per discussions with various people including Bill Sommerfeld.
- Use "file system" instead of "filesystem"
 1.25 18-Jun-2001  lukem ansi knf
 1.24 18-Jun-2001  lukem use TAILQ_xxx instead of referencing tqh_xxx elements directly
 1.23 19-Feb-2001  cgd convert to use getprogname()
 1.22 04-Feb-2001  christos remove redundant declarations and nested externs.
 1.21 22-Apr-1999  abs Copy code across from newfs so that 'fsck sd0a' and similar will work.
 1.20 12-Nov-1998  christos Adjust for DKTYPENAME changes.
 1.19 25-Aug-1998  ross from Erik Bertelsen <erik@mediator.uni-c.dk>
{ put } { in } { lots } { of } { these } { to } { shut } { up } { egcs }
 1.18 26-Jul-1998  mycroft const poisoning.
 1.17 26-Jul-1998  mycroft const poisoning.
 1.16 31-Oct-1997  mycroft Rewrite catopt(), as in mount(8).
 1.15 31-Oct-1997  mycroft Format police.
 1.14 29-Oct-1997  christos PR/4384: Brian Grayson: Use real name for exec'ed child's argv[0]
 1.13 13-Oct-1997  bouyer branches: 1.13.2;
The number of fs types is FSMAXTYPES not DKMAXTYPES.
 1.12 14-Sep-1997  lukem * cleanup for WARNS=1
* deprecate register
* prefix hex numbers with '0x'
 1.11 23-Jun-1997  mikel eliminate excess errx() argument
 1.10 20-Jun-1997  christos Move fscknames to <sys/disklabel.h> where they belong logically.
 1.9 07-Dec-1996  christos PR/3002: bug in my previous commit.
 1.8 05-Dec-1996  christos PR/2975: fsck lies to children about their program name
PR/2979: fsck is not smart enough about filesystems not in /etc/fstab
 1.7 03-Oct-1996  christos - Null terminate the argv vector [from ws]
- Dynamically allocate the argv vector
- Add -f global flag [from ws]
 1.6 28-Sep-1996  christos Fix typo.
 1.5 28-Sep-1996  christos Allow for an extra argument needed by quotacheck.
 1.4 27-Sep-1996  christos - Rename util.c and util.h to fsutil.c and fsutil.h to avoid conflict with
<util.h>
- Change checkfstab so that the checkit function takes the name of the
mount point too (needed by quotacheck).
- Remove globals debug, verbose and preen
 1.3 27-Sep-1996  cgd fix up a debugging printf (was given its args in the wrong order), and
allow "ufs" in /etc/fstab to indicate MOUNT_UFS == MOUNT_FFS (for backward
compatibility).
 1.2 23-Sep-1996  christos - added -T fstype:fsoptions per cgd's suggestion.
- handle parallelism in preening here using the original preening code from
fsck_ffs.
- move common code from fsck_ffs and fsck_msdos here.
 1.1 11-Sep-1996  christos New version of filesystem independent fsck(8) program similar to mount(8).
 1.13.2.1 31-Oct-1997  mellon Pull rev 1.14, 1.15 and 1.16 up from trunk (mycroft)
 1.46.12.1 03-Apr-2008  mjf Sync with HEAD.
 1.46.10.1 24-Mar-2008  keiichi sync with head.
 1.46.4.1 23-Mar-2008  matt sync with HEAD
 1.50.2.1 17-Apr-2012  yamt sync with head
 1.51.10.1 11-Nov-2014  martin Pull up following revision(s) (requested by mlelstv in ticket #199):
sbin/newfs/newfs.c: revision 1.112
sbin/fsck/fsck.c: revision 1.52
fix logic that handles command line arguments. Now you can:
fsck /mnt/point
fsck dkX
fsck rdkX
fsck /dev/dkX
fsck /dev/rdkX
fsck NAME=wedge
Support wedge names.
before:
newfs dk1 - formats /dev/rdk1
newfs rdk1 - cannot open /dev/rrdk1
newfs /dev/dk1 - /dev/dk1 is a block-device, use raw device
newfs /dev/rdk1 - formats /dev/rdk1
now:
newfs dk1 - formats /dev/rdk1
newfs rdk1 - cannot open /dev/rrdk1
newfs /dev/dk1 - formats /dev/rdk1 (*)
newfs /dev/rdk1 - formats /dev/rdk1
newfs NAME=wedge - formats /dev/rdk1
(*) getfsspecname() returns the block device which must be translated.
Passing a block device manually cannot be distinguished from this case.
 1.52.26.1 22-Feb-2023  martin Pull up following revision(s) (requested by mlelstv in ticket #93):

sbin/fsck/fsck.c: revision 1.53

Use opendisk when looking for filesystem type, otherwise the detection
only works if the correct device path is given as an argument.
 1.11 05-Apr-1996  cgd check in changes proposed in PR 2006 (approved by J.T.), to rename fsck
to fsck_ffs, so that in the future 'fsck' can be a wrapper than invokes
appropriate filesystem-specific checker programs. For now, the only
user-visible change is that the names have changed in the manual page
and in error messages; fsck and fsck.8 are now links to fsck_ffs and
fsck_ffs.8, until the rest of the transition is complete.
 1.10 12-Apr-1995  mycroft Set the clean flag if necessary. If preening, don't check `clean' file
systems.
 1.9 21-Mar-1995  cgd type sizes
 1.8 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.7 05-Dec-1994  cgd more cleanups from Jim Jegers, passed over by me.
 1.6 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.5 02-May-1994  pk Prototype some things.
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 16-Sep-1997  lukem imported from lite-2
 1.1.1.2 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.27 03-Apr-2020  joerg Avoid common symbols for fsck_lfs.
 1.26 21-Jun-2015  dholland branches: 1.26.16;
Add used-by comments on source files that are .PATH'd in from elsewhere.
 1.25 21-Jun-2015  dholland global variables should be declared extern.
 1.24 13-Jan-2013  mlelstv Support symlinks to a block device to resolve the name of the
corresponding raw device.
 1.23 08-Apr-2012  christos branches: 1.23.2;
Don't re-use the same buffer that we pass in for newname in the cooked->raw
conversion. Better variable names.
 1.22 07-Apr-2012  christos factor out rawname() from dump, fsck, savecore.
 1.21 07-Apr-2012  christos use getfsspecname()
 1.20 09-Jun-2011  christos branches: 1.20.2;
share more code.
 1.19 04-Feb-2010  christos branches: 1.19.4;
Centralize time printing and deal with ctime possibly returning NULL.
 1.18 16-Mar-2008  lukem errexit() now provides the trailing \n (since fsck_ffs assumed that
from a conversion from err(3)), so "make it so".
 1.17 23-Feb-2008  christos Make sure that the exit values are always sane, and use symbolic instead
of magic constants. Reviewed by go@
 1.16 26-Aug-2006  christos branches: 1.16.8; 1.16.16; 1.16.18;
Programs that use efun.
 1.15 05-Jun-2006  christos s/perror/perr/ so that we can make it varyadic. Overloading stdio's perror()
sneaky.
 1.14 20-Oct-2003  dsl Add a -q (quiet) option to print nothing for clean filesystems.
Support in fsck_ffs and stub in fsck_xxx.
Push a few more messages through pwarn() instead of printf() to ensure
disk name is shown.
 1.13 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22308, verified by myself.
 1.12 28-Mar-2003  perseant Make vmsg non-static, so it can be used directly by fsck_lfs.
 1.11 09-Nov-2001  lukem use MAXPATHLEN instead of 32 as the size of the rawbuf
 1.10 18-Jun-2001  lukem ansi knf
 1.9 19-Feb-2001  cgd convert to use getprogname()
 1.8 10-Oct-2000  is Format string cleanups by Bill Sommerfeld.
 1.7 30-Jul-1998  thorpej branches: 1.7.2; 1.7.12;
Cast pointer diffs to int for use in printf format width specifiers.
 1.6 26-Jul-1998  mycroft const poisoning.
 1.5 31-Oct-1997  mycroft Format police.
 1.4 14-Sep-1997  lukem branches: 1.4.2;
* cleanup for WARNS=1
* deprecate register
* prefix hex numbers with '0x'
 1.3 22-Oct-1996  christos Fix varyadic non ansi functions.
 1.2 03-Oct-1996  christos - Null terminate the argv vector [from ws]
- Dynamically allocate the argv vector
- Add -f global flag [from ws]
 1.1 27-Sep-1996  christos - Rename util.c and util.h to fsutil.c and fsutil.h to avoid conflict with
<util.h>
- Change checkfstab so that the checkit function takes the name of the
mount point too (needed by quotacheck).
- Remove globals debug, verbose and preen
 1.4.2.1 31-Oct-1997  mellon Pull rev 1.5 up from trunk (mycroft)
 1.7.12.1 18-Oct-2000  tv Pullup sbin string format fixes [is].
See "cvs log" for explicit revision numbers per file, from sommerfeld.
 1.7.2.1 10-Oct-2000  he Pull up revision 1.8 (requested by is):
Format string cleanup.
 1.16.18.1 03-Apr-2008  mjf Sync with HEAD.
 1.16.16.1 24-Mar-2008  keiichi sync with head.
 1.16.8.1 23-Mar-2008  matt sync with HEAD
 1.19.4.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.20.2.2 23-Jan-2013  yamt sync with head
 1.20.2.1 17-Apr-2012  yamt sync with head
 1.23.2.1 25-Feb-2013  tls resync with head
 1.26.16.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.21 03-Apr-2020  joerg Avoid common symbols for fsck_lfs.
 1.20 21-Jun-2015  dholland branches: 1.20.16;
global variables should be declared extern.
 1.19 07-Apr-2012  christos factor out rawname() from dump, fsck, savecore.
 1.18 27-Aug-2011  joerg branches: 1.18.2;
Use __dead and __printflike.
 1.17 09-Jun-2011  christos fix compilation.
 1.16 09-Jun-2011  christos share more code.
 1.15 04-Feb-2010  christos branches: 1.15.4;
Centralize time printing and deal with ctime possibly returning NULL.
 1.14 21-Oct-2009  snj Remove 3rd and 4th clauses in christos' license. OK christos.
 1.13 15-Sep-2007  ragge __attribute -> __attribute__.
 1.12 26-Aug-2006  christos branches: 1.12.8;
Programs that use efun.
 1.11 05-Jun-2006  christos s/perror/perr/ so that we can make it varyadic. Overloading stdio's perror()
sneaky.
 1.10 13-Jan-2005  christos When we run with 'fsck -f -n' we should go over all the filesystems, not
exit on the first one that fails. Add a new flag CHECK_NOFIX so that we
specify -n, we keep going.
 1.9 13-Jan-2005  christos Add a progress meter to fsck_ffs based on the work by thorpej presented
to the mailing lists last January. This is optional.
 1.8 28-Mar-2003  perseant Make vmsg non-static, so it can be used directly by fsck_lfs.
 1.7 18-Jun-2001  lukem - Don't attempt to fsck a file system that is mounted read-write unless -f
(force) is given. fsck(8) will return with a zero exit status if "fsck -p"
is used in this circumstance, but all other invocations (e.g, "fsck",
"fsck /filesystem", "fsck -p /filesystem") will return with a non-zero exit
status in this circumstance.
Per discussions with various people including Bill Sommerfeld.
- Use "file system" instead of "filesystem"
 1.6 18-Jun-2001  lukem ansi knf
 1.5 04-Feb-2001  christos remove redundant declarations and nested externs.
 1.4 26-Jul-1998  mycroft const poisoning.
 1.3 03-Oct-1996  christos - Null terminate the argv vector [from ws]
- Dynamically allocate the argv vector
- Add -f global flag [from ws]
 1.2 28-Sep-1996  christos Allow for an extra argument needed by quotacheck.
 1.1 27-Sep-1996  christos - Rename util.c and util.h to fsutil.c and fsutil.h to avoid conflict with
<util.h>
- Change checkfstab so that the checkit function takes the name of the
mount point too (needed by quotacheck).
- Remove globals debug, verbose and preen
 1.12.8.1 06-Nov-2007  matt sync with HEAD
 1.15.4.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.18.2.1 17-Apr-2012  yamt sync with head
 1.20.16.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.18 05-Apr-1996  cgd check in changes proposed in PR 2006 (approved by J.T.), to rename fsck
to fsck_ffs, so that in the future 'fsck' can be a wrapper than invokes
appropriate filesystem-specific checker programs. For now, the only
user-visible change is that the names have changed in the manual page
and in error messages; fsck and fsck.8 are now links to fsck_ffs and
fsck_ffs.8, until the rest of the transition is complete.
 1.17 17-Dec-1995  thorpej Squish some type bugs pointed out by Jonathan Stone.
 1.16 14-Dec-1995  thorpej Make this compile with -Werror.
 1.15 07-Jun-1995  cgd typeof(timeval.tv_sec) != time_t
 1.14 20-Mar-1995  mycroft Make sure to recreate the `..' entry in the root directory if missing.
 1.13 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.12 05-Dec-1994  cgd more cleanups from Jim Jegers, passed over by me.
 1.11 23-Sep-1994  mycroft Eliminate uses of some obsolete functions.
 1.10 14-Jun-1994  mycroft Fix compatibility with old fastlinks.
 1.9 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.8 02-May-1994  pk Prototype some things.
 1.7 25-Apr-1994  cgd need <sys/time.h>
 1.6 18-Apr-1994  cgd kill some code if SMALL is defined...
 1.5 01-Aug-1993  mycroft Add RCS identifiers.
 1.4 13-Jun-1993  mycroft Add support for fast symlinks.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 16-Sep-1997  lukem imported from lite-2
 1.1.1.2 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.20 05-Apr-1996  cgd this file has moved; not properly checked in in previous commit.
 1.19 28-Nov-1995  jtc merge in changes from 1.1 release branch
 1.18 12-Jul-1995  cgd branches: 1.18.2;
recognize 'ffs' and 'ufs' as meaning the same thing.
 1.17 12-Jul-1995  cgd implement a 'force check' flag, '-f'. I used the SunOS name, but the Digital
semantics. now:
(1) dirty file systems will always be checked; nothing new there.
(2) if not '-f' clean file systems will _NEVER_ be checked,
i.e. they won't be checked even if -p isn't specified. This
allows one to 'fsck -p ; fsck' to preen, then clean up
anything that 'fsck -p' barfs on, without waiting for the
clean file systems to be checked again.
(3) if '-f' clean file systems will ALWAYS be checked. This
allows people to put 'fsck -fp' into /etc/rc on systems
where they're leery of the FS clean flag state, need
the extra reliability, and can afford time 'wasted'
in checks.
The assumption made here is that if a file system is marked clean, it
_IS CLEAN_, really, and shouldn't be checked unless fsck is explicitly
told to (with -f). This should be a valid assumption, but may not be in
the presence of file system bugs. Documentation updated to note '-f'.
 1.16 12-Apr-1995  mycroft Set the clean flag if necessary. If preening, don't check `clean' file
systems.
 1.15 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.14 05-Dec-1994  cgd more cleanups from Jim Jegers, passed over by me.
 1.13 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.12 25-Apr-1994  cgd need <sys/time.h>
 1.11 06-Apr-1994  cgd kill the evil U word! from Mike Long <mike.long@analog.com>
 1.10 15-Oct-1993  cgd try again to keep it from rebooting endlessly
 1.9 06-Oct-1993  cgd set the 'clean' flag sometimes, but ignore it when deciding to clean
or not. this allows you to use this fsck and... reboot your system;
otherwise it would inf-loop rebooting and marking the FS clean,
which would then mark the fs modified, cause a reboot, etc.
 1.8 03-Oct-1993  mycroft #if 0 the fs_clean check for now.
 1.7 01-Oct-1993  mycroft Don't set clean flag if -n.
 1.6 01-Oct-1993  mycroft Initial count for fs_state is `FS_CLEANFREQ'.
 1.5 01-Oct-1993  mycroft Skip check if filesystem is marked clean and isn't too dusty, only with -p.
Set clean flag after checking a filesystem.
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 16-Sep-1997  lukem imported from lite-2
 1.1.1.2 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.18.2.1 01-Nov-1995  jtc complete ufs -> ffs change (From John Kohl; PR #1403)
 1.19 13-Apr-2025  jakllsch Add physical sector and alignment info to struct disk_geom and the
geometry plist, and handle in partutil.

Bump version for disk_geom addition.

Collect DIOCGSECTORALIGN handling into one place.
 1.18 02-Jan-2023  hannken branches: 1.18.2;
Change getdiskinfo() to no longer infer the partition from the device name.
Since 2016-06-16 we create disk devices "<type><<unit>" as an alias
for "<type><<unit><part>" where "<part>" is the raw partition.
These devices are treated as invalid partitions and a zero geometry
is returned.

Take the partition from "st_rdev" instead.

Fix for PR kern/57134: st_size of stat on vnd raw partition sometimes
is 0, causing newfs to fail
 1.17 28-Sep-2019  bad branches: 1.17.8;
initialize disc_dict to NULL.

otherwise, if DIOCGDISKINFO returns an error != ENXIO getdiskinfo() later
tries to prop_object_release() stack garbage.

found by rumpctrl tests using clang-7.
 1.16 18-Aug-2019  martin Properly release the disk properties dictionary we received via
ioctl.
Detected by leak sanitizer when building with MKSANITIZER=yes.
 1.15 03-Jun-2015  martin branches: 1.15.16; 1.15.18;
Make querying the disk geometry fail silently if called for a non-exitent
disk.
XXX: DIOCGDISKINFO returns strange error codes
 1.14 29-Dec-2014  christos abort earlier.
 1.13 29-Dec-2014  christos Provide a simple getdisksize() api for gpt(8).
 1.12 13-Apr-2013  jakllsch branches: 1.12.6;
Make getdiskinfo() always return correct dkwedge_info for the raw partition.

A real disk's raw partition does not implement DIOCGWEDGEINFO, but does
implement DIOCGDINFO. This was resulting in the returned wedge information
containing 32-bit-clamped values for size of the raw partition, with no
indication thereof.
 1.11 13-Nov-2011  christos branches: 1.11.6;
use getfstypename
 1.10 06-Mar-2010  christos branches: 1.10.6;
- use warn/err properly
- wrap long lines
 1.9 16-Jul-2009  dyoung Callers expect getdiskinfo() to return -1 on error, so do that.

Simplify getdiskinfo() a bit while I am here: don't save error
codes that we will never refer to again.
 1.8 14-Jun-2009  haad Remove bogus warn, which was printed when DIOCGDISKINFO failed.
 1.7 06-Jun-2009  haad Add support for devices which do not support DIOCGDISKINFO ioctl yet. This
change will restore fsck/newfs on vnd device.
 1.6 06-Jun-2009  haad Remove debug printfs.
 1.5 05-Jun-2009  haad Add support for DIOCGDISKINFO to disk like device drivers. Change
partutil.c::getdiskinfo to use it to get disk geometry info.
Use DIOCGWEDGEINFO ioctl to get information about partition size, if disk
driver doesn't support it use old DIOCGDINFO. This patch adds support for
wedge like devices(lvm logical volumes, ZFS zvol partitions) to newfs and
other tools.

No objections on tech-userlevel@.
 1.4 11-Apr-2009  lukem fix sign-compare issues
 1.3 28-Apr-2008  martin branches: 1.3.6;
Remove clause 3 and 4 from TNF licenses
 1.2 27-Aug-2006  christos branches: 1.2.18; 1.2.20;
add a const
 1.1 26-Aug-2006  christos - make preen recognize wedges and insert their parent disks in the disk list
so that we don't run multiple fsck's on the same spindle at the same time!
- Add some partition getting utilities that are wedge aware (soon to be able
to use the native geometry ioctl), so that we can fsck wedges.
 1.2.20.1 18-May-2008  yamt sync with head.
 1.2.18.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.6.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.10.6.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.10.6.1 17-Apr-2012  yamt sync with head
 1.11.6.1 23-Jun-2013  tls resync from head
 1.12.6.1 25-May-2015  msaitoh Pull up following revision(s) (requested by jnemeth in ticket #793):
sbin/fsck/partutil.c: revision 1.13
sbin/fsck/partutil.h: revision 1.3
Provide a simple getdisksize() api for gpt(8).
 1.15.18.3 03-Jan-2023  martin Pull up following revision(s) (requested by hannken in ticket #1560):

sbin/fsck/partutil.c: revision 1.18

Change getdiskinfo() to no longer infer the partition from the device name.

Since 2016-06-16 we create disk devices "<type><<unit>" as an alias
for "<type><<unit><part>" where "<part>" is the raw partition.
These devices are treated as invalid partitions and a zero geometry
is returned.

Take the partition from "st_rdev" instead.

Fix for PR kern/57134: st_size of stat on vnd raw partition sometimes
is 0, causing newfs to fail
 1.15.18.2 09-Jan-2021  martin Pull up following revision(s) (requested by tsutsui in ticket #1184):

sbin/fsck/partutil.c: revision 1.17

initialize disk_dict to NULL.

otherwise, if DIOCGDISKINFO returns an error != ENXIO getdiskinfo() later
tries to prop_object_release() stack garbage.

found by rumpctrl tests using clang-7.
 1.15.18.1 18-Aug-2019  msaitoh Pull up following revision(s) (requested by martin in ticket #88):
sbin/fsck/partutil.c: revision 1.16
Properly release the disk properties dictionary we received via
ioctl.
Detected by leak sanitizer when building with MKSANITIZER=yes.
 1.15.16.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.17.8.1 03-Jan-2023  martin Pull up following revision(s) (requested by hannken in ticket #32):

sbin/fsck/partutil.c: revision 1.18

Change getdiskinfo() to no longer infer the partition from the device name.

Since 2016-06-16 we create disk devices "<type><<unit>" as an alias
for "<type><<unit><part>" where "<part>" is the raw partition.
These devices are treated as invalid partitions and a zero geometry
is returned.

Take the partition from "st_rdev" instead.

Fix for PR kern/57134: st_size of stat on vnd raw partition sometimes
is 0, causing newfs to fail
 1.18.2.1 02-Aug-2025  perseant Sync with HEAD
 1.3 29-Dec-2014  christos Provide a simple getdisksize() api for gpt(8).
 1.2 28-Apr-2008  martin branches: 1.2.40;
Remove clause 3 and 4 from TNF licenses
 1.1 26-Aug-2006  christos branches: 1.1.18; 1.1.20;
- make preen recognize wedges and insert their parent disks in the disk list
so that we don't run multiple fsck's on the same spindle at the same time!
- Add some partition getting utilities that are wedge aware (soon to be able
to use the native geometry ioctl), so that we can fsck wedges.
 1.1.20.1 18-May-2008  yamt sync with head.
 1.1.18.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.40.1 25-May-2015  msaitoh Pull up following revision(s) (requested by jnemeth in ticket #793):
sbin/fsck/partutil.c: revision 1.13
sbin/fsck/partutil.h: revision 1.3
Provide a simple getdisksize() api for gpt(8).
 1.15 05-Apr-1996  cgd check in changes proposed in PR 2006 (approved by J.T.), to rename fsck
to fsck_ffs, so that in the future 'fsck' can be a wrapper than invokes
appropriate filesystem-specific checker programs. For now, the only
user-visible change is that the names have changed in the manual page
and in error messages; fsck and fsck.8 are now links to fsck_ffs and
fsck_ffs.8, until the rest of the transition is complete.
 1.14 18-Jan-1996  mycroft Use fs_csaddr to find the cg summary area. From der Mouse, PR 1366.
 1.13 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.12 05-Dec-1994  cgd more cleanups from Jim Jegers, passed over by me.
 1.11 23-Sep-1994  mycroft Remove some more uses of obsolete functions.
 1.10 23-Sep-1994  mycroft Eliminate uses of some obsolete functions.
 1.9 29-Jun-1994  ws Reads on raw disks are only guarranteed in multiples of the block size
 1.8 14-Jun-1994  mycroft Fix compatibility with old fastlinks.
 1.7 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.6 25-Apr-1994  cgd need <sys/time.h>
 1.5 01-Aug-1993  mycroft Add RCS identifiers.
 1.4 13-Jun-1993  mycroft Add support for fast symlinks.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 16-Sep-1997  lukem imported from lite-2
 1.1.1.2 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.10 05-Apr-1996  cgd check in changes proposed in PR 2006 (approved by J.T.), to rename fsck
to fsck_ffs, so that in the future 'fsck' can be a wrapper than invokes
appropriate filesystem-specific checker programs. For now, the only
user-visible change is that the names have changed in the manual page
and in error messages; fsck and fsck.8 are now links to fsck_ffs and
fsck_ffs.8, until the rest of the transition is complete.
 1.9 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.8 05-Dec-1994  cgd more cleanups from Jim Jegers, passed over by me.
 1.7 23-Sep-1994  mycroft Eliminate uses of some obsolete functions.
 1.6 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.5 25-Apr-1994  cgd need <sys/time.h>
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 16-Sep-1997  lukem imported from lite-2
 1.1.1.2 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.13 05-Apr-1996  cgd check in changes proposed in PR 2006 (approved by J.T.), to rename fsck
to fsck_ffs, so that in the future 'fsck' can be a wrapper than invokes
appropriate filesystem-specific checker programs. For now, the only
user-visible change is that the names have changed in the manual page
and in error messages; fsck and fsck.8 are now links to fsck_ffs and
fsck_ffs.8, until the rest of the transition is complete.
 1.12 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.11 28-Dec-1994  mycroft Change some spacing to match Kirk's view of the world.
 1.10 28-Dec-1994  mycroft Mostly sync with CSRG.
 1.9 05-Dec-1994  cgd more cleanups from Jim Jegers, passed over by me.
 1.8 28-Oct-1994  mycroft Get the byte order right when creating `.' and `..' entries.
 1.7 23-Sep-1994  mycroft Eliminate uses of some obsolete functions.
 1.6 08-Jun-1994  mycroft branches: 1.6.2;
Update from 4.4-Lite, with local changes.
 1.5 25-Apr-1994  cgd need <sys/time.h>
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 16-Sep-1997  lukem imported from lite-2
 1.1.1.2 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.6.2.1 07-Nov-1994  cgd for patch #2
 1.9 05-Apr-1996  cgd check in changes proposed in PR 2006 (approved by J.T.), to rename fsck
to fsck_ffs, so that in the future 'fsck' can be a wrapper than invokes
appropriate filesystem-specific checker programs. For now, the only
user-visible change is that the names have changed in the manual page
and in error messages; fsck and fsck.8 are now links to fsck_ffs and
fsck_ffs.8, until the rest of the transition is complete.
 1.8 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.7 05-Dec-1994  cgd more cleanups from Jim Jegers, passed over by me.
 1.6 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.5 25-Apr-1994  cgd need <sys/time.h>
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 16-Sep-1997  lukem imported from lite-2
 1.1.1.2 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.10 05-Apr-1996  cgd check in changes proposed in PR 2006 (approved by J.T.), to rename fsck
to fsck_ffs, so that in the future 'fsck' can be a wrapper than invokes
appropriate filesystem-specific checker programs. For now, the only
user-visible change is that the names have changed in the manual page
and in error messages; fsck and fsck.8 are now links to fsck_ffs and
fsck_ffs.8, until the rest of the transition is complete.
 1.9 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.8 05-Dec-1994  cgd more cleanups from Jim Jegers, passed over by me.
 1.7 23-Sep-1994  mycroft Eliminate uses of some obsolete functions.
 1.6 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.5 25-Apr-1994  cgd need <sys/time.h>
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 16-Sep-1997  lukem imported from lite-2
 1.1.1.2 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.15 05-Apr-1996  cgd check in changes proposed in PR 2006 (approved by J.T.), to rename fsck
to fsck_ffs, so that in the future 'fsck' can be a wrapper than invokes
appropriate filesystem-specific checker programs. For now, the only
user-visible change is that the names have changed in the manual page
and in error messages; fsck and fsck.8 are now links to fsck_ffs and
fsck_ffs.8, until the rest of the transition is complete.
 1.14 21-Mar-1995  cgd type sizes
 1.13 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.12 28-Dec-1994  mycroft Mostly sync with CSRG.
 1.11 18-Dec-1994  cgd light clean, and make it compile against new header files.
 1.10 05-Dec-1994  cgd more cleanups from Jim Jegers, passed over by me.
 1.9 28-Oct-1994  mycroft Use the S_IS*() macros, and make this compile again after Chris's changes to ufs.
 1.8 23-Sep-1994  mycroft Remove some more uses of obsolete functions.
 1.7 23-Sep-1994  mycroft Eliminate uses of some obsolete functions.
 1.6 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.5 25-Apr-1994  cgd need <sys/time.h>
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 16-Sep-1997  lukem imported from lite-2
 1.1.1.2 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.2 21-Oct-2009  snj Remove 3rd and 4th clauses in christos' license. OK christos.
 1.1 11-Sep-1996  christos New version of filesystem independent fsck(8) program similar to mount(8).
 1.32 21-Jun-2015  dholland Add used-by comments on source files that are .PATH'd in from elsewhere.
 1.31 07-Apr-2012  christos use getfsspecname()
 1.30 23-Feb-2008  christos branches: 1.30.22;
Make sure that the exit values are always sane, and use symbolic instead
of magic constants. Reviewed by go@
 1.29 26-Aug-2006  christos branches: 1.29.8; 1.29.16; 1.29.18;
- make preen recognize wedges and insert their parent disks in the disk list
so that we don't run multiple fsck's on the same spindle at the same time!
- Add some partition getting utilities that are wedge aware (soon to be able
to use the native geometry ioctl), so that we can fsck wedges.
 1.28 26-Aug-2006  christos Programs that use efun.
 1.27 13-Jan-2005  christos When we run with 'fsck -f -n' we should go over all the filesystems, not
exit on the first one that fails. Add a new flag CHECK_NOFIX so that we
specify -n, we keep going.
 1.26 28-Oct-2004  dsl Add (unsigned char) to isdigit() call
 1.25 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22308, verified by myself.
 1.24 20-Jul-2002  grant sweep of errx/warnx, remove unnecessary trailing \n
 1.23 01-Nov-2001  lukem fix a couple of -Wshadow warnings
 1.22 18-Jun-2001  lukem - Don't attempt to fsck a file system that is mounted read-write unless -f
(force) is given. fsck(8) will return with a zero exit status if "fsck -p"
is used in this circumstance, but all other invocations (e.g, "fsck",
"fsck /filesystem", "fsck -p /filesystem") will return with a non-zero exit
status in this circumstance.
Per discussions with various people including Bill Sommerfeld.
- Use "file system" instead of "filesystem"
 1.21 18-Jun-2001  lukem use TAILQ_xxx instead of referencing tqe_xxx elements directly
 1.20 18-Jun-2001  lukem ansi knf
 1.19 18-Jun-2001  lukem use TAILQ_xxx instead of referencing tqh_xxx elements directly
 1.18 26-Jul-1998  mycroft const poisoning.
 1.17 16-Sep-1997  lukem resolve conflicts from lite-2 merge
 1.16 14-Sep-1997  lukem * cleanup for WARNS=1
* deprecate register
* prefix hex numbers with '0x'
 1.15 28-Sep-1996  christos Allow for an extra argument needed by quotacheck.
 1.14 27-Sep-1996  christos - Rename util.c and util.h to fsutil.c and fsutil.h to avoid conflict with
<util.h>
- Change checkfstab so that the checkit function takes the name of the
mount point too (needed by quotacheck).
- Remove globals debug, verbose and preen
 1.13 23-Sep-1996  christos - added -T fstype:fsoptions per cgd's suggestion.
- handle parallelism in preening here using the original preening code from
fsck_ffs.
- move common code from fsck_ffs and fsck_msdos here.
 1.12 05-Apr-1996  cgd check in changes proposed in PR 2006 (approved by J.T.), to rename fsck
to fsck_ffs, so that in the future 'fsck' can be a wrapper than invokes
appropriate filesystem-specific checker programs. For now, the only
user-visible change is that the names have changed in the manual page
and in error messages; fsck and fsck.8 are now links to fsck_ffs and
fsck_ffs.8, until the rest of the transition is complete.
 1.11 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.10 28-Dec-1994  mycroft Mostly sync with CSRG.
 1.9 05-Dec-1994  cgd more cleanups from Jim Jegers, passed over by me.
 1.8 28-Oct-1994  mycroft Use the S_IS*() macros, and make this compile again after Chris's changes to ufs.
 1.7 23-Sep-1994  mycroft Eliminate uses of some obsolete functions.
 1.6 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.5 25-Apr-1994  cgd need <sys/time.h>
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 16-Sep-1997  lukem imported from lite-2
 1.1.1.2 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.29.18.1 03-Apr-2008  mjf Sync with HEAD.
 1.29.16.1 24-Mar-2008  keiichi sync with head.
 1.29.8.1 23-Mar-2008  matt sync with HEAD
 1.30.22.1 17-Apr-2012  yamt sync with head
 1.5 11-Apr-2009  lukem fix sign-compare issues
 1.4 28-Apr-2008  martin branches: 1.4.6;
Remove clause 3 and 4 from TNF licenses
 1.3 14-Nov-2006  apb branches: 1.3.18; 1.3.20;
Improve the progress bar displayed by fsck_ffs -p -P.

The progress bar will now travel from 0 to 20% during pass 1, from 20%
to 95% during pass 2, and from 95% to 100% during passes 3, 4, and 5.
Previously, the progress bar was not displayed at all during pass 1,
slowly traveled from 0 to about 50% during pass 2, and then very rapidly
traveled from 50% to 100% during passes 3, 4, and 5.

Note that fsck_ffs is the only user of fsck/progress.{c,h}.
 1.2 10-May-2005  atatat If progress is disabled, don't clear the progress bar.
 1.1 13-Jan-2005  christos branches: 1.1.2;
Add a progress meter to fsck_ffs based on the work by thorpej presented
to the mailing lists last January. This is optional.
 1.1.2.2 20-Nov-2006  tron Pull up following revision(s) (requested by ghen in ticket #1590):
sbin/fsck_ffs/pass4.c: revision 1.23
sbin/fsck_ffs/pass5.c: revision 1.47
sbin/fsck_ffs/pass2.c: revision 1.44
sbin/fsck_ffs/pass1.c: revision 1.43
sbin/fsck_ffs/pass3.c: revision 1.19
sbin/fsck/progress.c: revision 1.3
sbin/fsck_ffs/main.c: revision 1.61
sbin/fsck/progress.h: revision 1.2
Improve the progress bar displayed by fsck_ffs -p -P.
The progress bar will now travel from 0 to 20% during pass 1, from 20%
to 95% during pass 2, and from 95% to 100% during passes 3, 4, and 5.
Previously, the progress bar was not displayed at all during pass 1,
slowly traveled from 0 to about 50% during pass 2, and then very rapidly
traveled from 50% to 100% during passes 3, 4, and 5.
Note that fsck_ffs is the only user of fsck/progress.{c,h}.
 1.1.2.1 11-May-2005  tron Pull up revision 1.2 (requested by atatat in ticket #280):
If progress is disabled, don't clear the progress bar.
 1.3.20.1 18-May-2008  yamt sync with head.
 1.3.18.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.6.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 14-Nov-2006  apb branches: 1.2.18; 1.2.20;
Improve the progress bar displayed by fsck_ffs -p -P.

The progress bar will now travel from 0 to 20% during pass 1, from 20%
to 95% during pass 2, and from 95% to 100% during passes 3, 4, and 5.
Previously, the progress bar was not displayed at all during pass 1,
slowly traveled from 0 to about 50% during pass 2, and then very rapidly
traveled from 50% to 100% during passes 3, 4, and 5.

Note that fsck_ffs is the only user of fsck/progress.{c,h}.
 1.1 13-Jan-2005  christos branches: 1.1.2;
Add a progress meter to fsck_ffs based on the work by thorpej presented
to the mailing lists last January. This is optional.
 1.1.2.1 20-Nov-2006  tron Pull up following revision(s) (requested by ghen in ticket #1590):
sbin/fsck_ffs/pass4.c: revision 1.23
sbin/fsck_ffs/pass5.c: revision 1.47
sbin/fsck_ffs/pass2.c: revision 1.44
sbin/fsck_ffs/pass1.c: revision 1.43
sbin/fsck_ffs/pass3.c: revision 1.19
sbin/fsck/progress.c: revision 1.3
sbin/fsck_ffs/main.c: revision 1.61
sbin/fsck/progress.h: revision 1.2
Improve the progress bar displayed by fsck_ffs -p -P.
The progress bar will now travel from 0 to 20% during pass 1, from 20%
to 95% during pass 2, and from 95% to 100% during passes 3, 4, and 5.
Previously, the progress bar was not displayed at all during pass 1,
slowly traveled from 0 to about 50% during pass 2, and then very rapidly
traveled from 50% to 100% during passes 3, 4, and 5.
Note that fsck_ffs is the only user of fsck/progress.{c,h}.
 1.2.20.1 18-May-2008  yamt sync with head.
 1.2.18.1 02-Jun-2008  mjf Sync with HEAD.
 1.23 05-Apr-1996  cgd check in changes proposed in PR 2006 (approved by J.T.), to rename fsck
to fsck_ffs, so that in the future 'fsck' can be a wrapper than invokes
appropriate filesystem-specific checker programs. For now, the only
user-visible change is that the names have changed in the manual page
and in error messages; fsck and fsck.8 are now links to fsck_ffs and
fsck_ffs.8, until the rest of the transition is complete.
 1.22 12-Jul-1995  cgd implement a 'force check' flag, '-f'. I used the SunOS name, but the Digital
semantics. now:
(1) dirty file systems will always be checked; nothing new there.
(2) if not '-f' clean file systems will _NEVER_ be checked,
i.e. they won't be checked even if -p isn't specified. This
allows one to 'fsck -p ; fsck' to preen, then clean up
anything that 'fsck -p' barfs on, without waiting for the
clean file systems to be checked again.
(3) if '-f' clean file systems will ALWAYS be checked. This
allows people to put 'fsck -fp' into /etc/rc on systems
where they're leery of the FS clean flag state, need
the extra reliability, and can afford time 'wasted'
in checks.
The assumption made here is that if a file system is marked clean, it
_IS CLEAN_, really, and shouldn't be checked unless fsck is explicitly
told to (with -f). This should be a valid assumption, but may not be in
the presence of file system bugs. Documentation updated to note '-f'.
 1.21 12-Apr-1995  mycroft Set the clean flag if necessary. If preening, don't check `clean' file
systems.
 1.20 21-Mar-1995  cgd type sizes
 1.19 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.18 28-Dec-1994  mycroft Mostly sync with CSRG.
 1.17 27-Dec-1994  mycroft Copy fs_maxcluster when comparing superblocks.
 1.16 18-Dec-1994  cgd light clean, and make it compile against new header files.
 1.15 05-Dec-1994  cgd more cleanups from Jim Jegers, passed over by me.
 1.14 28-Oct-1994  mycroft Use the S_IS*() macros, and make this compile again after Chris's changes to ufs.
 1.13 23-Sep-1994  mycroft Remove some more uses of obsolete functions.
 1.12 23-Sep-1994  mycroft Eliminate uses of some obsolete functions.
 1.11 29-Jun-1994  ws Reads on raw disks are only guarranteed in multiples of the block size
 1.10 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.9 25-Apr-1994  cgd oops; changed comparison, but not field!
 1.8 25-Apr-1994  cgd need <sys/time.h>
 1.7 14-Apr-1994  cgd fs type names will soon be strings
 1.6 09-Apr-1994  deraadt from <dean@fsa.ca>: let "fsck /usr" work. also, if the user does
"fsck /dev/sd0a" attempt to map to the raw device name.
 1.5 01-Oct-1993  mycroft Skip check if filesystem is marked clean and isn't too dusty, only with -p.
Set clean flag after checking a filesystem.
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 16-Sep-1997  lukem imported from lite-2
 1.1.1.2 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.2 27-Sep-1996  christos - Rename util.c and util.h to fsutil.c and fsutil.h to avoid conflict with
<util.h>
- Change checkfstab so that the checkit function takes the name of the
mount point too (needed by quotacheck).
- Remove globals debug, verbose and preen
 1.1 23-Sep-1996  christos - added -T fstype:fsoptions per cgd's suggestion.
- handle parallelism in preening here using the original preening code from
fsck_ffs.
- move common code from fsck_ffs and fsck_msdos here.
 1.2 27-Sep-1996  christos - Rename util.c and util.h to fsutil.c and fsutil.h to avoid conflict with
<util.h>
- Change checkfstab so that the checkit function takes the name of the
mount point too (needed by quotacheck).
- Remove globals debug, verbose and preen
 1.1 23-Sep-1996  christos - added -T fstype:fsoptions per cgd's suggestion.
- handle parallelism in preening here using the original preening code from
fsck_ffs.
- move common code from fsck_ffs and fsck_msdos here.
 1.16 05-Apr-1996  cgd check in changes proposed in PR 2006 (approved by J.T.), to rename fsck
to fsck_ffs, so that in the future 'fsck' can be a wrapper than invokes
appropriate filesystem-specific checker programs. For now, the only
user-visible change is that the names have changed in the manual page
and in error messages; fsck and fsck.8 are now links to fsck_ffs and
fsck_ffs.8, until the rest of the transition is complete.
 1.15 23-Apr-1995  cgd slightly clean rcs ids, etc.
 1.14 12-Apr-1995  mycroft Set the clean flag if necessary. If preening, don't check `clean' file
systems.
 1.13 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.12 10-Feb-1995  cgd functions which are 'fake-varaargs' should be passed longs, not ints.
 1.11 05-Dec-1994  cgd more cleanups from Jim Jegers, passed over by me.
 1.10 23-Sep-1994  mycroft Eliminate uses of some obsolete functions.
 1.9 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.8 02-May-1994  pk Prototype some things.
 1.7 25-Apr-1994  cgd need <sys/time.h>
 1.6 09-Apr-1994  deraadt if user does ie, "fsck /etc/group", then types ^C to the CONTINUE
prompt do not dump core. fix from <dean@fsa.ca> (who i will stop
hounding about bug fixes for an hour or two)
 1.5 28-Mar-1994  cgd kill extern'd lseek()
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 16-Sep-1997  lukem imported from lite-2
 1.1.1.2 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources

RSS XML Feed