History log of /openbsd-current/sbin/fsck_ffs/fsck.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.35 03-Feb-2024 beck

Remove Softdep.

Softdep has been a no-op for some time now, this removes it to get
it out of the way.

Flensing mostly done in Talinn, with some help from krw@

ok deraadt@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE
# 1.34 27-Jan-2021 deraadt

shuffle externs (and definitions) around to satisfy -fno-common
ok mortimer


Revision tags: OPENBSD_6_8_BASE
# 1.33 13-Jul-2020 otto

Both phase 1 and phase 5 need the cylinder group meta data, so save those
in phase one to be used in phase 5, unless we're tight on memory.
From FreeBSD; ok bket@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.32 05-Jan-2018 otto

the value of bflag is a blockno, so use the proper type, avoids
an overflow seen with scanning for alternate superblocks; ok deraadt@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.31 19-Jan-2015 deraadt

remove #ifndef #define blocks trying to handle lack of BUFSIZ
ok millert


# 1.30 06-Sep-2014 guenther

inodesc.id_entryno holds a file size, so upgrade it from int to u_int64_t;
this fixes handling of very large files on FFS2.
Correct a copy-n-pasto that rendered useless the check for allocated
fragmented that are marked free in the bitmap.
allocdir() returns an inode number, so return an ino_t.
sizeof()*N should be printed with %zu, while direct and indirect block
numbers should be cast to (long long) use %lld

inodesc.id_entryno fix based on a diff from David Vasek <vasek@fido.cz>
ok krw@ otto@


Revision tags: OPENBSD_5_6_BASE
# 1.29 09-May-2014 krw

Fix '-b' option to work with the superblock locations output by newfs
on 4096-byte sector disks. No-op on 512-byte sector disks.

Adhering to the bedrock idea that ffs will *never* use anything but
512-byte block disk addressing (a.k.a. daddr_t), and believing that
the 'fake' bread()/bwrite() functions should always be using 512-btye
block numbers like their kernel big brothers, nuke the computed
dev_bsize and use DEV_BSIZE for conversions to/from byte offsets.

Spotted and various fixes tested by David Vasek.

Still to fix: scanning for superblocks on 4K disks.

ok otto@


Revision tags: OPENBSD_5_5_BASE
# 1.28 02-Nov-2013 krw

No need to cast constants or simple variables to (daddr_t). Use
(u_int64_t) instead of (daddr_t) when casting a variable in an
expression passed to DL_SETDSIZE().

Change a variable counting open files from daddr_t to int64_t.

ok deraadt@ with the tweak to fix that pesky expression.


Revision tags: OPENBSD_5_4_BASE
# 1.27 11-Jun-2013 deraadt

final removal of daddr64_t. daddr_t has been 64 bit for a long enough
test period; i think 3 years ago the last bugs fell out.
ok otto beck others


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.26 08-May-2011 otto

Small memory optimization from NetBSD; ok krw@ millert@


# 1.25 24-Apr-2011 otto

remove support for (very) old ffs on-disk formats; ok krw@ and no
objection form the usual suspects


# 1.24 16-Apr-2011 otto

Blend in some code from netbsd and freebsd that reduces memory consumption
and speeds things up in a lot of cases.
Prompted by Amit Kulkarni; ok krw@ on a slighly diffrenent incarnation


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.23 10-Jun-2008 otto

reduce mem usage by about 20% by packing state and type of an inode in a single
byte. Original diff by drahn@; twists by me; ok millert@ thib@


# 1.22 26-May-2008 otto

reorg fields in structs inodesc and inoinfo to reduce size on some archs; from
mickey; ok millert@


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.21 25-Jun-2007 otto

Teach fsck_ffs about 64-bit block addresses. ok (and help) moritz@ pedro@


# 1.20 01-Jun-2007 pedro

ufs1_daddr_t cleanup, okay otto@


# 1.19 01-Jun-2007 deraadt

convert ufs2_daddr_t -> daddr64_t for greater clarity; ok pedro otto thib


# 1.18 10-Apr-2007 millert

Add support for checking ffs2 filesystems. From pedro@ based on
the ufs2 changes in FreeBSD by Kirk Mckusick.


