Commit Graph

49 Commits

Author SHA1 Message Date
christos ac31891a27 O_CLOEXEC is not a mode :-) 2022-01-20 14:45:14 +00:00
christos 20f0ca0034 - 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.
2022-01-20 14:44:19 +00:00
mrg da1006fc7e add SIGINFO support. now you can know how far along the scan is. 2022-01-19 01:40:05 +00:00
mrg c2082ece61 remove GCC_NO_ADDR_OF_PACKED_MEMBER for several subdir builds
that are now handled by lfs_accessors.h internally.
2020-09-07 03:09:53 +00:00
mrg cb93b81028 add support for new GCC 9 warnings that may be too much to fix
right now.  new address-of-packed-member and format-overflow
warnings have new GCC_NO_ADDR_OF_PACKED_MEMBER amd
GCC_NO_FORMAT_OVERFLOW variables to remove these warnings.

apply to a bunch of the tree.  mostly, these are real bugs that
should be fixed, but in many cases, only by removing the 'packed'
attribute from some structure that doesn't really need it.  (i
looked at many different ones, and while perhaps 60-80% were
already properly aligned, it wasn't clear to me that the uses
were always coming from sane data vs network alignment, so it
doesn't seem safe to remove packed without careful research for
each affect struct.)  clang already warned (and was not erroring)
for many of these cases, but gcc picked up dozens more.
2020-09-06 07:20:26 +00:00
dholland 6ada0ed75b Teach scan_ffs about lfs64.
(and also about byte-swapped lfs volumes, which might or might not
actually work)
2015-10-15 06:25:23 +00:00
dholland 9e5184b86b 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.
2015-08-02 18:18:09 +00:00
dholland 992b9a23af 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.
2015-08-02 18:14:16 +00:00
dholland 95a8d28c27 Fix assorted 64 -> 32 truncations in lfs. Also, some minor tidyups and
corrections in passing.
2015-08-02 18:08:12 +00:00
dholland 34f0d74c9e 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.
2015-07-28 05:09:34 +00:00
dholland adca8af59e 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.
2015-07-24 06:59:31 +00:00
dholland f59b8f4b3a 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.
2015-07-24 06:56:41 +00:00
dholland 75571afd93 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.
2013-06-23 22:03:34 +00:00
dholland e1610ba4cb 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
2013-06-23 07:28:36 +00:00
dholland 2737439da3 fsbtodb() -> FFS_FSBTODB(), EXT2_FSBTODB(), or MFS_FSBTODB()
dbtofsb() -> FFS_DBTOFSB() or EXT2_DBTOFSB()

(Christos already did the lfs ones a few days back)
2013-06-23 02:06:04 +00:00
dholland f1333577b5 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.
2013-06-19 17:51:25 +00:00
lukem cefb0777de fix sign-compare issues 2009-04-11 06:48:36 +00:00
perry 8b0f9554ff convert __attribute__s to applicable cdefs.h macros 2007-12-15 19:44:37 +00:00
xtraeme 8b2678bd7e Use a two clause license for all the code I contributed.
The envsys code will be changed later.
2007-10-06 07:21:02 +00:00
xtraeme 598409109e Add -b flag into usage(). 2007-05-01 21:43:37 +00:00
xtraeme b83d27bc99 Bump date. 2007-05-01 21:41:52 +00:00
perseant faaef229b4 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.
2007-05-01 21:28:50 +00:00
xtraeme bebefe198b * 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.
2007-02-16 01:32:21 +00:00
wiz a88697ed0e Improve English. 2006-10-17 09:26:21 +00:00
xtraeme 3481053ae9 Use O_DIRECT (aka Direct I/O) when -F is used. 2006-10-15 13:18:24 +00:00
xtraeme 7cf1cb802e Detect FFSv1 partitions with fragsize/blocksize greater than
2048/16384.
2006-10-14 13:22:34 +00:00
wiz 49751ff510 Sort options in usage and SYNOPSIS. 2006-09-10 20:28:52 +00:00
xtraeme a0a2046917 - Change the cast of st_size to uint64_t to avoid future problems
with large files.
- u_uintXX_t -> uintXX_t
2006-09-08 12:38:32 +00:00
xtraeme 96734c01d1 Change -f to -F, per mrg's suggestion. 2006-09-07 02:24:51 +00:00
xtraeme 7aa92d971b Add -f file support. Useful to search for partitions on disk images. 2006-09-07 00:48:21 +00:00
ghen 6c96070844 scan_ffs(8) has been pulled up into netbsd-3 and thus will have
"first appeared in NetBSD 3.1", not 4.0.
2006-08-12 10:14:22 +00:00
xtraeme d5b623c0b0 Specify the scan_ffs manpage, otherwise it will use scan_ffs.1. 2005-09-10 23:15:52 +00:00
wiz e9134234a3 Fold scan_lfs.8 into scan_ffs.8. It's the same program, after all.
Ok'd by xtraeme.
2005-09-10 23:08:37 +00:00
wiz 1635c91622 Improve wording and comma usage. 2005-09-09 20:21:39 +00:00
xtraeme 52f9067be9 Remove an extra conditional while searching for LFS superblocks,
it's not needed.
2005-09-02 17:48:40 +00:00
he 488e14a7ad 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.
2005-08-09 12:59:29 +00:00
xtraeme 4ef578d357 * Replace lseek() and read() calls with one single pread()
* Align cpg/sgs correctly.
2005-08-09 01:49:23 +00:00
christos b6a232217f Pass lint and get/setprogname. 2005-07-31 20:19:40 +00:00
xtraeme c99f08c80d typo 2005-07-31 19:40:50 +00:00
xtraeme 016ad35975 Add scan_lfs(8), utility to find LFS partitions on disk, useful
to recover lost disklabels.
2005-07-31 19:26:06 +00:00
christos 2c6eadc9ce Move WARNS=3 to the Makefile.inc, and add a little const to the remaining
programs that did not compile before.
2005-06-27 01:00:04 +00:00
xtraeme ddd459d409 Add missing '\n' into usage(). 2005-06-23 17:25:31 +00:00
wiz 9a425d58bc Remove superfluous .El; a slight wording change. 2005-06-19 16:01:38 +00:00
wiz 6aa388dc21 Incorporate my review comments. 2005-06-19 16:00:26 +00:00
christos e0db7c68ff WARNS=4, misc cleanups.
- void casts
- remove unused notreached
- use a loop instead of code duplication
- use switches and #define constants
2005-06-15 20:03:03 +00:00
peter d191390e9e fix the date, use .An for names, correct the name (scanffs -> scan_ffs),
.Ox/.Nx for OpenBSD/NetBSD, mention appearance in NetBSD.
2005-06-15 19:02:54 +00:00
kleink 4a74bb7497 Use EXIT_{SUCCESS,FAILURE}. 2005-06-15 18:42:23 +00:00
kleink 32f2d508d6 No need to define SRCS here. 2005-06-15 18:39:46 +00:00
xtraeme b67b8509c2 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.
2005-06-15 18:06:19 +00:00