History log of /freebsd-current/sbin/fsck/fsck.c
Revision Date Author Comments
# 32e86a82 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

sbin: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 51e16cb8 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

sbin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 906c312b 15-Jan-2023 Kirk McKusick <mckusick@FreeBSD.org>

Document the mntopts(3) functions.

The mntopts(3) functions support operations associated with a mount
point. The main purpose of this commit is to document the mntopts(3)
functions that now appear in 18 utilities in the base system. See
mntopts(3) for the documentation details.

The getmntopts() function appeared in 4.4BSD. The build_iovec(),
build_iovec_argf(), free_iovec(), checkpath(), and rmslashes()
functions were added with nmount(8) in FreeBSD 5.0. The getmntpoint()
and chkdoreload() functions are being added in this commit.

These functions should be in a library but for historic reasons are
in a file in the sources for the mount(8) program. Thus, to access
them the following lines need to be added to the Makefile of the
program wanting to use them:

SRCS+= getmntopts.c
MOUNT= ${SRCTOP}/sbin/mount
CFLAGS+= -I${MOUNT}
.PATH: ${MOUNT}

Once these changes have been MFC'ed to 13 they may be made into
a library.

Reviewed by: kib, gbe
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37907


# c72372c6 15-Dec-2021 Kirk McKusick <mckusick@FreeBSD.org>

Update fsck(8) to ignore failures from a check program for a filesystem
when the fstab(5) entry for the filesystem has the "failok" attribute.

Reviewed by: kib
PR: 246201
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D33424


# e87e283c 21-Dec-2019 Xin LI <delphij@FreeBSD.org>

Remove unused includes.

MFC after: 2 weeks


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# 6a27a9f6 18-Feb-2017 Edward Tomasz Napierala <trasz@FreeBSD.org>

Make fsck(8) default to "ufs", like eg mount(8) does.

Approved by: imp
Discussed with: kib
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9621


# cd5f6a0c 18-Apr-2016 Marcelo Araujo <araujo@FreeBSD.org>

strchr(3) will return NULL if it cannot find the character in the
string.
getfsent(3) will return NULL on EOF or error.

MFC after: 2 weeks.


# 009ad003 20-Nov-2014 Warner Losh <imp@FreeBSD.org>

Recommit r274750.


# adafc9d6 20-Nov-2014 Warner Losh <imp@FreeBSD.org>

Back our r274750 until discussions on proper fix are over.


# 681a5b28 20-Nov-2014 Andrey V. Elsukov <ae@FreeBSD.org>

Use geom attribute "PART::type" to determine partition type and choose
relevant fsck_xxx utility.

MFC after: 1 week


# 3bbc4438 20-Oct-2012 Ulrich Spörlein <uqs@FreeBSD.org>

Make fsck and fsck_msdosfs WARNS=6 clean

- sprinkle const
- add volatile qualifier to avoid vfork clobbering

Inspired by: NetBSD
PR: bin/139802
Reviewed by: ed


# 6cf357bc 20-Oct-2012 Ulrich Spörlein <uqs@FreeBSD.org>

sbin/fsck: s/perror/perr/ to avoid shadowing

- rename some other vars too
- merge NetBSD license changes

Obtained from: NetBSD
PR: bin/139802
Reviewed by: ed


# 1efe3c6b 04-Nov-2011 Ed Schouten <ed@FreeBSD.org>

Add missing static keywords for global variables to tools in sbin/.

These tools declare global variables without using the static keyword,
even though their use is limited to a single C-file, or without placing
an extern declaration of them in the proper header file.


# f2104fc0 24-Oct-2011 Maxim Sobolev <sobomax@FreeBSD.org>

Add new option -c to specify alternatve location of the /etc/fstab
file.

MFC after: 1 month


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 9f69cbc0 27-Nov-2009 Alexander Leidinger <netchild@FreeBSD.org>

MFC r199582:
Fix minor resource leak in a function which was introduced by changing an
err() to a return in r106254.


# 4b2d15ef 20-Nov-2009 Alexander Leidinger <netchild@FreeBSD.org>