Revision tags: OPENBSD_4_1_BASE
# 1.17 08-Feb-2007 otto

Plug some mem leaks that occur when checking multiple file systems in a
row. ok beck@ pedro@ millert@


Revision tags: OPENBSD_4_0_BASE
# 1.16 22-Mar-2006 deraadt

earlier asprintf diff caused malloc in signal handler. clarify the
code a bit more so that this mistake will not be done again


# 1.15 12-Mar-2006 deraadt

use asprintf instead of a static buffer; dhill, tested by pedro


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.14 25-Sep-2003 deraadt

whack commons as wanted by ho


Revision tags: OPENBSD_3_4_BASE
# 1.13 25-Aug-2003 tedu

rename struct dinode to ufs1_dinode. clears the namespace and makes
way for some future work. no function changes yet.
help testing otto@ and markus@


# 1.12 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_3_BASE
# 1.11 11-Mar-2003 david

spelling
ok millert@


Revision tags: OPENBSD_3_2_BASE
# 1.10 09-Jun-2002 todd

rm trailing whitespace


Revision tags: OPENBSD_3_1_BASE
# 1.9 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.8 02-Mar-2001 art

Make fsck aware of soft updates.
We had this in the tree 1997, but it went away because it was too close to
release.
Ok: csapuntz@
(as a size note: It's really good to test fsck when you are torture testing
the filesystems)


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.7 01-Mar-1999 d

SIGINFO support


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE
# 1.6 06-Oct-1997 deraadt

back out vfs lite2 till after 2.2


# 1.5 06-Oct-1997 csapuntz

VFS Lite2 Changes


Revision tags: OPENBSD_2_1_BASE
# 1.4 20-Oct-1996 tholo

Sync with NetBSD 961019


# 1.3 12-Oct-1996 tholo

