Home | History | Annotate | Download | only in scan_ffs
History log of /src/sbin/scan_ffs/scan_ffs.c
RevisionDateAuthorComments
 1.37  24-Jan-2023  mlelstv Work on swapped-endian FFS.
 1.36  17-Nov-2022  chs branches: 1.36.2;
Restore backward compatibility of UFS2 with previous NetBSD releases by
disabling support in UFS2 for extended attributes (including ACLs).
Add a new variant of UFS2 called "UFS2ea" that does support extended attributes.
Add new fsck_ffs operations "-c ea" and "-c no-ea" to convert file systems
from UFS2 to UFS2ea and vice-versa (both of which delete all existing extended
attributes in the process).
 1.35  20-Jan-2022  christos O_CLOEXEC is not a mode :-)
 1.34  20-Jan-2022  christos - use /dev/tty instead of stderr for SIGINFO messages
- use uintmax_t instead of ull
- print fractional percentage to show that we are making progress on large
disks.
 1.33  19-Jan-2022  mrg add SIGINFO support. now you can know how far along the scan is.
 1.32  15-Oct-2015  dholland Teach scan_ffs about lfs64.
(and also about byte-swapped lfs volumes, which might or might not
actually work)
 1.31  02-Aug-2015  dholland Add a (draft) 64-bit superblock. Make things build again.

Add pieces of support for using both superblock types where
convenient, and specifically to the superblock accessors, but don't
actually enable it anywhere.

First substantive step on PR 50000.
 1.30  02-Aug-2015  dholland Use accessor functions for the version field of the lfs superblock.
I thought at first maybe the cases that test the version should be
rolled into the accessors, but on the whole I think the conclusion on
that is no.
 1.29  02-Aug-2015  dholland Fix assorted 64 -> 32 truncations in lfs. Also, some minor tidyups and
corrections in passing.
 1.28  28-Jul-2015  dholland Add a new lfs header file: lfs_accessors.h.

This contains all the accessor functions and macros out of lfs.h.
Add an include of lfs_accessors.h after all uses of lfs.h... except
for code that wants to define its own struct lfs-alike that the
accessors are supposed to play along with. For these, set STRUCT_LFS
and include lfs_accessors.h after the necessary structure has been
defined, so that lfs_accessors.h can emit functions in terms of it.
 1.27  24-Jul-2015  dholland More lfs superblock accessors.
(This changes the rest of the code over; all the accessors were
already added.)

The difference between this commit and the previous one is arbitrary,
but the previous one passed the regression tests on its own so I'm
keeping it separate to help with any bisections that might be needed
in the future.
 1.26  24-Jul-2015  dholland Switch to accessor functions for elements of the LFS on-disk