Fix minor resource leak in a function which was introduced by changing an
err() to a return in r106254.

MFC after: 1 week


# 111a5220 30-Jan-2009 David E. O'Brien <obrien@FreeBSD.org>

Add the '-C' "check clean" flag. If the FS is marked clean, skip file
system checking. However, if the file system is not clean, perform a
full fsck.

Reviewed by: delphij
Obtained from: Juniper Networks


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 8d646af5 10-Feb-2005 Ruslan Ermilov <ru@FreeBSD.org>

Sync program's usage() with manpage's SYNOPSIS.


# ff7e70a9 29-Oct-2003 Tom Rhodes <trhodes@FreeBSD.org>

Remove redundant declaration of the perror() function, it's provided by stdio.h.
Don't define DKTYPENAMES without using it.


# fc608753 26-Jul-2003 Maxim Konovalov <maxim@FreeBSD.org>

o Fix usage(): remove '-l', add missed '-f', sort.


# a3ba4c65 29-Jun-2003 Gordon Tetlow <gordon@FreeBSD.org>

Convert fsck and mount to using execvP to find fsck_foo and mount_foo.
This simplifies the code path and makes the default path easy to override
in the /rescue case.

Submitted by: Tim Kientzle <kientzle@acm.org>


# 8235d79a 24-Apr-2003 Juli Mallett <jmallett@FreeBSD.org>

Back out previous delta to fix fsck on filesystems without an fstab entry,
where we want to take the disklabel filesystem type of "4.2BSD" and use
fsck_4.2bsd on those filesystems.

Add a comment about why the code is there, now that we know:

* XXX This is a kludge to make automatic filesystem type guessing
* from the disklabel work for "4.2BSD" filesystems. It does a
* very limited subset of transliteration to a normalised form of
* filesystem name, and we do not seem to enforce a filesystem
* name character set.


# d8d3a9f3 03-Mar-2003 Juli Mallett <jmallett@FreeBSD.org>

Strip out bogus difference from when this came from NetBSD: transliterating
upper-case alphabetical characters to lower-case ones, and spaces to dashes.
The person who added this when bringing the code from NetBSD has no idea why
he added it, and nobody on freebsd-fs came up with any cases where the icky
part (the conversion of spaces to underscores) was needed. The removal of
the upper-case conversion follows an even more obvious logic: it avoids any
sort of namespace issues. People using StUdLy caps for filesystem names
deserve everything they get. Otherwise, Efs and efs might be totally different
things, but would use the same fsck. And we don't want that, right? That
just provokes the sort of foot-shooting this would prevent.

If you have problems with this, I'll walk you through using sed on your fstab,
cause the only way you could have problems is if you spelled ufs as "UFS".
Most likely, you haven't done that.

MFC after: 1 month


# 5c63c8dd 31-Oct-2002 Poul-Henning Kamp <phk@FreeBSD.org>

Give a meaningfull diagnostic when we cannot determine the filesystem type.


# ce66ddb7 21-Aug-2002 Tom Rhodes <trhodes@FreeBSD.org>

s/filesystem/file system/g as discussed on -developers


# 3468b317 15-May-2002 Tom Rhodes <trhodes@FreeBSD.org>

more file system > filesystem


# d3974088 22-Apr-2002 Dag-Erling Smørgrav <des@FreeBSD.org>

Usage style sweep: spell "usage" with a small 'u'.
Also change one case of blatant __progname abuse (several more remain)
This commit does not touch anything in src/{contrib,crypto,gnu}/.


# b813a714 24-Mar-2002 Mark Murray <markm@FreeBSD.org>

Replace __progname with the functionally identical but more
acceptable (documented) getprogname(3).


# b70cd7ee 20-Mar-2002 Warner Losh <imp@FreeBSD.org>

o __P removed
o ansi function prototypes
o unifdef -D__STDC__
o __dead2 on usage prototype
o remove now-bogus main prototype


# f4a225c7 29-Apr-2001 Kirk McKusick <mckusick@FreeBSD.org>

Update usage message with new options.

Submitted by: Ruslan Ermilov <ru@FreeBSD.org>