From Kirk McKusick:
If a directory somehow develops a hole (that is a block pointer
that has a value of zero), fsck would give the filesystem a clean
bill of health, but the kernel would panic when accessing the
directory with the hole. Fsck now checks for holes in directories.
If found in preen mode, fsck fails. In manual mode, it can be
directed to shorten the directory to the beginning of the hole. A
more complete solution would be to allocate a block to fill the
hole. However, this is a lot more work for a `cannot happen' error,
so the extra effort seems unwarranted.


Revision tags: OPENBSD_2_0_BASE
# 1.2 23-Jun-1996 deraadt

update rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.34 27-Jan-2021 deraadt

shuffle externs (and definitions) around to satisfy -fno-common
ok mortimer


Revision tags: OPENBSD_6_8_BASE
# 1.33 13-Jul-2020 otto

Both phase 1 and phase 5 need the cylinder group meta data, so save those
in phase one to be used in phase 5, unless we're tight on memory.
From FreeBSD; ok bket@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.32 05-Jan-2018 otto

the value of bflag is a blockno, so use the proper type, avoids
an overflow seen with scanning for alternate superblocks; ok deraadt@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.31 19-Jan-2015 deraadt

remove #ifndef #define blocks trying to handle lack of BUFSIZ
ok millert


# 1.30 06-Sep-2014 guenther

inodesc.id_entryno holds a file size, so upgrade it from int to u_int64_t;
this fixes handling of very large files on FFS2.
Correct a copy-n-pasto that rendered useless the check for allocated
fragmented that are marked free in the bitmap.
allocdir() returns an inode number, so return an ino_t.
sizeof()*N should be printed with %zu, while direct and indirect block
numbers should be cast to (long long) use %lld

inodesc.id_entryno fix based on a diff from David Vasek <vasek@fido.cz>
ok krw@ otto@


Revision tags: OPENBSD_5_6_BASE
# 1.29 09-May-2014 krw

Fix '-b' option to work with the superblock locations output by newfs
on 4096-byte sector disks. No-op on 512-byte sector disks.

Adhering to the bedrock idea that ffs will *never* use anything but
512-byte block disk addressing (a.k.a. daddr_t), and believing that
the 'fake' bread()/bwrite() functions should always be using 512-btye
block numbers like their kernel big brothers, nuke the computed
dev_bsize and use DEV_BSIZE for conversions to/from byte offsets.

Spotted and various fixes tested by David Vasek.

Still to fix: scanning for superblocks on 4K disks.

ok otto@


Revision tags: OPENBSD_5_5_BASE
# 1.28 02-Nov-2013 krw

No need to cast constants or simple variables to (daddr_t). Use
(u_int64_t) instead of (daddr_t) when casting a variable in an
expression passed to DL_SETDSIZE().

Change a variable counting open files from daddr_t to int64_t.

ok deraadt@ with the tweak to fix that pesky expression.


Revision tags: OPENBSD_5_4_BASE
# 1.27 11-Jun-2013 deraadt

final removal of daddr64_t. daddr_t has been 64 bit for a long enough
test period; i think 3 years ago the last bugs fell out.
ok otto beck others


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.26 08-May-2011 otto

Small memory optimization from NetBSD; ok krw@ millert@


# 1.25 24-Apr-2011 otto

remove support for (very) old ffs on-disk formats; ok krw@ and no
objection form the usual suspects


# 1.24 16-Apr-2011 otto

Blend in some code from netbsd and freebsd that reduces memory consumption
and speeds things up in a lot of cases.
Prompted by Amit Kulkarni; ok krw@ on a slighly diffrenent incarnation


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.23 10-Jun-2008 otto

reduce mem usage by about 20% by packing state and type of an inode in a single
byte. Original diff by drahn@; twists by me; ok millert@ thib@


# 1.22 26-May-2008 otto

reorg fields in structs inodesc and inoinfo to reduce size on some archs; from
mickey; ok millert@


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.21 25-Jun-2007 otto

Teach fsck_ffs about 64-bit block addresses. ok (and help) moritz@ pedro@


# 1.20 01-Jun-2007 pedro

ufs1_daddr_t cleanup, okay otto@


# 1.19 01-Jun-2007 deraadt

convert ufs2_daddr_t -> daddr64_t for greater clarity; ok pedro otto thib


# 1.18 10-Apr-2007 millert

Add support for checking ffs2 filesystems. From pedro@ based on
the ufs2 changes in FreeBSD by Kirk Mckusick.


Revision tags: OPENBSD_4_1_BASE
# 1.17 08-Feb-2007 otto

Plug some mem leaks that occur when checking multiple file systems in a
row. ok beck@ pedro@ millert@


Revision tags: OPENBSD_4_0_BASE
# 1.16 22-Mar-2006 deraadt

earlier asprintf diff caused malloc in signal handler. clarify the
code a bit more so that this mistake will not be done again


# 1.15 12-Mar-2006 deraadt

use asprintf instead of a static buffer; dhill, tested by pedro


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.14 25-Sep-2003 deraadt

whack commons as wanted by ho


Revision tags: OPENBSD_3_4_BASE
# 1.13 25-Aug-2003 tedu

rename struct dinode to ufs1_dinode. clears the namespace and makes
way for some future work. no function changes yet.
help testing otto@ and markus@


# 1.12 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_3_BASE
# 1.11 11-Mar-2003 david

spelling
ok millert@


Revision tags: OPENBSD_3_2_BASE
# 1.10 09-Jun-2002 todd

rm trailing whitespace


Revision tags: OPENBSD_3_1_BASE
# 1.9 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.8 02-Mar-2001 art

Make fsck aware of soft updates.
We had this in the tree 1997, but it went away because it was too close to
release.
Ok: csapuntz@
(as a size note: It's really good to test fsck when you are torture testing
the filesystems)


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.7 01-Mar-1999 d

SIGINFO support


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE
# 1.6 06-Oct-1997 deraadt

back out vfs lite2 till after 2.2


# 1.5 06-Oct-1997 csapuntz

VFS Lite2 Changes


Revision tags: OPENBSD_2_1_BASE
# 1.4 20-Oct-1996 tholo

Sync with NetBSD 961019


# 1.3 12-Oct-1996 tholo

From Kirk McKusick:
If a directory somehow develops a hole (that is a block pointer
that has a value of zero), fsck would give the filesystem a clean
bill of health, but the kernel would panic when accessing the
directory with the hole. Fsck now checks for holes in directories.
If found in preen mode, fsck fails. In manual mode, it can be
directed to shorten the directory to the beginning of the hole. A
more complete solution would be to allocate a block to fill the
hole. However, this is a lot more work for a `cannot happen' error,
so the extra effort seems unwarranted.