superblock. This will allow switching between 32/64 bit forms on the
fly; it will also allow handling LFS_EI reasonably tidily. (That
currently doesn't work on the superblock.)

It also gets rid of cpp abuse in the form of fake structure member
macros.

Also, instead of doing sleep/wakeup on &lfs_avail and &lfs_nextseg
inside the on-disk superblock, add extra elements to the in-memory
struct lfs for this. (XXX: these should be changed to condvars, but
not right now)

XXX: this migrates a structure needed by the lfs code in libsa (struct
salfs) into lfs.h, where it doesn't belong, but for the time being
this is necessary in order to allow the accessors (and the various
lfs macros and other goop that relies on them) to compile.
 1.25  23-Jun-2013  dholland Stick ffs_ in front of the following macros:
fragstoblks()
blkstofrags()
fragnum()
blknum()

to finish the job of distinguishing them from the lfs versions, which
Christos renamed the other day.

I believe this is the last of the overtly ambiguous exported symbols
from ffs... or at least, the last of the ones that conflicted with lfs.
ffs still pollutes the C namespace very broadly (as does ufs) and this
needs quite a bit more cleanup.

XXX: boo on macros with lowercase names. But I'm not tackling that just yet.
 1.24  23-Jun-2013  dholland Stick ffs_, ext2_, chfs_, filecore_, cd9660_, or mfs_ in front of
the following symbols so as to disambiguate fully. (Christos already
did the lfs ones.)

lblkno
lblktosize
lfragtosize
numfrags
blkroundup
fragroundup
 1.23  23-Jun-2013  dholland fsbtodb() -> FFS_FSBTODB(), EXT2_FSBTODB(), or MFS_FSBTODB()
dbtofsb() -> FFS_DBTOFSB() or EXT2_DBTOFSB()

(Christos already did the lfs ones a few days back)
 1.22  19-Jun-2013  dholland Rename ambiguous macros:
MAXDIRSIZE -> UFS_MAXDIRSIZE or LFS_MAXDIRSIZE
NINDIR -> FFS_NINDIR, EXT2_NINDIR, LFS_NINDIR, or MFS_NINDIR
INOPB -> FFS_INOPB, LFS_INOPB
INOPF -> FFS_INOPF, LFS_INOPF
blksize -> ffs_blksize, ext2_blksize, or lfs_blksize
sblksize -> ffs_blksize

These are not the only ambiguously defined filesystem macros, of
course, there's a pile more. I may not have found all the ambiguous
definitions of blksize(), too, as there are a lot of other things
called 'blksize' in the system.
 1.21  11-Apr-2009  lukem branches: 1.21.6; 1.21.12;
fix sign-compare issues
 1.20  15-Dec-2007  perry branches: 1.20.12;
convert __attribute__s to applicable cdefs.h macros
 1.19  06-Oct-2007  xtraeme branches: 1.19.2;
Use a two clause license for all the code I contributed.

The envsys code will be changed later.
 1.18  01-May-2007  xtraeme branches: 1.18.4;
Add -b flag into usage().
 1.17  01-May-2007  perseant Add a "-b" option to search a partition for valid alternate superblocks,
rather than searching the disk for partitions. Also, test LFS superblock
checksums before we report them.
 1.16  16-Feb-2007  xtraeme * There's no need to use an int to store the returned value of
ffs_checkver() and later use it in the switch statement, just
use ffs_checkver.
* Remove unneded <sys/queue.h> header.
* Remove LFS from fstypes, it was never used.
* Increase SBCOUNT to 128, works faster.
* Remove unneded casts.
* (-F mode) close fd when the scan has finished or if pread() failed.
* (-F mode) print total size of file.
 1.15  15-Oct-2006  xtraeme Use O_DIRECT (aka Direct I/O) when -F is used.
 1.14  14-Oct-2006  xtraeme Detect FFSv1 partitions with fragsize/blocksize greater than
2048/16384.
 1.13  10-Sep-2006  wiz Sort options in usage and SYNOPSIS.
 1.12  08-Sep-2006  xtraeme - Change the cast of st_size to uint64_t to avoid future problems
with large files.
- u_uintXX_t -> uintXX_t
 1.11  07-Sep-2006  xtraeme Change -f to -F, per mrg's suggestion.
 1.10  07-Sep-2006  xtraeme Add -f file support. Useful to search for partitions on disk images.
 1.9  02-Sep-2005  xtraeme branches: 1.9.2; 1.9.4;
Remove an extra conditional while searching for LFS superblocks,
it's not needed.
 1.8  09-Aug-2005  he Undefine the 17 macros commonly defined by <ufs/ffs/fs.h> and
<ufs/lfs/lfs.h> before including the second of them, and also after
including the second, to ensure the rest of the code doesn't depend
on their (ambigious) definition.

This fixes a build problem for vax; gcc 2.95.3's preprocessor
apparently doesn't like redefinition of macros.

Discussed with xtraeme.
 1.7  09-Aug-2005  xtraeme * Replace lseek() and read() calls with one single pread()
* Align cpg/sgs correctly.
 1.6  31-Jul-2005  christos Pass lint and get/setprogname.
 1.5  31-Jul-2005  xtraeme Add scan_lfs(8), utility to find LFS partitions on disk, useful
to recover lost disklabels.
 1.4  23-Jun-2005  xtraeme Add missing '\n' into usage().
 1.3  15-Jun-2005  christos WARNS=4, misc cleanups.
- void casts
- remove unused notreached
- use a loop instead of code duplication
- use switches and #define constants
 1.2  15-Jun-2005  kleink Use EXIT_{SUCCESS,FAILURE}.
 1.1  15-Jun-2005  xtraeme Add scan_ffs(8) from OpenBSD, it was modified to support FFSv2
for NetBSD (with different blocksizes). Utility to find
FFSv1 and FFSv2 partitions on disks, useful to recover lost
disklabels.

Reviewed by christos.
 1.9.4.2  11-Aug-2006  riz Pull up following revision(s) via patch (requested by ghen in ticket #1460):
distrib/sets/lists/base/mi: revision 1.556, 1.565
distrib/sets/lists/man/mi: revision 1.792, 1.814
sbin/Makefile: revision 1.94
sbin/scan_ffs/Makefile: revision 1.1-1.3, 1.5-1.7
sbin/scan_ffs/scan_ffs.c: revision 1.1-1.9
sbin/scan_ffs/scan_ffs.8: revision 1.1-1.6 via patch
Add scan_ffs(8) from OpenBSD, modified for NetBSD to support FFSv2 and
LFS (scan_lfs(8)). Utility to find FFSv1, FFSv2 and LFS partitions on
disks, useful to recover lost disklabels.
 1.9.4.1  02-Sep-2005  riz file scan_ffs.c was added on branch netbsd-3 on 2006-08-11 04:41:25 +0000
 1.9.2.2  14-Sep-2006  riz Pull up following revision(s) (requested by wiz in ticket #156):
sbin/scan_ffs/scan_ffs.8: revision 1.10
sbin/scan_ffs/scan_ffs.c: revision 1.13
Sort options in usage and SYNOPSIS.
 1.9.2.1  10-Sep-2006  riz Pull up following revision(s) (requested by xtraeme in ticket #146):
sbin/scan_ffs/scan_ffs.8: revision 1.7
sbin/scan_ffs/scan_ffs.8: revision 1.8
sbin/scan_ffs/scan_ffs.8: revision 1.9
sbin/scan_ffs/scan_ffs.c: revision 1.10
sbin/scan_ffs/scan_ffs.c: revision 1.11
sbin/scan_ffs/scan_ffs.c: revision 1.12
Add -f file support. Useful to search for partitions on disk images.
Change -f to -F, per mrg's suggestion.
- Change the cast of st_size to uint64_t to avoid future problems
with large files.
- u_uintXX_t -> uintXX_t
 1.18.4.2  09-Jan-2008  matt sync with HEAD
 1.18.4.1  06-Nov-2007  matt sync with HEAD
 1.19.2.1  27-Dec-2007  mjf Sync with HEAD.
 1.20.12.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.21.12.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.21.12.1  23-Jun-2013  tls resync from head
 1.21.6.1  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.36.2.1  22-Feb-2023  martin Pull up following revision(s) (requested by mlelstv in ticket #94):

sbin/scan_ffs/Makefile: revision 1.11
sbin/scan_ffs/scan_ffs.c: revision 1.37

Work on swapped-endian FFS.

RSS XML Feed