# a02a0079 25-Apr-2001 Kirk McKusick <mckusick@FreeBSD.org>

Add support for running foreground (-F) and background (-B) checks.
Traditionally, fsck is invoked before the filesystems are mounted
and all checks are done to completion at that time. If background
checking is available, fsck is invoked twice. It is first invoked
at the traditional time, before the filesystems are mounted, with
the -F flag to do checking on all the filesystems that cannot do
background checking. It is then invoked a second time, after the
system has completed going multiuser, with the -B flag to do checking
on all the filesystems that can do background checking. Unlike
the foreground checking, the background checking is started
asynchonously so that other system activity can proceed even on
the filesystems that are being checked.

At the moment, only the fast filesystem supports background checking.
To be able to do background checking, a filesystem must have been
running with soft updates, not have been marked as needing a
foreground check, and be mounted and writable when the background
check is to be done (i.e., not listed as `noauto' in /etc/fstab).

These changes are the final piece needed to support background
filesystem checking. They will not have any effect until you update
your /etc/rc to invoke fsck in its new mode of operation. I am
still playing around with exactly what those changes should be
and should be committing them later this week.


# 0af7bca2 30-Mar-2001 Poul-Henning Kamp <phk@FreeBSD.org>

This change sanitizes the way fsck deals with pass numbers.

Consider this /etc/fstab:

# Device Mountpoint FStype Options Dump Pass#
/dev/ad1s1b none swap sw 0 0
/dev/ad0s1b none swap sw 0 0
/dev/ad0s1a / ufs rw 1 1
/dev/ad0s1e /home ufs rw 2 2
/dev/ad1s1e /tmp ufs rw 2 2
/dev/ad1s1f /usr ufs rw 2 2
/dev/ccd0c /syv ufs rw 2 11
proc /proc procfs rw 0 0

ccd0c is striped over /dev/ad0f and /dev/ad1g

Without this pass, fsck in preen mode will check ad0s1a first,
and then issue three processes in parallel:

One process doing ad0s1e
One process doing ad1s1e and ad1s1f
One process doing ccd0c

There is no way to tell it that ccd0c overlaps ad0 and ad1.

With the patch, it will do it this way:

pass 2:
One process doing ad0s1e
One process doing ad1s1e and ad1s1f

and when they are complete:

pass 11:
One process doing ccd0c

This is much faster and more sane.

Valid pass numbers are anything from 1 to INTMAX-1.

I retired the '-l' option which tried to allow people to do
something like this, but which didn't work and which complicated
the code an awful lot.


# 32ff2662 30-Dec-2000 Poul-Henning Kamp <phk@FreeBSD.org>

Use macro API to <sys/queue.h>

Submitted by: "Peter Avalos" <pavalos@theshell.com>
Reviewed by: /sbin/md5


# d4b552a9 10-Oct-2000 David E. O'Brien <obrien@FreeBSD.org>

We want the FreeBSD ID as the RCS ID, not the NetBSD one.


# da7e7114 09-Oct-2000 Adrian Chadd <adrian@FreeBSD.org>

Reviewed by: rwatson, bp
Approved by: rwatson
Obtained from: NetBSD source tree

Second part of the fsck wrappers commit. This commit enables the new fsck
code (removing the fsck/* code and replacing it with the netbsd fsck
wrapper code), and enabling some FFS-based utilities to compile.

Details:

* quotacheck, fsdb required modification to use the fsck_ffs/ code rather
than fsck/ . This might change later since quotacheck requires preen.c
which should exist in fsck/ rather than fsck_ffs/

* src/Makefile has fsck_ffs added to it so it it built as part of the tree
now

* share/doc/smm/03.fsck/ uses the SMM.doc/ stuff from fsck_ffs, not fsck.

I've tested this, and it shouldn't require any changes on your machine.
The fsck wrapper reads /etc/fsck and is command-line-compatible enough
to not require rc changes (well, most changes unless you want to do
anything nifty by specifying the fs types explicityly, read the man page
if you want further details on what it can do.)

This now allows us to support multiple filesystem types during bootup.