Revision tags: OPENBSD_2_0_BASE
# 1.2 23-Jun-1996 deraadt

update rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.33 13-Jul-2020 otto

Both phase 1 and phase 5 need the cylinder group meta data, so save those
in phase one to be used in phase 5, unless we're tight on memory.
From FreeBSD; ok bket@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.32 05-Jan-2018 otto

the value of bflag is a blockno, so use the proper type, avoids
an overflow seen with scanning for alternate superblocks; ok deraadt@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.31 19-Jan-2015 deraadt

remove #ifndef #define blocks trying to handle lack of BUFSIZ
ok millert


# 1.30 06-Sep-2014 guenther

inodesc.id_entryno holds a file size, so upgrade it from int to u_int64_t;
this fixes handling of very large files on FFS2.
Correct a copy-n-pasto that rendered useless the check for allocated
fragmented that are marked free in the bitmap.
allocdir() returns an inode number, so return an ino_t.
sizeof()*N should be printed with %zu, while direct and indirect block
numbers should be cast to (long long) use %lld

inodesc.id_entryno fix based on a diff from David Vasek <vasek@fido.cz>
ok krw@ otto@


Revision tags: OPENBSD_5_6_BASE
# 1.29 09-May-2014 krw

Fix '-b' option to work with the superblock locations output by newfs
on 4096-byte sector disks. No-op on 512-byte sector disks.

Adhering to the bedrock idea that ffs will *never* use anything but
512-byte block disk addressing (a.k.a. daddr_t), and believing that
the 'fake' bread()/bwrite() functions should always be using 512-btye
block numbers like their kernel big brothers, nuke the computed
dev_bsize and use DEV_BSIZE for conversions to/from byte offsets.

Spotted and various fixes tested by David Vasek.

Still to fix: scanning for superblocks on 4K disks.

ok otto@


Revision tags: OPENBSD_5_5_BASE
# 1.28 02-Nov-2013 krw

No need to cast constants or simple variables to (daddr_t). Use
(u_int64_t) instead of (daddr_t) when casting a variable in an
expression passed to DL_SETDSIZE().

Change a variable counting open files from daddr_t to int64_t.

ok deraadt@ with the tweak to fix that pesky expression.


Revision tags: OPENBSD_5_4_BASE
# 1.27 11-Jun-2013 deraadt

final removal of daddr64_t. daddr_t has been 64 bit for a long enough
test period; i think 3 years ago the last bugs fell out.
ok otto beck others


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.26 08-May-2011 otto

Small memory optimization from NetBSD; ok krw@ millert@


# 1.25 24-Apr-2011 otto

remove support for (very) old ffs on-disk formats; ok krw@ and no
objection form the usual suspects


# 1.24 16-Apr-2011 otto

Blend in some code from netbsd and freebsd that reduces memory consumption
and speeds things up in a lot of cases.
Prompted by Amit Kulkarni; ok krw@ on a slighly diffrenent incarnation


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.23 10-Jun-2008 otto

reduce mem usage by about 20% by packing state and type of an inode in a single
byte. Original diff by drahn@; twists by me; ok millert@ thib@


# 1.22 26-May-2008 otto

reorg fields in structs inodesc and inoinfo to reduce size on some archs; from
mickey; ok millert@


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.21 25-Jun-2007 otto

Teach fsck_ffs about 64-bit block addresses. ok (and help) moritz@ pedro@


# 1.20 01-Jun-2007 pedro

ufs1_daddr_t cleanup, okay otto@


# 1.19 01-Jun-2007 deraadt

convert ufs2_daddr_t -> daddr64_t for greater clarity; ok pedro otto thib


# 1.18 10-Apr-2007 millert

Add support for checking ffs2 filesystems. From pedro@ based on
the ufs2 changes in FreeBSD by Kirk Mckusick.


Revision tags: OPENBSD_4_1_BASE
# 1.17 08-Feb-2007 otto

Plug some mem leaks that occur when checking multiple file systems in a
row. ok beck@ pedro@ millert@


Revision tags: OPENBSD_4_0_BASE
# 1.16 22-Mar-2006 deraadt

earlier asprintf diff caused malloc in signal handler. clarify the
code a bit more so that this mistake will not be done again


# 1.15 12-Mar-2006 deraadt

use asprintf instead of a static buffer; dhill, tested by pedro


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.14 25-Sep-2003 deraadt

whack commons as wanted by ho


Revision tags: OPENBSD_3_4_BASE
# 1.13 25-Aug-2003 tedu

rename struct dinode to ufs1_dinode. clears the namespace and makes
way for some future work. no function changes yet.
help testing otto@ and markus@


# 1.12 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_3_BASE
# 1.11 11-Mar-2003 david

spelling
ok millert@


Revision tags: OPENBSD_3_2_BASE
# 1.10 09-Jun-2002 todd

rm trailing whitespace


Revision tags: OPENBSD_3_1_BASE
# 1.9 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.8 02-Mar-2001 art

Make fsck aware of soft updates.
We had this in the tree 1997, but it went away because it was too close to
release.
Ok: csapuntz@
(as a size note: It's really good to test fsck when you are torture testing
the filesystems)


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.7 01-Mar-1999 d

SIGINFO support


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE
# 1.6 06-Oct-1997 deraadt

back out vfs lite2 till after 2.2


# 1.5 06-Oct-1997 csapuntz

VFS Lite2 Changes


Revision tags: OPENBSD_2_1_BASE
# 1.4 20-Oct-1996 tholo

Sync with NetBSD 961019


# 1.3 12-Oct-1996 tholo

From Kirk McKusick:
If a directory somehow develops a hole (that is a block pointer
that has a value of zero), fsck would give the filesystem a clean
bill of health, but the kernel would panic when accessing the
directory with the hole. Fsck now checks for holes in directories.
If found in preen mode, fsck fails. In manual mode, it can be
directed to shorten the directory to the beginning of the hole. A
more complete solution would be to allocate a block to fill the
hole. However, this is a lot more work for a `cannot happen' error,
so the extra effort seems unwarranted.


Revision tags: OPENBSD_2_0_BASE
# 1.2 23-Jun-1996 deraadt

update rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.32 05-Jan-2018 otto

the value of bflag is a blockno, so use the proper type, avoids
an overflow seen with scanning for alternate superblocks; ok deraadt@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.31 19-Jan-2015 deraadt

remove #ifndef #define blocks trying to handle lack of BUFSIZ
ok millert


# 1.30 06-Sep-2014 guenther

inodesc.id_entryno holds a file size, so upgrade it from int to u_int64_t;
this fixes handling of very large files on FFS2.
Correct a copy-n-pasto that rendered useless the check for allocated
fragmented that are marked free in the bitmap.
allocdir() returns an inode number, so return an ino_t.
sizeof()*N should be printed with %zu, while direct and indirect block
numbers should be cast to (long long) use %lld

inodesc.id_entryno fix based on a diff from David Vasek <vasek@fido.cz>
ok krw@ otto@


Revision tags: OPENBSD_5_6_BASE
# 1.29 09-May-2014 krw

Fix '-b' option to work with the superblock locations output by newfs
on 4096-byte sector disks. No-op on 512-byte sector disks.

Adhering to the bedrock idea that ffs will *never* use anything but
512-byte block disk addressing (a.k.a. daddr_t), and believing that
the 'fake' bread()/bwrite() functions should always be using 512-btye
block numbers like their kernel big brothers, nuke the computed
dev_bsize and use DEV_BSIZE for conversions to/from byte offsets.

Spotted and various fixes tested by David Vasek.

Still to fix: scanning for superblocks on 4K disks.

ok otto@


Revision tags: OPENBSD_5_5_BASE
# 1.28 02-Nov-2013 krw

No need to cast constants or simple variables to (daddr_t). Use
(u_int64_t) instead of (daddr_t) when casting a variable in an
expression passed to DL_SETDSIZE().

Change a variable counting open files from daddr_t to int64_t.

ok deraadt@ with the tweak to fix that pesky expression.


Revision tags: OPENBSD_5_4_BASE
# 1.27 11-Jun-2013 deraadt

final removal of daddr64_t. daddr_t has been 64 bit for a long enough
test period; i think 3 years ago the last bugs fell out.
ok otto beck others


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.26 08-May-2011 otto

Small memory optimization from NetBSD; ok krw@ millert@


# 1.25 24-Apr-2011 otto

remove support for (very) old ffs on-disk formats; ok krw@ and no
objection form the usual suspects


# 1.24 16-Apr-2011 otto

Blend in some code from netbsd and freebsd that reduces memory consumption
and speeds things up in a lot of cases.
Prompted by Amit Kulkarni; ok krw@ on a slighly diffrenent incarnation


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.23 10-Jun-2008 otto

reduce mem usage by about 20% by packing state and type of an inode in a single
byte. Original diff by drahn@; twists by me; ok millert@ thib@


# 1.22 26-May-2008 otto

reorg fields in structs inodesc and inoinfo to reduce size on some archs; from
mickey; ok millert@


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.21 25-Jun-2007 otto

Teach fsck_ffs about 64-bit block addresses. ok (and help) moritz@ pedro@


# 1.20 01-Jun-2007 pedro

ufs1_daddr_t cleanup, okay otto@


# 1.19 01-Jun-2007 deraadt

convert ufs2_daddr_t -> daddr64_t for greater clarity; ok pedro otto thib


# 1.18 10-Apr-2007 millert

Add support for checking ffs2 filesystems. From pedro@ based on
the ufs2 changes in FreeBSD by Kirk Mckusick.


Revision tags: OPENBSD_4_1_BASE
# 1.17 08-Feb-2007 otto

Plug some mem leaks that occur when checking multiple file systems in a
row. ok beck@ pedro@ millert@


Revision tags: OPENBSD_4_0_BASE
# 1.16 22-Mar-2006 deraadt

earlier asprintf diff caused malloc in signal handler. clarify the
code a bit more so that this mistake will not be done again


# 1.15 12-Mar-2006 deraadt

use asprintf instead of a static buffer; dhill, tested by pedro


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.14 25-Sep-2003 deraadt

whack commons as wanted by ho


Revision tags: OPENBSD_3_4_BASE
# 1.13 25-Aug-2003 tedu

rename struct dinode to ufs1_dinode. clears the namespace and makes
way for some future work. no function changes yet.
help testing otto@ and markus@


# 1.12 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_3_BASE
# 1.11 11-Mar-2003 david

spelling
ok millert@


Revision tags: OPENBSD_3_2_BASE
# 1.10 09-Jun-2002 todd

rm trailing whitespace


Revision tags: OPENBSD_3_1_BASE
# 1.9 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.8 02-Mar-2001 art

Make fsck aware of soft updates.
We had this in the tree 1997, but it went away because it was too close to
release.
Ok: csapuntz@
(as a size note: It's really good to test fsck when you are torture testing
the filesystems)


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.7 01-Mar-1999 d

SIGINFO support


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE
# 1.6 06-Oct-1997 deraadt

back out vfs lite2 till after 2.2


# 1.5 06-Oct-1997 csapuntz

VFS Lite2 Changes


Revision tags: OPENBSD_2_1_BASE
# 1.4 20-Oct-1996 tholo

Sync with NetBSD 961019


# 1.3 12-Oct-1996 tholo

From Kirk McKusick:
If a directory somehow develops a hole (that is a block pointer
that has a value of zero), fsck would give the filesystem a clean
bill of health, but the kernel would panic when accessing the
directory with the hole. Fsck now checks for holes in directories.
If found in preen mode, fsck fails. In manual mode, it can be
directed to shorten the directory to the beginning of the hole. A
more complete solution would be to allocate a block to fill the
hole. However, this is a lot more work for a `cannot happen' error,
so the extra effort seems unwarranted.


Revision tags: OPENBSD_2_0_BASE
# 1.2 23-Jun-1996 deraadt

update rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision