Home | History | Annotate | only in /src/sbin/dump
History log of /src/sbin/dump
RevisionDateAuthorComments
 1.43 03-Jun-2023  lukem bsd.own.mk: rename GCC_NO_* to CC_WNO_*

Rename compiler-warning-disable variables from
GCC_NO_warning
to
CC_WNO_warning
where warning is the full warning name as used by the compiler.

GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
 1.42 03-Jun-2023  lukem bsd.own.mk: rename to CC_WNO_ADDRESS_OF_PACKED_MEMBER

Provide a single variable
CC_WNO_ADDRESS_OF_PACKED_MEMBER
with options for both clang and gcc, to replace
CLANG_NO_ADDR_OF_PACKED_MEMBER
CC_NO_ADDR_OF_PACKED_MEMBER
GCC_NO_ADDR_OF_PACKED_MEMBER

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
 1.41 06-Sep-2020  mrg 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.
 1.40 13-Oct-2019  mrg introduce some common variables for use in GCC warning disables:

GCC_NO_FORMAT_TRUNCATION -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE -Wno-cast-function-type (GCC 8)

use these to turn off warnings for most GCC-8 complaints. many
of these are false positives, most of the real bugs are already
commited, or are yet to come.


we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."
 1.39 10-Aug-2012  joerg branches: 1.39.32;
Don't depend on HAVE_GCC being always defined.
 1.38 07-Apr-2012  christos use getfsspecname()
 1.37 20-Jun-2011  mrg branches: 1.37.2;
remove most of the remaining HAVE_GCC tests that are always true in
the modern world.
 1.36 11-Apr-2009  lukem branches: 1.36.4;
Enable WARNS=4 by default except for:
dump dump_lfs fsck_ffs fsck_lfs fsdb mount_smbfs
newfs_ext2fs newfs_lfs resize_lfs setkey
 1.35 29-Aug-2008  gmcgarry branches: 1.35.4;
Wrap compiler-specific flags with HAVE_GCC and HAVE_PCC as necessary. Add a few flags for PCC.
 1.34 10-Aug-2008  simonb Remove adding -g to CFLAGS and LDFLAGS. Ancient debug bogon?
 1.33 11-May-2006  mrg branches: 1.33.20; 1.33.24;
sprinkle some -fno-strict-aliasing and -Wno-pointer-sign with GCC4.
 1.32 19-Apr-2005  hannken Snapshot support for dump(8):

- New option `-x backup' takes the dump from a snapshot backed up by `backup'.
The snapshot will be deleted on exit.

- New option `-X' as a synonym for `-x mountpoint' where `mountpoint' is the
file system to be dumped.

Reviewed and Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.31 02-Apr-2003  fvdl branches: 1.31.6;
Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
 1.30 27-Mar-2003  lukem Use "wall -g operator" (instead of private code) to broadcast() messages to
members of the operator group.
Don't install "setgid tty", and remove now unnecessary gid/egid swapping.
Remove utmp trawling code pulled in from usr.bin/who.
The Code is now simpler, and more portable (without the utmp cruft) too.

This is derived from similar work in OpenBSD.
 1.29 19-Aug-2002  lukem Use ${NETBSDSRCDIR}/some/path instead of ${.CURDIR}/../../some/path
 1.28 02-Aug-2002  christos support utmpx
 1.27 25-Dec-2001  lukem document more of the debug options
 1.26 23-Dec-2001  lukem nuke trailing whitespace
 1.25 01-Oct-1999  perseant Working version of aborted dump{,_lfs} join.
 1.24 30-Sep-1999  perseant Back out changes made on the 29th, not at all the changes I intended to commit.
(I don't know how I did it though ... I'll figure it out tonight.)
I'll reapply this, in a working form, this evening.
 1.23 29-Sep-1999  perseant Adapt dump(8) to use filestore-independent (but still ufs-specific)
replacements for NINDIR, fsbtodb, etc. Create dump_lfs by adding a few
LFS-filestore-specific routines. As described in PR#8317.
 1.22 23-Mar-1999  bouyer branches: 1.22.4;
Implement a read cache, as announced on tech-userlevel. Default is 32k
read buffer size, 512 buffer or 15% of the user memory. Can be changed
with the -k and -s options.
 1.21 09-Mar-1999  bouyer Handle "nodump" flag on directories, by not dumping any files or directories
under it. Based on some parts of PR 6705 by Brian Grayson.
In the Makefile, add (commented out) debug options that can be turned on.
 1.20 15-Jan-1999  bouyer #include machine/bswap.h and remove -lutil.
 1.19 18-Mar-1998  bouyer Add support for non-native byte order FFS. The dump is in filesystem byte
order, restore already knows how to byteswap dumps.
 1.18 10-Oct-1997  christos CFLAGS->CPPFLAGS
 1.17 27-May-1997  mrg enable rcmd(). garbage collect.
 1.16 18-Mar-1995  cgd branches: 1.16.4;
convert to new RCS Id conventions; reduce my headache
 1.15 22-Dec-1994  cgd specify man pages the new way.
 1.14 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.13 22-Dec-1993  cgd new version from CSRG, via BSDI, with fixes
 1.12 14-Nov-1993  cgd from Thomas Eberhardt <thomas@mathematik.uni-Bremen.de>:
Some reordering and modifications in the Makefiles for sh, dump,
restore to get dependicies right. The README in /usr/share/mk
states that it's a Bad Thing(tm) to add something after
.include <bsd.prog.mk>, but this seems the only way to get the
dependencies right.
 1.11 12-Nov-1993  cgd oops again; fix that last
 1.10 12-Nov-1993  cgd oops; fix that last
 1.9 12-Nov-1993  cgd add LDSTATIC
 1.8 01-Aug-1993  mycroft Add RCS identifiers.
 1.7 18-Jul-1993  mycroft Use ${COPY}, not -c for install.
 1.6 18-Apr-1993  mycroft Okay, so I was confused (but only a little).
 1.5 18-Apr-1993  mycroft Make rdump target match normal program target.
(This should probably be in a separate directory, no?)
 1.4 08-Apr-1993  cgd make install copy
 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.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.16.4.1 17-Feb-1997  mrg this program is not setuid in the new-rcmd-world-order
 1.22.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.31.6.1 21-Apr-2005  tron Pull up revision 1.32 (requested by hannken in ticket #184):
Snapshot support for dump(8):
- New option `-x backup' takes the dump from a snapshot backed up by `backup'.
The snapshot will be deleted on exit.
- New option `-X' as a synonym for `-x mountpoint' where `mountpoint' is the
file system to be dumped.
Reviewed and Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.33.24.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.33.20.1 28-Sep-2008  mjf Sync with HEAD.
 1.35.4.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.36.4.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.37.2.2 30-Oct-2012  yamt sync with head
 1.37.2.1 17-Apr-2012  yamt sync with head
 1.39.32.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.72 19-Aug-2019  perseant Add -D flag to allow the user to specify an alternate dumpdates file.
Closes PR #54469.
 1.71 25-Mar-2019  wiz Bump date for previous.
 1.70 25-Mar-2019  manu Add -U flag to dump(8) and dump_lfs(8) to specify dumpdates entry

This address situations where dump(8) cannot figure out the device being
dumped. It also allows tracking of subvolume dumps by using virtual
device as dumpdates entry.
 1.69 15-Jul-2018  dholland Document what rdump is (was once) for. PR 53442.
 1.68 15-Aug-2016  sevan branches: 1.68.6; 1.68.12; 1.68.14;
dump was there from v4.
Confirmed from the TUHS hosted copies of man pages.
Bump date.
 1.67 24-Aug-2015  bouyer Default the read block size (-k default value) to kern.maxphys (usually
64k these days). This gives a noticable performance boost on large filesystems.
 1.66 28-Apr-2015  prlw1 Fix typos
 1.65 29-Aug-2012  dholland branches: 1.65.10;
Use more markup, fix English usage.
 1.64 19-Feb-2012  wiz Sort option descriptions a bit more.
 1.63 19-Feb-2012  christos PR/45735: Bug Hunting: The dump(8) manpage, as well as the program's `usage'-line,
needs improvement
 1.62 05-Nov-2010  hannken branches: 1.62.6; 1.62.8;
File system snapshots are no longer experimental.
 1.61 14-May-2010  jruoho Use a list for the list of bugs.
 1.60 26-Feb-2010  wiz -i does not take an argument. Remove unnecessary Bk/Ek. New sentence, new line.
 1.59 26-Feb-2010  christos PR/42883: Greywolf: Add -i flag which brings "true incremental" capability.
 1.58 30-Jan-2009  enami Use indent-synopsis instead of iS register. The latter is a register
used in BSD derived .Nm implementation.
 1.57 12-Aug-2008  simonb We don't need to dump WAPBL log files - don't dump files with SF_LOG
flag set, and document this.
 1.56 11-Sep-2005  wiz branches: 1.56.20; 1.56.24;
Argument is read-blocksize, not "read blocksize". From YOMURA Masanori in private mail.
 1.55 19-Apr-2005  wiz Sort SEE ALSO.
 1.54 19-Apr-2005  hannken Snapshot support for dump(8):

- New option `-x backup' takes the dump from a snapshot backed up by `backup'.
The snapshot will be deleted on exit.

- New option `-X' as a synonym for `-x mountpoint' where `mountpoint' is the
file system to be dumped.

Reviewed and Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.53 07-Aug-2003  agc branches: 1.53.6;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22308, verified by myself.
 1.52 26-May-2003  lukem * Document $RCMD_CMD in environ(7).
* Cross-reference rcmd(1), rcmd(3), and environ(7) as appropriate.

Should fix [bin/21670] from Geoff Wing.
 1.51 27-Mar-2003  lukem Use "wall -g operator" (instead of private code) to broadcast() messages to
members of the operator group.
Don't install "setgid tty", and remove now unnecessary gid/egid swapping.
Remove utmp trawling code pulled in from usr.bin/who.
The Code is now simpler, and more portable (without the utmp cruft) too.

This is derived from similar work in OpenBSD.
 1.50 25-Feb-2003  wiz .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
 1.49 04-Feb-2003  perry "Utilize" has exactly the same meaning as "use," but it is more
difficult to read and understand. Most manuals of English style
therefore say that you should use "use".
 1.48 01-Oct-2002  wiz New sentence, new line. By Robert Elz with minimal fixes.
 1.47 26-Feb-2002  wiz Typo fix, from jslag@prop.walkerart.org via OpenBSD.
 1.46 21-Jan-2002  wiz Fix typo in macro.
 1.45 07-Jan-2002  bouyer For -l: specify the timeout on the command line (in seconds) instead of
hardwiring it to 2s, as suggested on tech-userlevel.
 1.44 30-Dec-2001  lukem Add -a to "auto-size" the tape, rather than relying upon other options
to define the tape size. Requires the tape driver to either return ENOSPC
at end of media, or 0 when a write is attempted (such as the "early warning"
support in st(4) enabled with "mt eew 1"). From FreeBSD.
 1.43 14-Dec-2001  bouyer Add a -l (autoload) flag. For multivolume dumps, this makes dump eject the
tape when a volume is full, and try to reopen the tape drive for 2 mn.
To be used with tape changers which load the next tape when the current one is
ejected.
While I'm there fix eject handling for remote tape.
 1.42 07-Dec-2001  wiz One '\' too many.
 1.41 16-Nov-2001  lukem relax the restriction on -F that the file system image argument must be a
regular file
 1.40 15-Oct-2001  wiz Whitespace fixes, sort SEE ALSO, sort sections.
 1.39 15-Oct-2001  blymn Add the capability for dump to print timestamps on all informational
messages.
 1.38 14-Aug-2001  lukem - implement -F, which indicates that files-to-dump is a regular file
containing a file system image (instead of being a single file as
part of a subtree dump)
- use "file system" instead of "filesystem" or "file-system"
 1.37 05-Jun-2001  wiz Drop arguments of .Os.
 1.36 28-May-2001  lukem * improve parsing of file-systems-to-dump when a path is given:
- if it's a path to an unmounted file-system listed in /etc/fstab, use
that instead of assuming the user wanted a subtree dump of the parent
directory. this restores the behaviour of dump before the subtree
dumping code went in.
- if it's a path to a mounted file-system which is not in /etc/fstab,
use the info from getmntinfo(3). previously, dump would choke.
* implement error checked malloc(), calloc(), strdup(), and use
appropriately (some of the calloc()s weren't being checked)
* use 'file-system' instead of 'filesystem' in the man page
 1.35 07-May-2001  tron Add a new option "e" to "dump" which allows to eject tapes automatically
if a tape change is required.
 1.34 01-Jul-1999  abs branches: 1.34.8;
Note the default tape device is taken from _PATH_DEFTAPE in /usr/include/paths.h
 1.33 28-Jun-1999  abs Default device is nrst0 not rst0
 1.32 23-Mar-1999  bouyer branches: 1.32.2;
Implement a read cache, as announced on tech-userlevel. Default is 32k
read buffer size, 512 buffer or 15% of the user memory. Can be changed
with the -k and -s options.
 1.31 09-Mar-1999  bouyer Handle "nodump" flag on directories, by not dumping any files or directories
under it. Based on some parts of PR 6705 by Brian Grayson.
In the Makefile, add (commented out) debug options that can be turned on.
 1.30 07-Mar-1999  mycroft Clean up SYNOPSIS formatting.
 1.29 03-Jan-1999  lukem s/1998/1999/
 1.28 03-Jan-1999  lukem add support for '-L label', which file(1) and restore(1) can extract
from the header.
mostly based on [bin/6715] from Brian Grayson <bgrayson@ece.utexas.edu>
 1.27 02-Jan-1999  tron Add reference to "st(4)" as suggested by Brian Grayson in PR bin/6713.
 1.26 11-Aug-1998  frueauf A dump level above 0 saves new or modified files since the last dump of
a lower level, not the same level. Fixes pr 5402 by Kevin Sullivan.
 1.25 03-Jul-1998  fair PR#5697 + nroff cleanup
 1.24 29-Apr-1998  fair fix bad .Xr references
 1.23 28-Apr-1998  fair Change occurrences of "UNIX" to .Ux or .At as appropriate.
 1.22 11-Nov-1997  mrg add missing .Nm sections.
 1.21 20-Oct-1997  enami branches: 1.21.2;
Fix .Nm usage.
 1.20 18-Sep-1997  lukem Various changes from Brian Grayson <bgrayson@ece.utexas.edu> in [bin/4103]
* exit after providing an estimate if -S was given. the PR used -e,
but checking around indicated prior art in Solaris usin -S.
* remove superfluous 'DUMP:' prefix in two messages
* initialise blocksperfile explicitly (not necessary, but everything
else in that section gets initialised, so be consistant :)
* display the ``pretty'' name of the dumped directory, so the user
knows if it's a subset or not
 1.19 16-Sep-1997  lukem resolve conflicts from lite-2 import
 1.18 15-Sep-1997  lukem * cleanup for WARNS=1
* fix use of .Nm
* comment out some unused(?) functions
 1.17 05-Jun-1997  lukem cleanup xrefs
 1.16 05-Jun-1997  lukem * Add the ability to dump specific files & directories of a single
filesystem. This uses fts(3) to access the directory structure (and
not the raw device), so the standard access permissions are adhered
to (unlike dumping an entire filesystem, which just requires read
access to the raw disk device).
* Support SIGINFO status reporting.
* Remove now unused variables that previously stored the (e)uid.
* Be more informative in a couple of error messages.
 1.15 15-Apr-1997  lukem use _PATH_DEFTAPE from <paths.h>
change doco references/examples from /dev/rmt* to /dev/rst*
 1.14 05-Feb-1996  mrg support $TAPE. update manual to reflect reality (#1937).
 1.13 02-Feb-1996  phil Add /dev/rst* to FILES section. (pr 601) (Matches mt man page.)
 1.12 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.11 21-Feb-1995  mycroft Fix an old formatting glitch.
 1.10 20-Feb-1995  mycroft Use getopt(3), with obsolete() from restore(8) for backward compatibility.
 1.9 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.8 28-Jan-1994  jtc More spelling errors.
 1.7 22-Dec-1993  cgd new version from CSRG, via BSDI, with fixes
 1.6 30-Nov-1993  jtc Use ".At v6" macro instead of spelling out "Version 6 AT&T UNIX".
 1.5 20-Aug-1993  jtc Dump is now in /sbin.
 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.21.2.1 11-Nov-1997  mrg pull up from trunk: add missing .Nm sections.
 1.32.2.1 02-Jul-1999  perry pullup 1.32->1.33 (abs): Correct default device from /dev/rst0 to /dev/nrst0
 1.34.8.3 16-Jan-2002  he Pull up revision 1.44 (via patch, requested by bouyer):
Add an ``-a'' option to ``auto-size'' the tape, rather than
relying upon other options to define the tape size.
 1.34.8.2 16-Jan-2002  he Pull up revisions 1.43,1.45 (via patch, requested by bouyer):
Implement ``-l <timeout>'' option for use with e.g. autochangers.
 1.34.8.1 09-May-2001  he Pull up revision 1.35 (requested by tron):
Add a new option ``e'' to dump which directs it to eject tapes
automatically if a tape change is required.
 1.53.6.2 21-Apr-2005  tron Pull up revision 1.55 (requested by hannken in ticket #184):
Sort SEE ALSO.
 1.53.6.1 21-Apr-2005  tron Pull up revision 1.54 (requested by hannken in ticket #184):
Snapshot support for dump(8):
- New option `-x backup' takes the dump from a snapshot backed up by `backup'.
The snapshot will be deleted on exit.
- New option `-X' as a synonym for `-x mountpoint' where `mountpoint' is the
file system to be dumped.
Reviewed and Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.56.24.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.56.20.1 28-Sep-2008  mjf Sync with HEAD.
 1.62.8.1 08-Mar-2016  snj Pull up following revision(s) (requested by bouyer in ticket #1331):
sbin/dump/dump.8: revision 1.67 via patch
sbin/dump/main.c: revision 1.72
sbin/dump/rcache.c: revision 1.25
Default the read block size (-k default value) to kern.maxphys (usually
64k these days). This gives a noticable performance boost on large filesystems.
 1.62.6.2 30-Oct-2012  yamt sync with head
 1.62.6.1 17-Apr-2012  yamt sync with head
 1.65.10.1 06-Nov-2015  riz Pull up following revision(s) (requested by bouyer in ticket #990):
sbin/dump/rcache.c: revision 1.25
sbin/dump/dump.8: revision 1.67
sbin/dump/main.c: revision 1.72
Default the read block size (-k default value) to kern.maxphys (usually
64k these days). This gives a noticable performance boost on large filesystems.
 1.68.14.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.68.14.1 10-Jun-2019  christos Sync with HEAD
 1.68.12.1 28-Jul-2018  pgoyette Sync with HEAD
 1.68.6.1 29-Mar-2019  martin Pull up following revision(s) (requested by manu in ticket #1221):

sbin/dump/tape.c: revision 1.55
sbin/dump_lfs/dump_lfs.8: revision 1.18
sbin/dump/dump.h: revision 1.56
sbin/dump/dump.8: revision 1.69
sbin/dump/dump.h: revision 1.57
sbin/dump/ffs_inode.c: revision 1.23
sbin/dump/optr.c: revision 1.43
sbin/dump/itime.c: revision 1.21
sbin/dump/main.c: revision 1.74
sbin/dump/itime.c: revision 1.22
sbin/dump/main.c: revision 1.75
sbin/dump/dump.8: revision 1.70
sbin/dump/traverse.c: revision 1.52
sbin/dump/dump.8: revision 1.71

Document what rdump is (was once) for. PR 53442.

Use getfsspecname() to fill the filesystem argument in dumpdates.
While here, make sure that the error strings terminate with newline
consistently, and add a function that adds the system error string.

Add -U flag to dump(8) and dump_lfs(8) to specify dumpdates entry
This address situations where dump(8) cannot figure out the device being
dumped. It also allows tracking of subvolume dumps by using virtual
device as dumpdates entry.

Bump date for previous.
 1.60 19-Jun-2021  christos Add external attribute dumping and restoring support from FreeBSD.
Does not fully work yet, attributes are being saved and restored correctly,
but don't appear in the restored files somehow.
 1.59 03-Dec-2020  kre PR bin/55834

count blocks written in unsigned 64 bit counter
rather than signed int which overflows after 2^31-1
blocks (2TiB) after which neither the 5 minute
status updates or SIGINFO (^T) reports are issued
until the negative numbers increase past 0 and
wildly inaccurate reports would be written.
 1.58 05-Apr-2020  joerg Fix depenency on common symbols in sbin.
 1.57 25-Mar-2019  manu branches: 1.57.2;
Add -U flag to dump(8) and dump_lfs(8) to specify dumpdates entry

This address situations where dump(8) cannot figure out the device being
dumped. It also allows tracking of subvolume dumps by using virtual
device as dumpdates entry.
 1.56 01-Mar-2019  christos Use getfsspecname() to fill the filesystem argument in dumpdates.
While here, make sure that the error strings terminate with newline
consistently, and add a function that adds the system error string.
 1.55 03-Feb-2019  mrg - mark Exit() __dead
- bump a buffer size to avoid possible truncation
- adding missing fallthru comment
 1.54 16-Nov-2015  christos branches: 1.54.8; 1.54.16;
- update NAME_MAX to match the kernel.
- add a comment about where the constant is used.
 1.53 12-Aug-2015  dholland Hack up dinode usage to be 64 vs. 32 as needed. Part 1.

(This part changes the native lfs code; the ufs-derived code already
has 64 vs. 32 logic, but as aspects of it are unsafe, and don't
entirely interoperate cleanly with the lfs 64/32 stuff, pass 2 will be
rehashing that.)
 1.52 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.51 15-Jun-2013  christos handle new lfs split
 1.50 22-Jan-2013  dholland Stuff UFS_ in front of a few of ufs's symbols to reduce namespace
pollution. Specifically:
ROOTINO -> UFS_ROOTINO
WINO -> UFS_WINO
NXADDR -> UFS_NXADDR
NDADDR -> UFS_NDADDR
NIADDR -> UFS_NIADDR
MAXSYMLINKLEN -> UFS_MAXSYMLINKLEN
MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency)

Sort out ext2fs's misuse of NDADDR and NIADDR; fortunately, these have
the same values in ext2fs and ffs.

No functional change intended.
 1.49 13-Jan-2013  dholland Use __printflike.
 1.48 13-Jan-2013  dholland Add some const.
 1.47 05-May-2012  christos branches: 1.47.2;
remove ancient crap
 1.46 26-Feb-2010  christos branches: 1.46.6;
PR/42883: Greywolf: Add -i flag which brings "true incremental" capability.
 1.45 16-Feb-2008  matt Fix some inconsisent/conflicting definitions and missing parameters
 1.44 26-Oct-2006  hannken branches: 1.44.8; 1.44.10;
When using a snapshot take the snapshot raw device on further open.

Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)

Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.43 24-Jun-2006  perseant Change LFCNWRAP{STOP,GO} to make them more suitable for snapshotting; in
particular, the caller can now choose whether to wait for the condition
to be met, and if the caller of LFCNWRAPSTOP dies or otherwise closes
the descriptor, the filesystem is started again. Updated the ckckp
regression test to use the new semantics.

dump_lfs(8) now uses the fcntls to implement LFS-style snapshotting through
the -X flag, addressing PR#33457 albeit not using fss(4). Fixed a couple
other problems with dump_lfs that manifested themselves during testing.
 1.42 21-Apr-2006  skrll Don't use cast expressions as lvalues as newer versions of gcc warn.
 1.41 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.40 27-Jun-2005  christos sprinkle const
 1.39 21-Apr-2004  christos branches: 1.39.2; 1.39.4; 1.39.6;
Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.38 15-Mar-2004  lukem Adjust tstart_volume (volume start time) by the time spent in query(),
similar to the adjustment for tstart_writing made in optr.c rev 1.4.
Should fix PR bin/19711 from matthew green.
 1.37 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.36 02-Apr-2003  fvdl Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
 1.35 27-Mar-2003  lukem Use "wall -g operator" (instead of private code) to broadcast() messages to
members of the operator group.
Don't install "setgid tty", and remove now unnecessary gid/egid swapping.
Remove utmp trawling code pulled in from usr.bin/who.
The Code is now simpler, and more portable (without the utmp cruft) too.

This is derived from similar work in OpenBSD.
 1.34 24-Jan-2003  fvdl Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
 1.33 30-Dec-2001  lukem Add -a to "auto-size" the tape, rather than relying upon other options
to define the tape size. Requires the tape driver to either return ENOSPC
at end of media, or 0 when a write is attempted (such as the "early warning"
support in st(4) enabled with "mt eew 1"). From FreeBSD.
 1.32 25-Dec-2001  lukem Fixes from FreeBSD:
- Fix error if first tape was write protected. Fix NetBSD PRs 4754 and 6098.
- Make dump exit codes confirm to manual page.
- Use \a instead of \7 to make noise.
- Fix estimated number of tapes for huge dumps to cartridges.
- Use <sys/queue.h> SLIST_* instead of home-rolled lists.
- Do not exit if unable to read or create /etc/dumpdates.
- Support output (tape) device returning ENOSPC for end-of-media on a write.

Fixes by me:
- Remove unused ddates_in.
- Don't dump core if SIGINFO is received before 1 second has elapsed.
- Only process SIGINFO in current "active" child.
- Don't dump core in -w if dumpdates wasn't readable and ddatev == NULL
- Minor KNF; wrap some lines
 1.31 22-Dec-2001  lukem - use correct type for minTime in findlru() (size_t instead of int)
- clean up whitespace
 1.30 14-Dec-2001  bouyer Add a -l (autoload) flag. For multivolume dumps, this makes dump eject the
tape when a volume is full, and try to reopen the tape drive for 2 mn.
To be used with tape changers which load the next tape when the current one is
ejected.
While I'm there fix eject handling for remote tape.
 1.29 15-Oct-2001  blymn Add the capability for dump to print timestamps on all informational
messages.
 1.28 14-Aug-2001  lukem s/filesystem/file system/
 1.27 28-May-2001  lukem * improve parsing of file-systems-to-dump when a path is given:
- if it's a path to an unmounted file-system listed in /etc/fstab, use
that instead of assuming the user wanted a subtree dump of the parent
directory. this restores the behaviour of dump before the subtree
dumping code went in.
- if it's a path to a mounted file-system which is not in /etc/fstab,
use the info from getmntinfo(3). previously, dump would choke.
* implement error checked malloc(), calloc(), strdup(), and use
appropriately (some of the calloc()s weren't being checked)
* use 'file-system' instead of 'filesystem' in the man page
 1.26 27-May-2001  lukem knf to ansi
 1.25 12-May-2001  tron Fix bug in new "e" option: only eject tape if it is full, not if the dump
was finished.
 1.24 07-May-2001  tron Add a new option "e" to "dump" which allows to eject tapes automatically
if a tape change is required.
 1.23 04-Feb-2001  christos restore needs the rcmd operations.
 1.22 04-Feb-2001  christos fix redundant decls
 1.21 13-Dec-2000  scw `dev_bsize' needs to be declared extern.
 1.20 10-Oct-2000  is Format string cleanups by Bill Sommerfeld.
 1.19 01-Oct-1999  perseant branches: 1.19.6;
Working version of aborted dump{,_lfs} join.
 1.18 30-Sep-1999  perseant Back out changes made on the 29th, not at all the changes I intended to commit.
(I don't know how I did it though ... I'll figure it out tonight.)
I'll reapply this, in a working form, this evening.
 1.17 29-Sep-1999  perseant Adapt dump(8) to use filestore-independent (but still ufs-specific)
replacements for NINDIR, fsbtodb, etc. Create dump_lfs by adding a few
LFS-filestore-specific routines. As described in PR#8317.
 1.16 23-Mar-1999  bouyer branches: 1.16.2; 1.16.4;
Implement a read cache, as announced on tech-userlevel. Default is 32k
read buffer size, 512 buffer or 15% of the user memory. Can be changed
with the -k and -s options.
 1.15 15-Jan-1999  bouyer #include machine/bswap.h and remove -lutil.
 1.14 18-Mar-1998  bouyer Add support for non-native byte order FFS. The dump is in filesystem byte
order, restore already knows how to byteswap dumps.
 1.13 16-Sep-1997  lukem resolve conflicts from lite-2 import
 1.12 15-Sep-1997  lukem remove __dead
 1.11 05-Jun-1997  lukem * Add the ability to dump specific files & directories of a single
filesystem. This uses fts(3) to access the directory structure (and
not the raw device), so the standard access permissions are adhered
to (unlike dumping an entire filesystem, which just requires read
access to the raw disk device).
* Support SIGINFO status reporting.
* Remove now unused variables that previously stored the (e)uid.
* Be more informative in a couple of error messages.
 1.10 10-Apr-1997  lukem Implement changes from [bin/1915]
* 'w' and 'W' display the year
* verbosity additions displaying total & per-volume transfer times and rates
 1.9 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.8 23-Sep-1994  mycroft Eliminate uses of some obsolete functions.
 1.7 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.6 22-Dec-1993  cgd new version from CSRG, via BSDI, with fixes
 1.5 02-Dec-1993  mycroft Avoid core dumping if /etc/dumpdates is not present. Note that only file
systems listed in dumpdates are display by `dump w' and `dump W'; this is
probably a bug.
Original bug reported by John Brezak <brezak@ch.hp.com>.
 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.16.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.16.2.1 10-Oct-2000  he Pull up revision 1.20 (requested by is):
Format string cleanup.
 1.19.6.8 28-Mar-2002  he Pull up revision 1.27 (via patch, requested by bouyer):
Improve behaviour when a path is given:
1) check if the path is an unmounted file system listed in fstab
2) check if it is a path to a mounted file system not listed in fstab
Fixes PR#15790.
 1.19.6.7 17-Jan-2002  he Pull up revision 1.23 (via patch, requested by bouyer):
Fix the ``Implement -l <timeout>'' pull-up;
restore needs the rcmd operation.
 1.19.6.6 16-Jan-2002  he Pull up revision 1.33 (via patch, requested by bouyer):
Add an ``-a'' option to ``auto-size'' the tape, rather than
relying upon other options to define the tape size.
 1.19.6.5 16-Jan-2002  he Pull up revisions 1.31-1.32 (via patch, requested by bouyer):
Various fixes:
o Fix error if first tape is write-protected; fixes PR#4754 and PR#6098
o Make error codes conform to manual page
o Use \a to make noise
o Fix estimated number of tapes for huge dumps to cartridges
o Use <sys/queue.h> SLIST_* macros instead of homegrown variants
o Do not exit if unable to read/create /etc/dumpdates
o Support output (tape) device returning ENOSPC for end-of-media on write
o Don't dump core if SIGINFO is received before 1 second has elapsed
o Only process SIGINFO in currently active child
o Ensure current (sub)block isn't past end of file system -- fixes
"spins forever but does nothing" bug.
o Some other minor fixes (types, whitespace, KNF, unifdef sunos, ...)
 1.19.6.4 16-Jan-2002  he Pull up revision 1.30 (via patch, requested by bouyer):
Implement ``-l <timeout>'' option for use with e.g. autochangers.
 1.19.6.3 15-May-2001  he Pull up revision 1.25 (requested by tron):
Fix bug in new ``e'' option: only eject tape if it is full, not
if the dump was finished.
 1.19.6.2 09-May-2001  he Pull up revision 1.24 (requested by tron):
Add a new option ``e'' to dump which directs it to eject tapes
automatically if a tape change is required.
 1.19.6.1 18-Oct-2000  tv Pullup sbin string format fixes [is].
See "cvs log" for explicit revision numbers per file, from sommerfeld.
 1.39.6.1 11-Nov-2006  bouyer Pull up following revision(s) (requested by hannken in ticket #1573):
sbin/dump/snapshot.h: revision 1.3 via patch
sbin/dump/snapshot.c: revision 1.3 via patch
sbin/dump/main.c: revision 1.63 via patch
sbin/dump/tape.c: revision 1.47 via patch
sbin/dump/dump.h: revision 1.44 via patch
When using a snapshot take the snapshot raw device on further open.
Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)
Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.39.4.1 11-Nov-2006  bouyer Pull up following revision(s) (requested by hannken in ticket #1573):
sbin/dump/snapshot.h: revision 1.3 via patch
sbin/dump/snapshot.c: revision 1.3 via patch
sbin/dump/main.c: revision 1.63 via patch
sbin/dump/tape.c: revision 1.47 via patch
sbin/dump/dump.h: revision 1.44 via patch
When using a snapshot take the snapshot raw device on further open.
Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)
Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.39.2.1 11-Nov-2006  bouyer Pull up following revision(s) (requested by hannken in ticket #1573):
sbin/dump/snapshot.h: revision 1.3 via patch
sbin/dump/snapshot.c: revision 1.3 via patch
sbin/dump/main.c: revision 1.63 via patch
sbin/dump/tape.c: revision 1.47 via patch
sbin/dump/dump.h: revision 1.44 via patch
When using a snapshot take the snapshot raw device on further open.
Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)
Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.44.10.1 18-Feb-2008  mjf Sync with HEAD.
 1.44.8.1 23-Mar-2008  matt sync with HEAD
 1.46.6.3 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.46.6.2 23-Jan-2013  yamt sync with head
 1.46.6.1 23-May-2012  yamt sync with head.
 1.47.2.2 23-Jun-2013  tls resync from head
 1.47.2.1 25-Feb-2013  tls resync with head
 1.54.16.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.54.16.1 10-Jun-2019  christos Sync with HEAD
 1.54.8.2 07-Dec-2020  martin Pull up following revision(s) (requested by kre in ticket #1630):

sbin/dump/dump.h: revision 1.59
sbin/dump/main.c: revision 1.78

PR bin/55834

count blocks written in unsigned 64 bit counter
rather than signed int which overflows after 2^31-1
blocks (2TiB) after which neither the 5 minute
status updates or SIGINFO (^T) reports are issued
until the negative numbers increase past 0 and
wildly inaccurate reports would be written.
 1.54.8.1 29-Mar-2019  martin Pull up following revision(s) (requested by manu in ticket #1221):

sbin/dump/tape.c: revision 1.55
sbin/dump_lfs/dump_lfs.8: revision 1.18
sbin/dump/dump.h: revision 1.56
sbin/dump/dump.8: revision 1.69
sbin/dump/dump.h: revision 1.57
sbin/dump/ffs_inode.c: revision 1.23
sbin/dump/optr.c: revision 1.43
sbin/dump/itime.c: revision 1.21
sbin/dump/main.c: revision 1.74
sbin/dump/itime.c: revision 1.22
sbin/dump/main.c: revision 1.75
sbin/dump/dump.8: revision 1.70
sbin/dump/traverse.c: revision 1.52
sbin/dump/dump.8: revision 1.71

Document what rdump is (was once) for. PR 53442.

Use getfsspecname() to fill the filesystem argument in dumpdates.
While here, make sure that the error strings terminate with newline
consistently, and add a function that adds the system error string.

Add -U flag to dump(8) and dump_lfs(8) to specify dumpdates entry
This address situations where dump(8) cannot figure out the device being
dumped. It also allows tracking of subvolume dumps by using virtual
device as dumpdates entry.

Bump date for previous.
 1.57.2.1 06-Dec-2020  martin Pull up following revision(s) (requested by kre in ticket #1139):

sbin/dump/dump.h: revision 1.59
sbin/dump/main.c: revision 1.78

PR bin/55834

count blocks written in unsigned 64 bit counter
rather than signed int which overflows after 2^31-1
blocks (2TiB) after which neither the 5 minute
status updates or SIGINFO (^T) reports are issued
until the negative numbers increase past 0 and
wildly inaccurate reports would be written.
 1.5 22-Dec-1993  mycroft Clean up deleted files.
 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.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.7 22-Dec-1993  mycroft Clean up deleted files.
 1.6 02-Dec-1993  mycroft Change the four inode loops to the form:
for (ino = 1; ino <= maxino; ino++)
Based on a bug fix from Havard Eidnes <Havard.Eidnes@runit.sintef.no> and
suggestion by Chris Torek <torek@horse.ee.lbl.gov>.
 1.5 01-Aug-1993  mycroft Add RCS identifiers.
 1.4 20-Apr-1993  mycroft Don't overrun end of argv.
 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.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.6 22-Dec-1993  mycroft Clean up deleted files.
 1.5 01-Aug-1993  mycroft Add RCS identifiers.
 1.4 20-Apr-1993  mycroft Don't dereference NULL pointer.
 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.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.37 15-Jun-2013  christos handle new lfs split
 1.36 13-Jan-2013  dholland Use <ctype.h> functions correctly.
 1.35 13-Jan-2013  dholland Add some const.
 1.34 29-Aug-2011  joerg branches: 1.34.2; 1.34.8;
Use __dead
 1.33 11-Apr-2009  lukem fix sign-compare issue
 1.32 18-Dec-2006  christos branches: 1.32.22;
Convert a couple of "(void)&" constructs to volatile.
Flag various unused parameters in restore and dump so that these will
compile with -Wextra. (Note: restore uses some stuff from dump.)
 1.31 27-Jun-2005  christos sprinkle const
 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 25-Dec-2001  lukem Fixes from FreeBSD:
- Fix error if first tape was write protected. Fix NetBSD PRs 4754 and 6098.
- Make dump exit codes confirm to manual page.
- Use \a instead of \7 to make noise.
- Fix estimated number of tapes for huge dumps to cartridges.
- Use <sys/queue.h> SLIST_* instead of home-rolled lists.
- Do not exit if unable to read or create /etc/dumpdates.
- Support output (tape) device returning ENOSPC for end-of-media on a write.

Fixes by me:
- Remove unused ddates_in.
- Don't dump core if SIGINFO is received before 1 second has elapsed.
- Only process SIGINFO in current "active" child.
- Don't dump core in -w if dumpdates wasn't readable and ddatev == NULL
- Minor KNF; wrap some lines
 1.28 23-Dec-2001  lukem unifdef sunos
 1.27 14-Dec-2001  bouyer Add a -l (autoload) flag. For multivolume dumps, this makes dump eject the
tape when a volume is full, and try to reopen the tape drive for 2 mn.
To be used with tape changers which load the next tape when the current one is
ejected.
While I'm there fix eject handling for remote tape.
 1.26 01-Nov-2001  lukem fix -Wshadow warnings
 1.25 28-May-2001  lukem unifdef !__STDC__ (missed in previous)
 1.24 27-May-2001  lukem knf to ansi
 1.23 26-May-2001  lukem use strdup appropriately
 1.22 04-Feb-2001  christos fix redundant decls
 1.21 30-Jul-1998  thorpej branches: 1.21.10;
Turn on TCP_NODELAY on the remote tape socket, from FreeBSD. Here is the
commit message from Bill Fenner:

Turn on TCP_NODELAY on the remote socket, to turn off sender silly window
syndrome avoidance. The combination of SWS avoidance and ack-every-other
causes low throughput if the block size divided by the MSS is odd (which
is true with the default block size and MSS).
Turning on TCP_NODELAY disables the Nagle algorithm and sender SWS avoidance.
The rdump request/response protocol can not invoke Nagle and cannot cause
SWS, so this has no negative effects.

Also, put back the code that sets the TOS to "throughput", which seems to
have been erroneously removed during the Lite-2 merge.
 1.20 30-Mar-1998  mrg use <errno.h>
 1.19 16-Sep-1997  lukem resolve conflicts from lite-2 import
 1.18 15-Sep-1997  lukem * cleanup for WARNS=1
* fix use of .Nm
* comment out some unused(?) functions
 1.17 05-Jun-1997  mrg fix PR#3710, reported by Tatoku Ogaito <tacha@trap.fukui-med.ac.jp>.
- don't pass pw->pw_name into functions; make a copy.
 1.16 05-Jun-1997  lukem * Add the ability to dump specific files & directories of a single
filesystem. This uses fts(3) to access the directory structure (and
not the raw device), so the standard access permissions are adhered
to (unlike dumping an entire filesystem, which just requires read
access to the raw disk device).
* Support SIGINFO status reporting.
* Remove now unused variables that previously stored the (e)uid.
* Be more informative in a couple of error messages.
 1.15 27-May-1997  mrg enable rcmd(). garbage collect.
 1.14 26-May-1997  mrg use orcmd() for now.
 1.13 21-Apr-1997  mrg be safe with buffers.
 1.12 15-Apr-1997  lukem remove use of "register".
 1.11 05-Nov-1996  thorpej - If rcmd() fails, don't do any of the setsockopt() calls.
- Since the TCP_MAXSEG setsockopt can only descrease the MSS, and never
increase it, do an IP_TOS:IPTOS_THROUGHPUT setsockopt instead, since
dump is a bulk transfer.
Submitted by Bill Fenner <fenner@parc.xerox.com>.
 1.10 15-Mar-1996  scottr Be more paranoid with our effective uid.
 1.9 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.8 23-Sep-1994  mycroft Eliminate uses of some obsolete functions.
 1.7 23-Sep-1994  mycroft err(3)/warn(3) cleanup
 1.6 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.5 22-Dec-1993  cgd new version from CSRG, via BSDI, with fixes
 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.21.10.2 16-Jan-2002  he Pull up revisions 1.28-1.29 (via patch, requested by bouyer):
Various fixes:
o Fix error if first tape is write-protected; fixes PR#4754 and PR#6098
o Make error codes conform to manual page
o Use \a to make noise
o Fix estimated number of tapes for huge dumps to cartridges
o Use <sys/queue.h> SLIST_* macros instead of homegrown variants
o Do not exit if unable to read/create /etc/dumpdates
o Support output (tape) device returning ENOSPC for end-of-media on write
o Don't dump core if SIGINFO is received before 1 second has elapsed
o Only process SIGINFO in currently active child
o Ensure current (sub)block isn't past end of file system -- fixes
"spins forever but does nothing" bug.
o Some other minor fixes (types, whitespace, KNF, unifdef sunos, ...)
 1.21.10.1 16-Jan-2002  he Pull up revision 1.27 (via patch, requested by bouyer):
Implement ``-l <timeout>'' option for use with e.g. autochangers.
 1.32.22.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.34.8.2 23-Jun-2013  tls resync from head
 1.34.8.1 25-Feb-2013  tls resync with head
 1.34.2.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.34.2.1 23-Jan-2013  yamt sync with head
 1.5 22-Dec-1993  mycroft Clean up deleted files.
 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.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.8 22-Dec-1993  mycroft Clean up deleted files.
 1.7 02-Dec-1993  mycroft Change the four inode loops to the form:
for (ino = 1; ino <= maxino; ino++)
Based on a bug fix from Havard Eidnes <Havard.Eidnes@runit.sintef.no> and
suggestion by Chris Torek <torek@horse.ee.lbl.gov>.
 1.6 01-Aug-1993  mycroft Add RCS identifiers.
 1.5 13-Jun-1993  mycroft Add support for fast symlinks.
 1.4 09-Apr-1993  cgd from patch 110, by bostic:
dump not mapping last inode in fs
 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.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.24 17-Nov-2022  chs 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.23 01-Mar-2019  christos Use getfsspecname() to fill the filesystem argument in dumpdates.
While here, make sure that the error strings terminate with newline
consistently, and add a function that adds the system error string.
 1.22 23-Jun-2013  dholland branches: 1.22.20; 1.22.28;
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.21 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.20 22-Jan-2013  dholland Stuff UFS_ in front of a few of ufs's symbols to reduce namespace
pollution. Specifically:
ROOTINO -> UFS_ROOTINO
WINO -> UFS_WINO
NXADDR -> UFS_NXADDR
NDADDR -> UFS_NDADDR
NIADDR -> UFS_NIADDR
MAXSYMLINKLEN -> UFS_MAXSYMLINKLEN
MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency)

Sort out ext2fs's misuse of NDADDR and NIADDR; fortunately, these have
the same values in ext2fs and ffs.

No functional change intended.
 1.19 13-Jan-2013  dholland Use static; remove unused global var this uncovered.
 1.18 20-Jul-2008  lukem branches: 1.18.18; 1.18.24;
Remove the \n and tabs from the __COPYRIGHT() strings.
(Tweak some to use a consistent format.)
 1.17 18-Dec-2006  christos branches: 1.17.12; 1.17.16;
Convert a couple of "(void)&" constructs to volatile.
Flag various unused parameters in restore and dump so that these will
compile with -Wextra. (Note: restore uses some stuff from dump.)
 1.16 27-Mar-2004  dsl Don't require ffsv2 fs have FS_FLAGS_UPDATED set
 1.15 24-Mar-2004  ws After determining whether the filesystem is byte swapped,
we better return that fact to the caller.
 1.14 21-Mar-2004  dsl When searching for the superblock, don't pick an ffsv1 superblock from the
location where we expect to find an ffsv2 superblock.
It could be the first alternate for a ffsv1 filesystem with 64k blocks.
Fixes part of PR kern/24809
 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 02-Apr-2003  fvdl Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
 1.11 24-Jan-2003  fvdl Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
 1.10 23-Dec-2001  lukem unifdef sunos
 1.9 22-Dec-2001  lukem - use correct type for minTime in findlru() (size_t instead of int)
- clean up whitespace
 1.8 01-Nov-2001  lukem fix -Wshadow warnings
 1.7 17-Aug-2001  lukem remove third argument (`int ns') from ffs_sb_swap(), and let ffs_sb_swap()
determine the endianness of the `struct fs *o' superblock from o->fs_magic
and set needswap as necessary, rather than trusting the caller to get
it right. invariably, almost every caller of ffs_sb_swap() was calling it
with ns set to the wrong value for ns anyway!
ansi KNF ffs_bswap.c declarations whilst here.

this fixes all sorts of problems when trying to use other-endian file systems,
notably the kernel trying to access memory *way* off, possibly corrupting or
panicing, and userland programs SEGVing and/or corrupting things (e.g,
"fsck_ffs -B" to swap a file system endianness).

whilst the previous rev of ffs_bswap.c (1.10, 2000/12/23) made this problem
worse, i suspect that the problem was always there and previous versions
just happened not to trash things at the wrong time.

FFS_EI should now be a lot more stable.
 1.6 14-Aug-2001  lukem s/filesystem/file system/dump.h
 1.5 28-May-2001  lukem unifdef !__STDC__ (missed in previous)
 1.4 27-May-2001  lukem knf to ansi
 1.3 01-Oct-1999  perseant branches: 1.3.4; 1.3.8;
Working version of aborted dump{,_lfs} join.
 1.2 30-Sep-1999  perseant Back out changes made on the 29th, not at all the changes I intended to commit.
(I don't know how I did it though ... I'll figure it out tonight.)
I'll reapply this, in a working form, this evening.
 1.1 29-Sep-1999  perseant Adapt dump(8) to use filestore-independent (but still ufs-specific)
replacements for NINDIR, fsbtodb, etc. Create dump_lfs by adding a few
LFS-filestore-specific routines. As described in PR#8317.
 1.3.8.3 17-Jan-2002  he Pull up revision 1.7 (requested by he):
Fix compile problem after last round of pullups.
The already-pulled-up 1.7 was inadvertently undone by the previous patch.
 1.3.8.2 16-Jan-2002  he Pull up revisions 1.9-1.10 (via patch, requested by bouyer):
Various fixes:
o Fix error if first tape is write-protected; fixes PR#4754 and PR#6098
o Make error codes conform to manual page
o Use \a to make noise
o Fix estimated number of tapes for huge dumps to cartridges
o Use <sys/queue.h> SLIST_* macros instead of homegrown variants
o Do not exit if unable to read/create /etc/dumpdates
o Support output (tape) device returning ENOSPC for end-of-media on write
o Don't dump core if SIGINFO is received before 1 second has elapsed
o Only process SIGINFO in currently active child
o Ensure current (sub)block isn't past end of file system -- fixes
"spins forever but does nothing" bug.
o Some other minor fixes (types, whitespace, KNF, unifdef sunos, ...)
 1.3.8.1 25-Nov-2001  he Pull up revision 1.7 (requested by lukem):
Call ffs_sb_swap() with the correct arguments. Fixes problems
with using other-endian file systems.
 1.3.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.17.16.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.17.12.1 28-Sep-2008  mjf Sync with HEAD.
 1.18.24.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.18.24.2 23-Jun-2013  tls resync from head
 1.18.24.1 25-Feb-2013  tls resync with head
 1.18.18.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.18.18.1 23-Jan-2013  yamt sync with head
 1.22.28.1 10-Jun-2019  christos Sync with HEAD
 1.22.20.1 29-Mar-2019  martin Pull up following revision(s) (requested by manu in ticket #1221):

sbin/dump/tape.c: revision 1.55
sbin/dump_lfs/dump_lfs.8: revision 1.18
sbin/dump/dump.h: revision 1.56
sbin/dump/dump.8: revision 1.69
sbin/dump/dump.h: revision 1.57
sbin/dump/ffs_inode.c: revision 1.23
sbin/dump/optr.c: revision 1.43
sbin/dump/itime.c: revision 1.21
sbin/dump/main.c: revision 1.74
sbin/dump/itime.c: revision 1.22
sbin/dump/main.c: revision 1.75
sbin/dump/dump.8: revision 1.70
sbin/dump/traverse.c: revision 1.52
sbin/dump/dump.8: revision 1.71

Document what rdump is (was once) for. PR 53442.

Use getfsspecname() to fill the filesystem argument in dumpdates.
While here, make sure that the error strings terminate with newline
consistently, and add a function that adds the system error string.

Add -U flag to dump(8) and dump_lfs(8) to specify dumpdates entry
This address situations where dump(8) cannot figure out the device being
dumped. It also allows tracking of subvolume dumps by using virtual
device as dumpdates entry.

Bump date for previous.
 1.22 25-Mar-2019  manu Add -U flag to dump(8) and dump_lfs(8) to specify dumpdates entry

This address situations where dump(8) cannot figure out the device being
dumped. It also allows tracking of subvolume dumps by using virtual
device as dumpdates entry.
 1.21 01-Mar-2019  christos Use getfsspecname() to fill the filesystem argument in dumpdates.
While here, make sure that the error strings terminate with newline
consistently, and add a function that adds the system error string.
 1.20 15-Jun-2013  christos branches: 1.20.20; 1.20.28;
handle new lfs split
 1.19 13-Jan-2013  dholland Add some const.
 1.18 11-Mar-2010  christos branches: 1.18.6; 1.18.12;
PR/42952: The Grey Wolf: Fix for "true incremental". Don't overload level
9, use a new level "i" which is logically 10.
 1.17 26-Feb-2010  christos PR/42883: Greywolf: Add -i flag which brings "true incremental" capability.
 1.16 19-May-2006  christos Coverity CID 3275: Plug memory leak.
 1.15 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.14 16-Nov-2002  itojun use strlcpy. use sizeof() instead of xxLEN to avoid de-synchronization
 1.13 25-Dec-2001  lukem Fixes from FreeBSD:
- Fix error if first tape was write protected. Fix NetBSD PRs 4754 and 6098.
- Make dump exit codes confirm to manual page.
- Use \a instead of \7 to make noise.
- Fix estimated number of tapes for huge dumps to cartridges.
- Use <sys/queue.h> SLIST_* instead of home-rolled lists.
- Do not exit if unable to read or create /etc/dumpdates.
- Support output (tape) device returning ENOSPC for end-of-media on a write.

Fixes by me:
- Remove unused ddates_in.
- Don't dump core if SIGINFO is received before 1 second has elapsed.
- Only process SIGINFO in current "active" child.
- Don't dump core in -w if dumpdates wasn't readable and ddatev == NULL
- Minor KNF; wrap some lines
 1.12 23-Dec-2001  lukem unifdef sunos
 1.11 28-May-2001  lukem * improve parsing of file-systems-to-dump when a path is given:
- if it's a path to an unmounted file-system listed in /etc/fstab, use
that instead of assuming the user wanted a subtree dump of the parent
directory. this restores the behaviour of dump before the subtree
dumping code went in.
- if it's a path to a mounted file-system which is not in /etc/fstab,
use the info from getmntinfo(3). previously, dump would choke.
* implement error checked malloc(), calloc(), strdup(), and use
appropriately (some of the calloc()s weren't being checked)
* use 'file-system' instead of 'filesystem' in the man page
 1.10 28-May-2001  lukem unifdef !__STDC__ (missed in previous)
 1.9 27-May-2001  lukem knf to ansi
 1.8 22-Apr-1998  bouyer branches: 1.8.10;
PR bin/5346 from haszlaki@UAccess.NET:
After parsing the entries from /etc/dumpdates, remember ou entrie, in order
to print the date after /etc/dumpdates has been rewritten.
 1.7 01-Apr-1998  kleink Need <time.h> for ctime() prototype.
 1.6 18-Mar-1998  bouyer Add support for non-native byte order FFS. The dump is in filesystem byte
order, restore already knows how to byteswap dumps.
 1.5 15-Sep-1997  lukem * cleanup for WARNS=1
* fix use of .Nm
* comment out some unused(?) functions
 1.4 15-Apr-1997  lukem remove use of "register".
 1.3 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.2 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.1 22-Dec-1993  cgd branches: 1.1.1;
new version from CSRG, via BSDI, with fixes
 1.1.1.1 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.8.10.1 16-Jan-2002  he Pull up revisions 1.12-1.13 (via patch, requested by bouyer):
Various fixes:
o Fix error if first tape is write-protected; fixes PR#4754 and PR#6098
o Make error codes conform to manual page
o Use \a to make noise
o Fix estimated number of tapes for huge dumps to cartridges
o Use <sys/queue.h> SLIST_* macros instead of homegrown variants
o Do not exit if unable to read/create /etc/dumpdates
o Support output (tape) device returning ENOSPC for end-of-media on write
o Don't dump core if SIGINFO is received before 1 second has elapsed
o Only process SIGINFO in currently active child
o Ensure current (sub)block isn't past end of file system -- fixes
"spins forever but does nothing" bug.
o Some other minor fixes (types, whitespace, KNF, unifdef sunos, ...)
 1.18.12.2 23-Jun-2013  tls resync from head
 1.18.12.1 25-Feb-2013  tls resync with head
 1.18.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.18.6.1 23-Jan-2013  yamt sync with head
 1.20.28.1 10-Jun-2019  christos Sync with HEAD
 1.20.20.1 29-Mar-2019  martin Pull up following revision(s) (requested by manu in ticket #1221):

sbin/dump/tape.c: revision 1.55
sbin/dump_lfs/dump_lfs.8: revision 1.18
sbin/dump/dump.h: revision 1.56
sbin/dump/dump.8: revision 1.69
sbin/dump/dump.h: revision 1.57
sbin/dump/ffs_inode.c: revision 1.23
sbin/dump/optr.c: revision 1.43
sbin/dump/itime.c: revision 1.21
sbin/dump/main.c: revision 1.74
sbin/dump/itime.c: revision 1.22
sbin/dump/main.c: revision 1.75
sbin/dump/dump.8: revision 1.70
sbin/dump/traverse.c: revision 1.52
sbin/dump/dump.8: revision 1.71

Document what rdump is (was once) for. PR 53442.

Use getfsspecname() to fill the filesystem argument in dumpdates.
While here, make sure that the error strings terminate with newline
consistently, and add a function that adds the system error string.

Add -U flag to dump(8) and dump_lfs(8) to specify dumpdates entry
This address situations where dump(8) cannot figure out the device being
dumped. It also allows tracking of subvolume dumps by using virtual
device as dumpdates entry.

Bump date for previous.
 1.79 04-Oct-2024  rillig dump: suppress lint warning about "effectively discards 'const'"
 1.78 03-Dec-2020  kre branches: 1.78.8;

PR bin/55834

count blocks written in unsigned 64 bit counter
rather than signed int which overflows after 2^31-1
blocks (2TiB) after which neither the 5 minute
status updates or SIGINFO (^T) reports are issued
until the negative numbers increase past 0 and
wildly inaccurate reports would be written.
 1.77 05-Apr-2020  joerg Fix depenency on common symbols in sbin.
 1.76 19-Aug-2019  perseant Add -D flag to allow the user to specify an alternate dumpdates file.
Closes PR #54469.
 1.75 25-Mar-2019  manu branches: 1.75.2;
Add -U flag to dump(8) and dump_lfs(8) to specify dumpdates entry

This address situations where dump(8) cannot figure out the device being
dumped. It also allows tracking of subvolume dumps by using virtual
device as dumpdates entry.
 1.74 01-Mar-2019  christos Use getfsspecname() to fill the filesystem argument in dumpdates.
While here, make sure that the error strings terminate with newline
consistently, and add a function that adds the system error string.
 1.73 24-Aug-2015  bouyer branches: 1.73.8; 1.73.16;
Consistently use iswap64() and 64bit intermediate variable, as well as
64bit formats for c_tapea. Fixes tape useage report for large filesystems.
 1.72 24-Aug-2015  bouyer Default the read block size (-k default value) to kern.maxphys (usually
64k these days). This gives a noticable performance boost on large filesystems.
 1.71 08-Sep-2013  mlelstv branches: 1.71.4;
Fix handling of NAME aliases in /etc/fstab.
 1.70 15-Jun-2013  christos handle new lfs split
 1.69 07-Apr-2012  christos branches: 1.69.2;
factor out rawname() from dump, fsck, savecore.
 1.68 07-Apr-2012  christos use getfsspecname()
 1.67 19-Feb-2012  christos PR/45735: Bug Hunting: The dump(8) manpage, as well as the program's `usage'-line,
needs improvement
 1.66 11-Mar-2010  christos branches: 1.66.6; 1.66.8;
PR/42952: The Grey Wolf: Fix for "true incremental". Don't overload level
9, use a new level "i" which is logically 10.
 1.65 26-Feb-2010  christos PR/42883: Greywolf: Add -i flag which brings "true incremental" capability.
 1.64 20-Jul-2008  lukem Remove the \n and tabs from the __COPYRIGHT() strings.
(Tweak some to use a consistent format.)
 1.63 26-Oct-2006  hannken branches: 1.63.18; 1.63.22;
When using a snapshot take the snapshot raw device on further open.

Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)

Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.62 24-Jun-2006  perseant Change LFCNWRAP{STOP,GO} to make them more suitable for snapshotting; in
particular, the caller can now choose whether to wait for the condition
to be met, and if the caller of LFCNWRAPSTOP dies or otherwise closes
the descriptor, the filesystem is started again. Updated the ckckp
regression test to use the new semantics.

dump_lfs(8) now uses the fcntls to implement LFS-style snapshotting through
the -X flag, addressing PR#33457 albeit not using fss(4). Fixed a couple
other problems with dump_lfs that manifested themselves during testing.
 1.61 19-Apr-2006  hannken Emit "a snapshot of" message for snap_internal case too.
 1.60 18-Mar-2006  christos Coverity CID 2297: Fix memory leak.
 1.59 27-Jun-2005  christos sprinkle const
 1.58 19-Apr-2005  hannken Snapshot support for dump(8):

- New option `-x backup' takes the dump from a snapshot backed up by `backup'.
The snapshot will be deleted on exit.

- New option `-X' as a synonym for `-x mountpoint' where `mountpoint' is the
file system to be dumped.

Reviewed and Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.57 21-Apr-2004  christos branches: 1.57.2;
Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.56 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.55 02-Apr-2003  fvdl Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
 1.54 27-Mar-2003  lukem Use "wall -g operator" (instead of private code) to broadcast() messages to
members of the operator group.
Don't install "setgid tty", and remove now unnecessary gid/egid swapping.
Remove utmp trawling code pulled in from usr.bin/who.
The Code is now simpler, and more portable (without the utmp cruft) too.

This is derived from similar work in OpenBSD.
 1.53 17-Nov-2002  itojun should be safer to cast to u_long than to cast down to int
 1.52 17-Nov-2002  tsutsui Add a cast to sizeof in printf() arg since _BSD_SIZE_T is unsigned long
on some ports.
 1.51 16-Nov-2002  itojun use strlcpy. use sizeof() instead of xxLEN to avoid de-synchronization
 1.50 07-Jan-2002  bouyer For -l: specify the timeout on the command line (in seconds) instead of
hardwiring it to 2s, as suggested on tech-userlevel.
 1.49 30-Dec-2001  lukem Add -a to "auto-size" the tape, rather than relying upon other options
to define the tape size. Requires the tape driver to either return ENOSPC
at end of media, or 0 when a write is attempted (such as the "early warning"
support in st(4) enabled with "mt eew 1"). From FreeBSD.
 1.48 25-Dec-2001  lukem Fixes from FreeBSD:
- Fix error if first tape was write protected. Fix NetBSD PRs 4754 and 6098.
- Make dump exit codes confirm to manual page.
- Use \a instead of \7 to make noise.
- Fix estimated number of tapes for huge dumps to cartridges.
- Use <sys/queue.h> SLIST_* instead of home-rolled lists.
- Do not exit if unable to read or create /etc/dumpdates.
- Support output (tape) device returning ENOSPC for end-of-media on a write.

Fixes by me:
- Remove unused ddates_in.
- Don't dump core if SIGINFO is received before 1 second has elapsed.
- Only process SIGINFO in current "active" child.
- Don't dump core in -w if dumpdates wasn't readable and ddatev == NULL
- Minor KNF; wrap some lines
 1.47 23-Dec-2001  lukem clean up from time_t -> int32_t change in dumprestore.h
 1.46 23-Dec-2001  lukem unifdef sunos
 1.45 23-Dec-2001  lukem nuke trailing whitespace
 1.44 22-Dec-2001  lukem - use correct type for minTime in findlru() (size_t instead of int)
- clean up whitespace
 1.43 20-Dec-2001  soren Another little mistake, spotted by wiz.
 1.42 20-Dec-2001  soren Sync getopt() / man page with actual getopt options.
 1.41 14-Dec-2001  bouyer Add a -l (autoload) flag. For multivolume dumps, this makes dump eject the
tape when a volume is full, and try to reopen the tape drive for 2 mn.
To be used with tape changers which load the next tape when the current one is
ejected.
While I'm there fix eject handling for remote tape.
 1.40 16-Nov-2001  lukem relax the restriction on -F that the file system image argument must be a
regular file
 1.39 15-Oct-2001  blymn Add the capability for dump to print timestamps on all informational
messages.
 1.38 14-Aug-2001  lukem - implement -F, which indicates that files-to-dump is a regular file
containing a file system image (instead of being a single file as
part of a subtree dump)
- use "file system" instead of "filesystem" or "file-system"
 1.37 08-Aug-2001  david Patch to drop setgid tty privs until forking for operator notification
 1.36 17-Jul-2001  mrg reset uid & gid around calling rmthost().
 1.35 16-Jul-2001  mrg display what signal, not "unknown"
 1.34 03-Jun-2001  hannken Assign a saved copy of dt->fs_file to mountpoint. dt->fs_file will be freed
otherwise resulting in a wrong spcl.c_filesys .
 1.33 28-May-2001  lukem * improve parsing of file-systems-to-dump when a path is given:
- if it's a path to an unmounted file-system listed in /etc/fstab, use
that instead of assuming the user wanted a subtree dump of the parent
directory. this restores the behaviour of dump before the subtree
dumping code went in.
- if it's a path to a mounted file-system which is not in /etc/fstab,
use the info from getmntinfo(3). previously, dump would choke.
* implement error checked malloc(), calloc(), strdup(), and use
appropriately (some of the calloc()s weren't being checked)
* use 'file-system' instead of 'filesystem' in the man page
 1.32 27-May-2001  lukem more KNF
 1.31 27-May-2001  lukem knf to ansi
 1.30 12-May-2001  tron Add "e" option to usage message. Problem pointed out by Takahiro Kambe
in private e-mail.
 1.29 12-May-2001  tron Fix bug in new "e" option: only eject tape if it is full, not if the dump
was finished.
 1.28 07-May-2001  tron Add a new option "e" to "dump" which allows to eject tapes automatically
if a tape change is required.
 1.27 13-Dec-2000  scw Global variables don't need to be initialised to zero.
 1.26 11-Oct-2000  briggs Fix format warnings
 1.25 01-Oct-1999  perseant branches: 1.25.6;
Working version of aborted dump{,_lfs} join.
 1.24 30-Sep-1999  perseant Back out changes made on the 29th, not at all the changes I intended to commit.
(I don't know how I did it though ... I'll figure it out tonight.)
I'll reapply this, in a working form, this evening.
 1.23 29-Sep-1999  perseant Adapt dump(8) to use filestore-independent (but still ufs-specific)
replacements for NINDIR, fsbtodb, etc. Create dump_lfs by adding a few
LFS-filestore-specific routines. As described in PR#8317.
 1.22 23-Mar-1999  bouyer branches: 1.22.2; 1.22.4;
Implement a read cache, as announced on tech-userlevel. Default is 32k
read buffer size, 512 buffer or 15% of the user memory. Can be changed
with the -k and -s options.
 1.21 03-Jan-1999  lukem add support for '-L label', which file(1) and restore(1) can extract from the
header. mostly based on [bin/6715] from Brian Grayson <bgrayson@ece.utexas.edu>

old filesystems don't have fs_qbmask and fs_qfmask set in the superblock;
fudge them as per code in /sys/ufs/ffs/ffs_vfsops.c::ffs_oldfscompat().
bug and suggested fix from Robert Elz <kre@munnari.OZ.AU> in [bin/6610]
XXX: there may be other variables required as well...
 1.20 25-Aug-1998  ross from Erik Bertelsen <erik@mediator.uni-c.dk>
{ put } { in } { lots } { of } { these } { to } { shut } { up } { egcs }
 1.19 06-Jul-1998  mrg - use an array MAXHOSTNAMELEN+1 size to hold hostnames
- ensure hostname from gethostname() is nul-terminated in all cases
- minor KNF
- use MAXHOSTNAMELEN over various other values/defines
- be safe will buffers that hold hostnames
 1.18 18-Mar-1998  bouyer Add support for non-native byte order FFS. The dump is in filesystem byte
order, restore already knows how to byteswap dumps.
 1.17 18-Sep-1997  lukem Various changes from Brian Grayson <bgrayson@ece.utexas.edu> in [bin/4103]
* exit after providing an estimate if -S was given. the PR used -e,
but checking around indicated prior art in Solaris usin -S.
* remove superfluous 'DUMP:' prefix in two messages
* initialise blocksperfile explicitly (not necessary, but everything
else in that section gets initialised, so be consistant :)
* display the ``pretty'' name of the dumped directory, so the user
knows if it's a subset or not
 1.16 16-Sep-1997  lukem resolve conflicts from lite-2 import
 1.15 15-Sep-1997  lukem * cleanup for WARNS=1
* fix use of .Nm
* comment out some unused(?) functions
 1.14 05-Jun-1997  lukem * Add the ability to dump specific files & directories of a single
filesystem. This uses fts(3) to access the directory structure (and
not the raw device), so the standard access permissions are adhered
to (unlike dumping an entire filesystem, which just requires read
access to the raw disk device).
* Support SIGINFO status reporting.
* Remove now unused variables that previously stored the (e)uid.
* Be more informative in a couple of error messages.
 1.13 27-May-1997  mrg enable rcmd(). garbage collect.
 1.12 21-Apr-1997  mrg be safe with buffers.
 1.11 15-Apr-1997  lukem remove use of "register".
 1.10 10-Apr-1997  lukem Implement changes from [bin/1915]
* 'w' and 'W' display the year
* verbosity additions displaying total & per-volume transfer times and rates
 1.9 27-Feb-1997  mikel set bflag so that 'dump bd M N' works properly. fix from Juergen
Hannken-Illjes in PR bin/3254.
 1.8 15-Mar-1996  scottr Be more paranoid with our effective uid.
 1.7 05-Feb-1996  mrg support $TAPE. update manual to reflect reality (#1937).
 1.6 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.5 20-Feb-1995  mycroft Use getopt(3), with obsolete() from restore(8) for backward compatibility.
 1.4 23-Sep-1994  mycroft Eliminate uses of some obsolete functions.
 1.3 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.2 28-Mar-1994  cgd don't segv if called with no options!
 1.1 22-Dec-1993  cgd branches: 1.1.1;
new version from CSRG, via BSDI, with fixes
 1.1.1.2 16-Sep-1997  lukem imported from lite-2
 1.1.1.1 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.22.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.22.2.1 11-Oct-2000  he Pull up revision 1.26 (requested by he):
Format string cleanup.
 1.25.6.8 28-Mar-2002  he Pull up revisions 1.33-1.34 (via patch, requested by bouyer):
Improve behaviour when a path is given:
1) check if the path is an unmounted file system listed in fstab
2) check if it is a path to a mounted file system not listed in fstab
Fixes PR#15790.
 1.25.6.7 16-Jan-2002  he Pull up revision 1.49 (via patch, requested by bouyer):
Add an ``-a'' option to ``auto-size'' the tape, rather than
relying upon other options to define the tape size.
 1.25.6.6 16-Jan-2002  he Pull up revisions 1.46-1.48 (via patch, requested by bouyer):
Various fixes:
o Fix error if first tape is write-protected; fixes PR#4754 and PR#6098
o Make error codes conform to manual page
o Use \a to make noise
o Fix estimated number of tapes for huge dumps to cartridges
o Use <sys/queue.h> SLIST_* macros instead of homegrown variants
o Do not exit if unable to read/create /etc/dumpdates
o Support output (tape) device returning ENOSPC for end-of-media on write
o Don't dump core if SIGINFO is received before 1 second has elapsed
o Only process SIGINFO in currently active child
o Ensure current (sub)block isn't past end of file system -- fixes
"spins forever but does nothing" bug.
o Some other minor fixes (types, whitespace, KNF, unifdef sunos, ...)
 1.25.6.5 16-Jan-2002  he Pull up revisions 1.41,1.50 (via patch, requested by bouyer):
Implement ``-l <timeout>'' option for use with e.g. autochangers.
 1.25.6.4 08-Aug-2001  jhawk Pull up revision 1.37 via patch (requested by david):
Temporarily drop setgid (for setgid tty) privileges, but restore them
if we fork to perform an operator notification. Generalize pre-existing
#ifdef RDUMP code.
 1.25.6.3 15-May-2001  he Pull up revision 1.29 (requested by tron):
Fix bug in new ``e'' option: only eject tape if it is full, not
if the dump was finished.
 1.25.6.2 09-May-2001  he Pull up revision 1.28 (requested by tron):
Add a new option ``e'' to dump which directs it to eject tapes
automatically if a tape change is required.
 1.25.6.1 18-Oct-2000  tv Pullup sbin string format fixes [is].
See "cvs log" for explicit revision numbers per file, from sommerfeld.
 1.57.2.3 11-Nov-2006  bouyer Pull up following revision(s) (requested by hannken in ticket #1573):
sbin/dump/snapshot.h: revision 1.3 via patch
sbin/dump/snapshot.c: revision 1.3 via patch
sbin/dump/main.c: revision 1.63 via patch
sbin/dump/tape.c: revision 1.47 via patch
sbin/dump/dump.h: revision 1.44 via patch
When using a snapshot take the snapshot raw device on further open.
Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)
Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.57.2.2 21-Apr-2006  tron branches: 1.57.2.2.2;
Pull up following revision(s) (requested by hannken in ticket #1283):
sbin/dump/main.c: revision 1.61
Emit "a snapshot of" message for snap_internal case too.
 1.57.2.1 21-Apr-2005  tron branches: 1.57.2.1.2;
Pull up revision 1.58 (requested by hannken in ticket #184):
Snapshot support for dump(8):
- New option `-x backup' takes the dump from a snapshot backed up by `backup'.
The snapshot will be deleted on exit.
- New option `-X' as a synonym for `-x mountpoint' where `mountpoint' is the
file system to be dumped.
Reviewed and Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.57.2.2.2.1 11-Nov-2006  bouyer Pull up following revision(s) (requested by hannken in ticket #1573):
sbin/dump/snapshot.h: revision 1.3 via patch
sbin/dump/snapshot.c: revision 1.3 via patch
sbin/dump/main.c: revision 1.63 via patch
sbin/dump/tape.c: revision 1.47 via patch
sbin/dump/dump.h: revision 1.44 via patch
When using a snapshot take the snapshot raw device on further open.
Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)
Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.57.2.1.2.1 11-Nov-2006  bouyer Pull up following revision(s) (requested by hannken in ticket #1573):
sbin/dump/snapshot.h: revision 1.3 via patch
sbin/dump/snapshot.c: revision 1.3 via patch
sbin/dump/main.c: revision 1.63 via patch
sbin/dump/tape.c: revision 1.47 via patch
sbin/dump/dump.h: revision 1.44 via patch
When using a snapshot take the snapshot raw device on further open.
Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)
Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.63.22.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.63.18.1 28-Sep-2008  mjf Sync with HEAD.
 1.66.8.2 08-Mar-2016  snj Pull up following revision(s) (requested by bouyer in ticket #1332):
sbin/dump/main.c: revision 1.73
sbin/dump/tape.c: revision 1.54
Consistently use iswap64() and 64bit intermediate variable, as well as
64bit formats for c_tapea. Fixes tape useage report for large filesystems.
 1.66.8.1 08-Mar-2016  snj Pull up following revision(s) (requested by bouyer in ticket #1331):
sbin/dump/dump.8: revision 1.67 via patch
sbin/dump/main.c: revision 1.72
sbin/dump/rcache.c: revision 1.25
Default the read block size (-k default value) to kern.maxphys (usually
64k these days). This gives a noticable performance boost on large filesystems.
 1.66.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.66.6.1 17-Apr-2012  yamt sync with head
 1.69.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.69.2.1 23-Jun-2013  tls resync from head
 1.71.4.2 06-Nov-2015  riz Pull up following revision(s) (requested by bouyer in ticket #991):
sbin/dump/tape.c: revision 1.54
sbin/dump/main.c: revision 1.73
Consistently use iswap64() and 64bit intermediate variable, as well as
64bit formats for c_tapea. Fixes tape useage report for large filesystems.
 1.71.4.1 06-Nov-2015  riz Pull up following revision(s) (requested by bouyer in ticket #990):
sbin/dump/rcache.c: revision 1.25
sbin/dump/dump.8: revision 1.67
sbin/dump/main.c: revision 1.72
Default the read block size (-k default value) to kern.maxphys (usually
64k these days). This gives a noticable performance boost on large filesystems.
 1.73.16.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.73.16.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.73.16.1 10-Jun-2019  christos Sync with HEAD
 1.73.8.2 07-Dec-2020  martin Pull up following revision(s) (requested by kre in ticket #1630):

sbin/dump/dump.h: revision 1.59
sbin/dump/main.c: revision 1.78

PR bin/55834

count blocks written in unsigned 64 bit counter
rather than signed int which overflows after 2^31-1
blocks (2TiB) after which neither the 5 minute
status updates or SIGINFO (^T) reports are issued
until the negative numbers increase past 0 and
wildly inaccurate reports would be written.
 1.73.8.1 29-Mar-2019  martin Pull up following revision(s) (requested by manu in ticket #1221):

sbin/dump/tape.c: revision 1.55
sbin/dump_lfs/dump_lfs.8: revision 1.18
sbin/dump/dump.h: revision 1.56
sbin/dump/dump.8: revision 1.69
sbin/dump/dump.h: revision 1.57
sbin/dump/ffs_inode.c: revision 1.23
sbin/dump/optr.c: revision 1.43
sbin/dump/itime.c: revision 1.21
sbin/dump/main.c: revision 1.74
sbin/dump/itime.c: revision 1.22
sbin/dump/main.c: revision 1.75
sbin/dump/dump.8: revision 1.70
sbin/dump/traverse.c: revision 1.52
sbin/dump/dump.8: revision 1.71

Document what rdump is (was once) for. PR 53442.

Use getfsspecname() to fill the filesystem argument in dumpdates.
While here, make sure that the error strings terminate with newline
consistently, and add a function that adds the system error string.

Add -U flag to dump(8) and dump_lfs(8) to specify dumpdates entry
This address situations where dump(8) cannot figure out the device being
dumped. It also allows tracking of subvolume dumps by using virtual
device as dumpdates entry.

Bump date for previous.
 1.75.2.1 06-Dec-2020  martin Pull up following revision(s) (requested by kre in ticket #1139):

sbin/dump/dump.h: revision 1.59
sbin/dump/main.c: revision 1.78

PR bin/55834

count blocks written in unsigned 64 bit counter
rather than signed int which overflows after 2^31-1
blocks (2TiB) after which neither the 5 minute
status updates or SIGINFO (^T) reports are issued
until the negative numbers increase past 0 and
wildly inaccurate reports would be written.
 1.78.8.1 02-Aug-2025  perseant Sync with HEAD
 1.44 14-Mar-2022  mlelstv Silently ignore fstab entries with NAME= entries that cannot be resolved.
Fixes PR 56249.
 1.43 01-Mar-2019  christos branches: 1.43.2;
Use getfsspecname() to fill the filesystem argument in dumpdates.
While here, make sure that the error strings terminate with newline
consistently, and add a function that adds the system error string.
 1.42 08-Sep-2013  mlelstv branches: 1.42.18; 1.42.26;
Fix handling of NAME aliases in /etc/fstab.
 1.41 15-Jun-2013  christos handle new lfs split
 1.40 13-Jan-2013  dholland Use more static.
 1.39 13-Jan-2013  dholland Add some const.
 1.38 07-Apr-2012  christos branches: 1.38.2;
factor out rawname() from dump, fsck, savecore.
 1.37 07-Apr-2012  christos use getfsspecname()
 1.36 18-Dec-2006  christos branches: 1.36.36;
Convert a couple of "(void)&" constructs to volatile.
Flag various unused parameters in restore and dump so that these will
compile with -Wextra. (Note: restore uses some stuff from dump.)
 1.35 24-Jun-2006  perseant Change LFCNWRAP{STOP,GO} to make them more suitable for snapshotting; in
particular, the caller can now choose whether to wait for the condition
to be met, and if the caller of LFCNWRAPSTOP dies or otherwise closes
the descriptor, the filesystem is started again. Updated the ckckp
regression test to use the new semantics.

dump_lfs(8) now uses the fcntls to implement LFS-style snapshotting through
the -X flag, addressing PR#33457 albeit not using fss(4). Fixed a couple
other problems with dump_lfs that manifested themselves during testing.
 1.34 27-Jun-2005  christos sprinkle const
 1.33 21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.32 15-Mar-2004  lukem Adjust tstart_volume (volume start time) by the time spent in query(),
similar to the adjustment for tstart_writing made in optr.c rev 1.4.
Should fix PR bin/19711 from matthew green.
 1.31 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.30 02-Apr-2003  fvdl Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
 1.29 27-Mar-2003  lukem Use "wall -g operator" (instead of private code) to broadcast() messages to
members of the operator group.
Don't install "setgid tty", and remove now unnecessary gid/egid swapping.
Remove utmp trawling code pulled in from usr.bin/who.
The Code is now simpler, and more portable (without the utmp cruft) too.

This is derived from similar work in OpenBSD.
 1.28 18-Aug-2002  yamt save/restore errno in signal handlers.
 1.27 16-Aug-2002  itojun defend against malicious line in ut_line, which could cause unwanted
writes to anything under /dev. revoke setuid/gid privs earlier.
From: xs@kittenz.org
 1.26 02-Aug-2002  christos support utmpx
 1.25 25-Dec-2001  lukem Fixes from FreeBSD:
- Fix error if first tape was write protected. Fix NetBSD PRs 4754 and 6098.
- Make dump exit codes confirm to manual page.
- Use \a instead of \7 to make noise.
- Fix estimated number of tapes for huge dumps to cartridges.
- Use <sys/queue.h> SLIST_* instead of home-rolled lists.
- Do not exit if unable to read or create /etc/dumpdates.
- Support output (tape) device returning ENOSPC for end-of-media on a write.

Fixes by me:
- Remove unused ddates_in.
- Don't dump core if SIGINFO is received before 1 second has elapsed.
- Only process SIGINFO in current "active" child.
- Don't dump core in -w if dumpdates wasn't readable and ddatev == NULL
- Minor KNF; wrap some lines
 1.24 24-Dec-2001  lukem For dump_lfs(8), in getfstab(), only "lfs" (instead of "ufs" or "ffs").
Fix from Minoura Makoto in [bin/10525].
 1.23 23-Dec-2001  lukem nuke trailing whitespace
 1.22 22-Dec-2001  lukem - use correct type for minTime in findlru() (size_t instead of int)
- clean up whitespace
 1.21 01-Nov-2001  lukem fix -Wshadow warnings
 1.20 25-Oct-2001  lukem in msg(), don't call va_list using functions twice in a row without calling
va_start() in between; reorder code so that we call vsnprintf and then
just fputs that buffer. crank the size of lastmsg whilst we're here
problem noted by Hideo Saito in [bin/14348].
 1.19 15-Oct-2001  blymn Add the capability for dump to print timestamps on all informational
messages.
 1.18 08-Aug-2001  david Patch to drop setgid tty privs until forking for operator notification
 1.17 28-May-2001  lukem * improve parsing of file-systems-to-dump when a path is given:
- if it's a path to an unmounted file-system listed in /etc/fstab, use
that instead of assuming the user wanted a subtree dump of the parent
directory. this restores the behaviour of dump before the subtree
dumping code went in.
- if it's a path to a mounted file-system which is not in /etc/fstab,
use the info from getmntinfo(3). previously, dump would choke.
* implement error checked malloc(), calloc(), strdup(), and use
appropriately (some of the calloc()s weren't being checked)
* use 'file-system' instead of 'filesystem' in the man page
 1.16 28-May-2001  lukem unifdef !__STDC__ (missed in previous)
 1.15 27-May-2001  lukem knf to ansi
 1.14 10-Oct-2000  is Format string cleanups by Bill Sommerfeld.
 1.13 01-Apr-1998  kleink branches: 1.13.2; 1.13.10;
Need <time.h> for time(), localtime() and ctime() prototypes.
 1.12 15-Sep-1997  lukem * cleanup for WARNS=1
* fix use of .Nm
* comment out some unused(?) functions
 1.11 27-May-1997  mrg fix off by one bug.
 1.10 21-Apr-1997  thorpej Don't need to account for space for NUL, as it's included in the
sizeof(_PATH_DEV), noted by Chris Demetriou <cgd@netbsd.org>
 1.9 21-Apr-1997  thorpej Add missing `-', noted by Erik Fair <fair@cesium.clock.org> on
current-users.
 1.8 21-Apr-1997  mrg be safe with buffers.
 1.7 15-Apr-1997  lukem remove use of "register".
 1.6 10-Apr-1997  lukem Implement changes from [bin/1915]
* 'w' and 'W' display the year
* verbosity additions displaying total & per-volume transfer times and rates
 1.5 16-Jan-1997  perry fix pr 2977 -- only try to dump ufs/ffs partitions
 1.4 18-May-1996  jtk Adjust the base for time estimates to ignore time we spent waiting
for operator input.
enhancements from PR #900
 1.3 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.2 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.1 22-Dec-1993  cgd branches: 1.1.1;
new version from CSRG, via BSDI, with fixes
 1.1.1.1 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.13.10.4 28-Mar-2002  he Pull up revision 1.17 (via patch, requested by bouyer):
Improve behaviour when a path is given:
1) check if the path is an unmounted file system listed in fstab
2) check if it is a path to a mounted file system not listed in fstab
Fixes PR#15790.
 1.13.10.3 16-Jan-2002  he Pull up revision 1.25 (via patch, requested by bouyer):
Various fixes:
o Fix error if first tape is write-protected; fixes PR#4754 and PR#6098
o Make error codes conform to manual page
o Use \a to make noise
o Fix estimated number of tapes for huge dumps to cartridges
o Use <sys/queue.h> SLIST_* macros instead of homegrown variants
o Do not exit if unable to read/create /etc/dumpdates
o Support output (tape) device returning ENOSPC for end-of-media on write
o Don't dump core if SIGINFO is received before 1 second has elapsed
o Only process SIGINFO in currently active child
o Ensure current (sub)block isn't past end of file system -- fixes
"spins forever but does nothing" bug.
o Some other minor fixes (types, whitespace, KNF, unifdef sunos, ...)
 1.13.10.2 08-Aug-2001  jhawk Pull up revision 1.18 via patch (requested by david):
Temporarily drop setgid (for setgid tty) privileges, but restore them
if we fork to perform an operator notification. Generalize pre-existing
#ifdef RDUMP code.
 1.13.10.1 18-Oct-2000  tv Pullup sbin string format fixes [is].
See "cvs log" for explicit revision numbers per file, from sommerfeld.
 1.13.2.1 10-Oct-2000  he Pull up revision 1.14 (requested by is):
Format string cleanup.
 1.36.36.3 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.36.2 23-Jan-2013  yamt sync with head
 1.36.36.1 17-Apr-2012  yamt sync with head
 1.38.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.38.2.2 23-Jun-2013  tls resync from head
 1.38.2.1 25-Feb-2013  tls resync with head
 1.42.26.1 10-Jun-2019  christos Sync with HEAD
 1.42.18.1 29-Mar-2019  martin Pull up following revision(s) (requested by manu in ticket #1221):

sbin/dump/tape.c: revision 1.55
sbin/dump_lfs/dump_lfs.8: revision 1.18
sbin/dump/dump.h: revision 1.56
sbin/dump/dump.8: revision 1.69
sbin/dump/dump.h: revision 1.57
sbin/dump/ffs_inode.c: revision 1.23
sbin/dump/optr.c: revision 1.43
sbin/dump/itime.c: revision 1.21
sbin/dump/main.c: revision 1.74
sbin/dump/itime.c: revision 1.22
sbin/dump/main.c: revision 1.75
sbin/dump/dump.8: revision 1.70
sbin/dump/traverse.c: revision 1.52
sbin/dump/dump.8: revision 1.71

Document what rdump is (was once) for. PR 53442.

Use getfsspecname() to fill the filesystem argument in dumpdates.
While here, make sure that the error strings terminate with newline
consistently, and add a function that adds the system error string.

Add -U flag to dump(8) and dump_lfs(8) to specify dumpdates entry
This address situations where dump(8) cannot figure out the device being
dumped. It also allows tracking of subvolume dumps by using virtual
device as dumpdates entry.

Bump date for previous.
 1.43.2.1 21-Aug-2023  martin Pull up following revision(s) (requested by manu in ticket #1717):

sbin/dump/optr.c: revision 1.44

Silently ignore fstab entries with NAME= entries that cannot be resolved.

Fixes PR 56249.
 1.11 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.10 27-Mar-2003  lukem Use "wall -g operator" (instead of private code) to broadcast() messages to
members of the operator group.
Don't install "setgid tty", and remove now unnecessary gid/egid swapping.
Remove utmp trawling code pulled in from usr.bin/who.
The Code is now simpler, and more portable (without the utmp cruft) too.

This is derived from similar work in OpenBSD.
 1.9 15-Apr-1997  lukem use _PATH_DEFTAPE from <paths.h>
change doco references/examples from /dev/rmt* to /dev/rst*
 1.8 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.7 20-Jan-1995  mycroft Use /etc/rmt explicitly.
 1.6 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.5 22-Dec-1993  cgd new version from CSRG, via BSDI, with fixes
 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.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.25 24-Aug-2015  bouyer Default the read block size (-k default value) to kern.maxphys (usually
64k these days). This gives a noticable performance boost on large filesystems.
 1.24 15-Jun-2013  christos branches: 1.24.6;
handle new lfs split
 1.23 27-Jan-2010  spz branches: 1.23.6; 1.23.8; 1.23.12;
range-check what we assign to int cachebufs from calculations with
uint64_t usermem. This only becomes relevant if you have several TB of RAM.
Promoting cachebufs to uint64_t is not necessary as it gets limited to
(currently) 512 anyway.

fixes the last issue of PR: 19852
 1.22 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.21 13-Sep-2003  simonb branches: 1.21.32; 1.21.34;
Use HW_USERMEM64 to fetch the amount of memory available.
 1.20 19-Apr-2003  tls The sysctl returning the amount of memory in the system returns "int",
which is silly. Luckily, it really does return the correct result if
interpreted as an unsigned int. This change lets dump work on 32-bit
systems that have more than 2GB of RAM.
 1.19 06-Feb-2003  enami No need to print same error message twice in the same line.
 1.18 06-Feb-2003  enami Check lseek error correctly (i.e., use == -1 rather than < 0).
 1.17 04-Feb-2003  enami Fix typo I've introduced while cleaning up for commit.
 1.16 04-Feb-2003  enami - Fix daddr_t print format inside ifdef DIAGNOSTIC.
- Start scan cache entry just filled, rather than starting from top.
 1.15 04-Feb-2003  enami Convert `nblksread' to in terms of device block size. This restores
originally intended behaviour (see tech-userlevel archive around 1999 March).
 1.14 04-Feb-2003  enami Cosmetic changes.
 1.13 03-Feb-2003  hannken Merge "struct cheader" and "struct cdesc" into an union.
No more alignment problems if the alignment of these two differs.

Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.12 24-Jan-2003  fvdl Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
 1.11 19-Feb-2002  lukem branches: 1.11.2;
rcsid
 1.10 23-Dec-2001  lukem nuke trailing whitespace
 1.9 22-Dec-2001  lukem When using the read cache in bread(), ensure that the current (sub)block
isn't past the end of the file system.

Should fix the "spins forever but doing nothing" bug that dump
would occasionally have.
 1.8 22-Dec-2001  lukem - use correct type for minTime in findlru() (size_t instead of int)
- clean up whitespace
 1.7 22-Dec-2001  lukem In rawread(), add back a check to ensure that dump doesn't try to read
past EOM and fail with "short read error". This check was part of
traverse.c::bread(), and was removed when that function was migrated
to rcache.c::rawread() as part of the "read cache" functionality.

This should fix the problem with dump barfing on "short read" when "-r 0",
but I'm still debugging the problem where dump gets to a point and
"does nothing" when the read cache is being used.
 1.6 27-May-2001  lukem knf to ansi
 1.5 11-Oct-2000  briggs Fix format warnings
 1.4 01-Oct-1999  perseant branches: 1.4.6;
Working version of aborted dump{,_lfs} join.
 1.3 30-Sep-1999  perseant Back out changes made on the 29th, not at all the changes I intended to commit.
(I don't know how I did it though ... I'll figure it out tonight.)
I'll reapply this, in a working form, this evening.
 1.2 29-Sep-1999  perseant Adapt dump(8) to use filestore-independent (but still ufs-specific)
replacements for NINDIR, fsbtodb, etc. Create dump_lfs by adding a few
LFS-filestore-specific routines. As described in PR#8317.
 1.1 23-Mar-1999  bouyer branches: 1.1.2; 1.1.4;
Implement a read cache, as announced on tech-userlevel. Default is 32k
read buffer size, 512 buffer or 15% of the user memory. Can be changed
with the -k and -s options.
 1.1.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.2.1 11-Oct-2000  he Pull up revision 1.5 (requested by he):
Format string cleanup.
 1.4.6.2 16-Jan-2002  he Pull up revisions 1.7-1.10 (via patch, requested by bouyer):
Various fixes:
o Fix error if first tape is write-protected; fixes PR#4754 and PR#6098
o Make error codes conform to manual page
o Use \a to make noise
o Fix estimated number of tapes for huge dumps to cartridges
o Use <sys/queue.h> SLIST_* macros instead of homegrown variants
o Do not exit if unable to read/create /etc/dumpdates
o Support output (tape) device returning ENOSPC for end-of-media on write
o Don't dump core if SIGINFO is received before 1 second has elapsed
o Only process SIGINFO in currently active child
o Ensure current (sub)block isn't past end of file system -- fixes
"spins forever but does nothing" bug.
o Some other minor fixes (types, whitespace, KNF, unifdef sunos, ...)
 1.4.6.1 18-Oct-2000  tv Pullup sbin string format fixes [is].
See "cvs log" for explicit revision numbers per file, from sommerfeld.
 1.11.2.1 16-Jun-2003  grant Pull up revision 1.20 (requested by rafal in ticket #1272):

The sysctl returning the amount of memory in the system returns "int",
which is silly. Luckily, it really does return the correct result if
interpreted as an unsigned int. This change lets dump work on 32-bit
systems that have more than 2GB of RAM.
 1.21.34.1 18-May-2008  yamt sync with head.
 1.21.32.1 02-Jun-2008  mjf Sync with HEAD.
 1.23.12.1 23-Jun-2013  tls resync from head
 1.23.8.1 08-Mar-2016  snj Pull up following revision(s) (requested by bouyer in ticket #1331):
sbin/dump/dump.8: revision 1.67 via patch
sbin/dump/main.c: revision 1.72
sbin/dump/rcache.c: revision 1.25
Default the read block size (-k default value) to kern.maxphys (usually
64k these days). This gives a noticable performance boost on large filesystems.
 1.23.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.24.6.1 06-Nov-2015  riz Pull up following revision(s) (requested by bouyer in ticket #990):
sbin/dump/rcache.c: revision 1.25
sbin/dump/dump.8: revision 1.67
sbin/dump/main.c: revision 1.72
Default the read block size (-k default value) to kern.maxphys (usually
64k these days). This gives a noticable performance boost on large filesystems.
 1.5 01-Mar-1995  mycroft Clean up deleted files.
 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.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.7 03-Feb-2019  mrg - mark Exit() __dead
- bump a buffer size to avoid possible truncation
- adding missing fallthru comment
 1.6 24-Feb-2011  hannken branches: 1.6.44;
fss(4): Allow FSSIOCSET to set the initial flags. Add a new flag
"FSS_UNLINK_ON_CREATE" to unlink the backing store before
the snapshot gets created.

With this change dump(8) no longer dumps the zero-sized, but named
snapshot it is working on. Same applies to fsck_ffs(8).
 1.5 11-Apr-2010  hannken branches: 1.5.2;
Add -x option which allows to run `fsck_msdos -n' on a snapshot of
a live file system.

While here modify snap_open() to accept a character device as its
first arg and remove now unneeded get_snap_device().

Reviewed by: Manuel Bouyer <bouyer@netbsd.org>
 1.4 28-Apr-2008  martin branches: 1.4.4;
Remove clause 3 and 4 from TNF licenses
 1.3 26-Oct-2006  hannken branches: 1.3.18; 1.3.20;
When using a snapshot take the snapshot raw device on further open.

Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)

Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.2 19-Apr-2005  hannken branches: 1.2.2;
Fix copyright date for previous.
 1.1 19-Apr-2005  hannken Snapshot support for dump(8):

- New option `-x backup' takes the dump from a snapshot backed up by `backup'.
The snapshot will be deleted on exit.

- New option `-X' as a synonym for `-x mountpoint' where `mountpoint' is the
file system to be dumped.

Reviewed and Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.2.2.4 11-Nov-2006  bouyer Pull up following revision(s) (requested by hannken in ticket #1573):
sbin/dump/snapshot.h: revision 1.3 via patch
sbin/dump/snapshot.c: revision 1.3 via patch
sbin/dump/main.c: revision 1.63 via patch
sbin/dump/tape.c: revision 1.47 via patch
sbin/dump/dump.h: revision 1.44 via patch
When using a snapshot take the snapshot raw device on further open.
Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)
Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.2.2.3 21-Apr-2005  tron branches: 1.2.2.3.2; 1.2.2.3.4;
Pull up revision 1.2 (requested by hannken in ticket #184):
Fix copyright date for previous.
 1.2.2.2 21-Apr-2005  tron Pull up revision 1.1 (requested by hannken in ticket #184):
Snapshot support for dump(8):
- New option `-x backup' takes the dump from a snapshot backed up by `backup'.
The snapshot will be deleted on exit.
- New option `-X' as a synonym for `-x mountpoint' where `mountpoint' is the
file system to be dumped.
Reviewed and Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.2.2.1 19-Apr-2005  tron file snapshot.c was added on branch netbsd-3 on 2005-04-21 19:04:41 +0000
 1.2.2.3.4.1 11-Nov-2006  bouyer Pull up following revision(s) (requested by hannken in ticket #1573):
sbin/dump/snapshot.h: revision 1.3 via patch
sbin/dump/snapshot.c: revision 1.3 via patch
sbin/dump/main.c: revision 1.63 via patch
sbin/dump/tape.c: revision 1.47 via patch
sbin/dump/dump.h: revision 1.44 via patch
When using a snapshot take the snapshot raw device on further open.
Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)
Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.2.2.3.2.1 11-Nov-2006  bouyer Pull up following revision(s) (requested by hannken in ticket #1573):
sbin/dump/snapshot.h: revision 1.3 via patch
sbin/dump/snapshot.c: revision 1.3 via patch
sbin/dump/main.c: revision 1.63 via patch
sbin/dump/tape.c: revision 1.47 via patch
sbin/dump/dump.h: revision 1.44 via patch
When using a snapshot take the snapshot raw device on further open.
Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)
Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.3.20.1 18-May-2008  yamt sync with head.
 1.3.18.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.4.1 18-Jun-2011  bouyer Pull up following revision(s) (requested by hannken in ticket #1627):
sys/kern/vfs_wapbl.c: revisions 1.41-1.42
sbin/dump/snapshot.c: revisions 1.6 (patch)
share/man/man4/fss.4: revisions 1.15 (patch)
sys/dev/fss.c: revisions 1.73 (patch)
sys/dev/fssvar.h: revisions 1.25
usr.sbin/fssconfig/fssconfig.c: revisions 1.7
sys/ufs/ffs/ffs_balloc.c: revisions 1.54
sys/ufs/ffs/ffs_snapshot.c: revisions 1.90, 1.98, 1.100-1.101, 1.103-1.110, 1.111, 1.112-1.115 (patch)

- Try to keep snapshot indirect blocks contiguous. This speeds up snapshot
creation by a factor of ~3 and reduces the file system suspension time by
a factor of ~5.

- Refine the scope of WAPBL transactions and the limit for deallocations in
one transaction so we should no longer get a "wapbl_flush: current
transaction too big to flush" panic when creating or removing snapshots
on larger logging disks.

- fss(4): Allow FSSIOCSET to set the initial flags. Add a new flag
"FSS_UNLINK_ON_CREATE" to unlink the backing store before the snapshot
gets created. With this change dump(8) no longer dumps the zero-sized,
but named snapshot it is working on.
 1.5.2.1 05-Mar-2011  bouyer Sync with HEAD
 1.6.44.1 10-Jun-2019  christos Sync with HEAD
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 26-Oct-2006  hannken branches: 1.3.18; 1.3.20;
When using a snapshot take the snapshot raw device on further open.

Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)

Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.2 19-Apr-2005  hannken branches: 1.2.2;
Fix copyright date for previous.
 1.1 19-Apr-2005  hannken Snapshot support for dump(8):

- New option `-x backup' takes the dump from a snapshot backed up by `backup'.
The snapshot will be deleted on exit.

- New option `-X' as a synonym for `-x mountpoint' where `mountpoint' is the
file system to be dumped.

Reviewed and Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.2.2.4 11-Nov-2006  bouyer Pull up following revision(s) (requested by hannken in ticket #1573):
sbin/dump/snapshot.h: revision 1.3 via patch
sbin/dump/snapshot.c: revision 1.3 via patch
sbin/dump/main.c: revision 1.63 via patch
sbin/dump/tape.c: revision 1.47 via patch
sbin/dump/dump.h: revision 1.44 via patch
When using a snapshot take the snapshot raw device on further open.
Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)
Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.2.2.3 21-Apr-2005  tron branches: 1.2.2.3.2; 1.2.2.3.4;
Pull up revision 1.2 (requested by hannken in ticket #184):
Fix copyright date for previous.
 1.2.2.2 21-Apr-2005  tron Pull up revision 1.1 (requested by hannken in ticket #184):
Snapshot support for dump(8):
- New option `-x backup' takes the dump from a snapshot backed up by `backup'.
The snapshot will be deleted on exit.
- New option `-X' as a synonym for `-x mountpoint' where `mountpoint' is the
file system to be dumped.
Reviewed and Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.2.2.1 19-Apr-2005  tron file snapshot.h was added on branch netbsd-3 on 2005-04-21 19:04:41 +0000
 1.2.2.3.4.1 11-Nov-2006  bouyer Pull up following revision(s) (requested by hannken in ticket #1573):
sbin/dump/snapshot.h: revision 1.3 via patch
sbin/dump/snapshot.c: revision 1.3 via patch
sbin/dump/main.c: revision 1.63 via patch
sbin/dump/tape.c: revision 1.47 via patch
sbin/dump/dump.h: revision 1.44 via patch
When using a snapshot take the snapshot raw device on further open.
Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)
Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.2.2.3.2.1 11-Nov-2006  bouyer Pull up following revision(s) (requested by hannken in ticket #1573):
sbin/dump/snapshot.h: revision 1.3 via patch
sbin/dump/snapshot.c: revision 1.3 via patch
sbin/dump/main.c: revision 1.63 via patch
sbin/dump/tape.c: revision 1.47 via patch
sbin/dump/dump.h: revision 1.44 via patch
When using a snapshot take the snapshot raw device on further open.
Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)
Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.3.20.1 18-May-2008  yamt sync with head.
 1.3.18.1 02-Jun-2008  mjf Sync with HEAD.
 1.57 19-Jun-2021  christos Add external attribute dumping and restoring support from FreeBSD.
Does not fully work yet, attributes are being saved and restored correctly,
but don't appear in the restored files somehow.
 1.56 07-Jun-2021  hannken Bitmaps (TS_BITS and TS_CLRI) dont use the "c_addr" array as they
cannot have holes. As bitmaps are written without TS_ADDR records
"c_count" may be larger than the "c_addr" size resulting in a
segmentation violation reading "c_addr" beyond its end.

Compute "blks" for TS_INODE and TS_ADDR only -- its used for multi
volume dumps and the bitmaps must both be on the first volume.
 1.55 01-Mar-2019  christos branches: 1.55.2;
Use getfsspecname() to fill the filesystem argument in dumpdates.
While here, make sure that the error strings terminate with newline
consistently, and add a function that adds the system error string.
 1.54 24-Aug-2015  bouyer branches: 1.54.8; 1.54.16;
Consistently use iswap64() and 64bit intermediate variable, as well as
64bit formats for c_tapea. Fixes tape useage report for large filesystems.
 1.53 15-Jun-2013  christos branches: 1.53.6;
handle new lfs split
 1.52 13-Jan-2013  dholland Use void * for I/O functions and remove no-longer-needed casts.
 1.51 13-Jan-2013  dholland Add some const.
 1.50 16-Sep-2011  plunky branches: 1.50.2; 1.50.4; 1.50.8;
NULL does not need a cast, here
 1.49 16-Feb-2008  matt Fix some inconsisent/conflicting definitions and missing parameters
 1.48 18-Dec-2006  christos branches: 1.48.4; 1.48.6;
Convert a couple of "(void)&" constructs to volatile.
Flag various unused parameters in restore and dump so that these will
compile with -Wextra. (Note: restore uses some stuff from dump.)
 1.47 26-Oct-2006  hannken When using a snapshot take the snapshot raw device on further open.

Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)

Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.46 24-Jun-2006  perseant Change LFCNWRAP{STOP,GO} to make them more suitable for snapshotting; in
particular, the caller can now choose whether to wait for the condition
to be met, and if the caller of LFCNWRAPSTOP dies or otherwise closes
the descriptor, the filesystem is started again. Updated the ckckp
regression test to use the new semantics.

dump_lfs(8) now uses the fcntls to implement LFS-style snapshotting through
the -X flag, addressing PR#33457 albeit not using fss(4). Fixed a couple
other problems with dump_lfs that manifested themselves during testing.
 1.45 02-Jun-2005  lukem appease gcc -Wuninitialized
 1.44 08-Aug-2004  lukem branches: 1.44.2; 1.44.4; 1.44.6;
Signal handlers should manipulate 'volatile sig_atomic_t' instead of 'int'.
 1.43 15-Mar-2004  lukem Adjust tstart_volume (volume start time) by the time spent in query(),
similar to the adjustment for tstart_writing made in optr.c rev 1.4.
Should fix PR bin/19711 from matthew green.
 1.42 18-Feb-2004  hannken Avoid signal race condition. If a slave gets the SIGUSR2 signal between
the "setjmp" and the "ready = 1" statements the slave will pause forever
and the complet dump hangs.

Fixes PR #24453
 1.41 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.40 02-Apr-2003  fvdl Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
 1.39 16-Jan-2003  kleink Rename `sigset' locals to avoid symbol shadowing warning.
 1.38 18-Aug-2002  yamt save/restore errno in signal handlers.
 1.37 07-Jan-2002  bouyer For -l: specify the timeout on the command line (in seconds) instead of
hardwiring it to 2s, as suggested on tech-userlevel.
 1.36 30-Dec-2001  lukem Add -a to "auto-size" the tape, rather than relying upon other options
to define the tape size. Requires the tape driver to either return ENOSPC
at end of media, or 0 when a write is attempted (such as the "early warning"
support in st(4) enabled with "mt eew 1"). From FreeBSD.
 1.35 25-Dec-2001  lukem Fixes from FreeBSD:
- Fix error if first tape was write protected. Fix NetBSD PRs 4754 and 6098.
- Make dump exit codes confirm to manual page.
- Use \a instead of \7 to make noise.
- Fix estimated number of tapes for huge dumps to cartridges.
- Use <sys/queue.h> SLIST_* instead of home-rolled lists.
- Do not exit if unable to read or create /etc/dumpdates.
- Support output (tape) device returning ENOSPC for end-of-media on a write.

Fixes by me:
- Remove unused ddates_in.
- Don't dump core if SIGINFO is received before 1 second has elapsed.
- Only process SIGINFO in current "active" child.
- Don't dump core in -w if dumpdates wasn't readable and ddatev == NULL
- Minor KNF; wrap some lines
 1.34 23-Dec-2001  lukem unifdef sunos
 1.33 23-Dec-2001  lukem nuke trailing whitespace
 1.32 22-Dec-2001  lukem - use correct type for minTime in findlru() (size_t instead of int)
- clean up whitespace
 1.31 14-Dec-2001  bouyer Add a -l (autoload) flag. For multivolume dumps, this makes dump eject the
tape when a volume is full, and try to reopen the tape drive for 2 mn.
To be used with tape changers which load the next tape when the current one is
ejected.
While I'm there fix eject handling for remote tape.
 1.30 01-Nov-2001  lukem fix -Wshadow warnings
 1.29 14-Aug-2001  lukem s/filesystem/file system/dump.h
 1.28 28-May-2001  lukem * improve parsing of file-systems-to-dump when a path is given:
- if it's a path to an unmounted file-system listed in /etc/fstab, use
that instead of assuming the user wanted a subtree dump of the parent
directory. this restores the behaviour of dump before the subtree
dumping code went in.
- if it's a path to a mounted file-system which is not in /etc/fstab,
use the info from getmntinfo(3). previously, dump would choke.
* implement error checked malloc(), calloc(), strdup(), and use
appropriately (some of the calloc()s weren't being checked)
* use 'file-system' instead of 'filesystem' in the man page
 1.27 28-May-2001  lukem unifdef !__STDC__ (missed in previous)
 1.26 27-May-2001  lukem knf to ansi
 1.25 12-May-2001  tron Fix bug in new "e" option: only eject tape if it is full, not if the dump
was finished.
 1.24 07-May-2001  tron Add a new option "e" to "dump" which allows to eject tapes automatically
if a tape change is required.
 1.23 11-Oct-2000  he Better fix for format warnings.
The type of time_t varies between ports, so we need to cast
before printing. It appears to be sufficient and safe to use (int).
 1.22 11-Oct-2000  briggs Fix format warnings
 1.21 01-Oct-1999  perseant branches: 1.21.6;
Working version of aborted dump{,_lfs} join.
 1.20 30-Sep-1999  perseant Back out changes made on the 29th, not at all the changes I intended to commit.
(I don't know how I did it though ... I'll figure it out tonight.)
I'll reapply this, in a working form, this evening.
 1.19 29-Sep-1999  perseant Adapt dump(8) to use filestore-independent (but still ufs-specific)
replacements for NINDIR, fsbtodb, etc. Create dump_lfs by adding a few
LFS-filestore-specific routines. As described in PR#8317.
 1.18 23-Mar-1999  bouyer branches: 1.18.2; 1.18.4;
Implement a read cache, as announced on tech-userlevel. Default is 32k
read buffer size, 512 buffer or 15% of the user memory. Can be changed
with the -k and -s options.
 1.17 18-Jul-1998  lukem use AF_LOCAL instead of AF_UNIX
 1.16 18-Mar-1998  bouyer Add support for non-native byte order FFS. The dump is in filesystem byte
order, restore already knows how to byteswap dumps.
 1.15 16-Sep-1997  mrg make these compile on the alpha after WARNS=1.
 1.14 16-Sep-1997  lukem resolve conflicts from lite-2 import
 1.13 15-Sep-1997  lukem remove __dead
 1.12 15-Sep-1997  lukem * cleanup for WARNS=1
* fix use of .Nm
* comment out some unused(?) functions
 1.11 05-Jun-1997  lukem * Add the ability to dump specific files & directories of a single
filesystem. This uses fts(3) to access the directory structure (and
not the raw device), so the standard access permissions are adhered
to (unlike dumping an entire filesystem, which just requires read
access to the raw disk device).
* Support SIGINFO status reporting.
* Remove now unused variables that previously stored the (e)uid.
* Be more informative in a couple of error messages.
 1.10 15-Apr-1997  lukem use _PATH_DEFTAPE from <paths.h>
change doco references/examples from /dev/rmt* to /dev/rst*
 1.9 15-Apr-1997  lukem remove use of "register".
 1.8 10-Apr-1997  lukem Implement changes from [bin/1915]
* 'w' and 'W' display the year
* verbosity additions displaying total & per-volume transfer times and rates
 1.7 21-Mar-1995  mycroft Use POSIX signals.
 1.6 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.5 31-Oct-1994  cgd correct return values.
 1.4 23-Sep-1994  mycroft Eliminate uses of some obsolete functions.
 1.3 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.2 09-Mar-1994  cgd light clean, and don't forget to close remote tape when aborting.
Inspired by Andreas Schulz.
 1.1 22-Dec-1993  cgd branches: 1.1.1;
new version from CSRG, via BSDI, with fixes
 1.1.1.2 16-Sep-1997  lukem imported from lite-2
 1.1.1.1 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.18.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.18.2.2 11-Oct-2000  he Pull up revision 1.23 (requested by he):
Format string cleanup.
 1.18.2.1 11-Oct-2000  he Pull up revision 1.22 (requested by he):
Format string cleanup.
 1.21.6.6 16-Jan-2002  he Pull up revision 1.36 (via patch, requested by bouyer):
Add an ``-a'' option to ``auto-size'' the tape, rather than
relying upon other options to define the tape size.
 1.21.6.5 16-Jan-2002  he Pull up revisions 1.32-1.35 (via patch, requested by bouyer):
Various fixes:
o Fix error if first tape is write-protected; fixes PR#4754 and PR#6098
o Make error codes conform to manual page
o Use \a to make noise
o Fix estimated number of tapes for huge dumps to cartridges
o Use <sys/queue.h> SLIST_* macros instead of homegrown variants
o Do not exit if unable to read/create /etc/dumpdates
o Support output (tape) device returning ENOSPC for end-of-media on write
o Don't dump core if SIGINFO is received before 1 second has elapsed
o Only process SIGINFO in currently active child
o Ensure current (sub)block isn't past end of file system -- fixes
"spins forever but does nothing" bug.
o Some other minor fixes (types, whitespace, KNF, unifdef sunos, ...)
 1.21.6.4 16-Jan-2002  he Pull up revisions 1.31,1.37 (requested by bouyer):
Implement ``-l <timeout>'' option for use with e.g. autochangers.
 1.21.6.3 15-May-2001  he Pull up revision 1.25 (requested by tron):
Fix bug in new ``e'' option: only eject tape if it is full, not
if the dump was finished.
 1.21.6.2 09-May-2001  he Pull up revision 1.24 (requested by tron):
Add a new option ``e'' to dump which directs it to eject tapes
automatically if a tape change is required.
 1.21.6.1 17-Oct-2000  tv Pullup 1.22 [releng] and 1.23 [he]:
Fix format warnings.
The type of time_t varies between ports, so we need to cast
before printing. It appears to be sufficient and safe to use (int).
 1.44.6.1 11-Nov-2006  bouyer Pull up following revision(s) (requested by hannken in ticket #1573):
sbin/dump/snapshot.h: revision 1.3 via patch
sbin/dump/snapshot.c: revision 1.3 via patch
sbin/dump/main.c: revision 1.63 via patch
sbin/dump/tape.c: revision 1.47 via patch
sbin/dump/dump.h: revision 1.44 via patch
When using a snapshot take the snapshot raw device on further open.
Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)
Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.44.4.1 11-Nov-2006  bouyer Pull up following revision(s) (requested by hannken in ticket #1573):
sbin/dump/snapshot.h: revision 1.3 via patch
sbin/dump/snapshot.c: revision 1.3 via patch
sbin/dump/main.c: revision 1.63 via patch
sbin/dump/tape.c: revision 1.47 via patch
sbin/dump/dump.h: revision 1.44 via patch
When using a snapshot take the snapshot raw device on further open.
Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)
Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.44.2.1 11-Nov-2006  bouyer Pull up following revision(s) (requested by hannken in ticket #1573):
sbin/dump/snapshot.h: revision 1.3 via patch
sbin/dump/snapshot.c: revision 1.3 via patch
sbin/dump/main.c: revision 1.63 via patch
sbin/dump/tape.c: revision 1.47 via patch
sbin/dump/dump.h: revision 1.44 via patch
When using a snapshot take the snapshot raw device on further open.
Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)
Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.48.6.1 18-Feb-2008  mjf Sync with HEAD.
 1.48.4.1 23-Mar-2008  matt sync with HEAD
 1.50.8.2 23-Jun-2013  tls resync from head
 1.50.8.1 25-Feb-2013  tls resync with head
 1.50.4.1 08-Mar-2016  snj Pull up following revision(s) (requested by bouyer in ticket #1332):
sbin/dump/main.c: revision 1.73
sbin/dump/tape.c: revision 1.54
Consistently use iswap64() and 64bit intermediate variable, as well as
64bit formats for c_tapea. Fixes tape useage report for large filesystems.
 1.50.2.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.50.2.1 23-Jan-2013  yamt sync with head
 1.53.6.1 06-Nov-2015  riz Pull up following revision(s) (requested by bouyer in ticket #991):
sbin/dump/tape.c: revision 1.54
sbin/dump/main.c: revision 1.73
Consistently use iswap64() and 64bit intermediate variable, as well as
64bit formats for c_tapea. Fixes tape useage report for large filesystems.
 1.54.16.1 10-Jun-2019  christos Sync with HEAD
 1.54.8.2 08-Jun-2021  martin Pull up following revision(s) (requested by hannken in ticket #1683):

sbin/dump/tape.c: revision 1.56

Bitmaps (TS_BITS and TS_CLRI) dont use the "c_addr" array as they
cannot have holes. As bitmaps are written without TS_ADDR records
"c_count" may be larger than the "c_addr" size resulting in a
segmentation violation reading "c_addr" beyond its end.

Compute "blks" for TS_INODE and TS_ADDR only -- its used for multi
volume dumps and the bitmaps must both be on the first volume.
 1.54.8.1 29-Mar-2019  martin Pull up following revision(s) (requested by manu in ticket #1221):

sbin/dump/tape.c: revision 1.55
sbin/dump_lfs/dump_lfs.8: revision 1.18
sbin/dump/dump.h: revision 1.56
sbin/dump/dump.8: revision 1.69
sbin/dump/dump.h: revision 1.57
sbin/dump/ffs_inode.c: revision 1.23
sbin/dump/optr.c: revision 1.43
sbin/dump/itime.c: revision 1.21
sbin/dump/main.c: revision 1.74
sbin/dump/itime.c: revision 1.22
sbin/dump/main.c: revision 1.75
sbin/dump/dump.8: revision 1.70
sbin/dump/traverse.c: revision 1.52
sbin/dump/dump.8: revision 1.71

Document what rdump is (was once) for. PR 53442.

Use getfsspecname() to fill the filesystem argument in dumpdates.
While here, make sure that the error strings terminate with newline
consistently, and add a function that adds the system error string.

Add -U flag to dump(8) and dump_lfs(8) to specify dumpdates entry
This address situations where dump(8) cannot figure out the device being
dumped. It also allows tracking of subvolume dumps by using virtual
device as dumpdates entry.

Bump date for previous.
 1.55.2.1 08-Jun-2021  martin Pull up following revision(s) (requested by hannken in ticket #1283):

sbin/dump/tape.c: revision 1.56

Bitmaps (TS_BITS and TS_CLRI) dont use the "c_addr" array as they
cannot have holes. As bitmaps are written without TS_ADDR records
"c_count" may be larger than the "c_addr" size resulting in a
segmentation violation reading "c_addr" beyond its end.

Compute "blks" for TS_INODE and TS_ADDR only -- its used for multi
volume dumps and the bitmaps must both be on the first volume.
 1.56 07-Aug-2023  mrg fix always true conditional by removing the address-of operator.

found by GCC 12.
 1.55 26-Jan-2022  christos PR/56643: Paul Goyette: Disable the last block adjustment for now. It seems
to break restore.
 1.54 07-Jul-2021  christos PR/56270: Matthias Scheler: dump fails on ffsv1: Zero c_extsize since ffsv1
does not support extended attributes.
 1.53 19-Jun-2021  christos Add external attribute dumping and restoring support from FreeBSD.
Does not fully work yet, attributes are being saved and restored correctly,
but don't appear in the restored files somehow.
 1.52 01-Mar-2019  christos Use getfsspecname() to fill the filesystem argument in dumpdates.
While here, make sure that the error strings terminate with newline
consistently, and add a function that adds the system error string.
 1.51 03-Feb-2019  mrg - mark Exit() __dead
- bump a buffer size to avoid possible truncation
- adding missing fallthru comment
 1.50 15-Jun-2013  christos branches: 1.50.20; 1.50.28;
handle new lfs split
 1.49 22-Jan-2013  dholland Stuff UFS_ in front of a few of ufs's symbols to reduce namespace
pollution. Specifically:
ROOTINO -> UFS_ROOTINO
WINO -> UFS_WINO
NXADDR -> UFS_NXADDR
NDADDR -> UFS_NDADDR
NIADDR -> UFS_NIADDR
MAXSYMLINKLEN -> UFS_MAXSYMLINKLEN
MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency)

Sort out ext2fs's misuse of NDADDR and NIADDR; fortunately, these have
the same values in ext2fs and ffs.

No functional change intended.
 1.48 12-Aug-2008  simonb branches: 1.48.18; 1.48.24;
We don't need to dump WAPBL log files - don't dump files with SF_LOG
flag set, and document this.
 1.47 24-Jun-2006  perseant branches: 1.47.20; 1.47.24;
Change LFCNWRAP{STOP,GO} to make them more suitable for snapshotting; in
particular, the caller can now choose whether to wait for the condition
to be met, and if the caller of LFCNWRAPSTOP dies or otherwise closes
the descriptor, the filesystem is started again. Updated the ckckp
regression test to use the new semantics.

dump_lfs(8) now uses the fcntls to implement LFS-style snapshotting through
the -X flag, addressing PR#33457 albeit not using fss(4). Fixed a couple
other problems with dump_lfs that manifested themselves during testing.
 1.46 21-Apr-2006  skrll Don't use cast expressions as lvalues as newer versions of gcc warn.
 1.45 19-Aug-2005  christos 64 bit inode changes
 1.44 25-May-2004  hannken Add ffs internal snapshots. Written by Marshall Kirk McKusick for FreeBSD.

- Not enabled by default. Needs kernel option FFS_SNAPSHOT.
- Change parameters of ffs_blkfree.
- Let the copy-on-write functions return an error so spec_strategy
may fail if the copy-on-write fails.
- Change genfs_*lock*() to use vp->v_vnlock instead of &vp->v_lock.
- Add flag B_METAONLY to VOP_BALLOC to return indirect block buffer.
- Add a function ffs_checkfreefile needed for snapshot creation.
- Add special handling of snapshot files:
Snapshots may not be opened for writing and the attributes are read-only.
Use the mtime as the time this snapshot was taken.
Deny mtime updates for snapshot files.
- Add function transferlockers to transfer any waiting processes from
one lock to another.
- Add vfsop VFS_SNAPSHOT to take a snapshot and make it accessible through
a vnode.
- Add snapshot support to ls, fsck_ffs and dump.

Welcome to 2.0F.

Approved by: Jason R. Thorpe <thorpej@netbsd.org>
 1.43 24-Mar-2004  hannken Make the computation of estimated blocks work for frag size != 1024.
 1.42 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.41 01-May-2003  fvdl Fix byteswapping issues in dirindir(); mostly from Enami Tsugutomo.
 1.40 01-May-2003  fvdl Swap the right disk block in mapdirs() for the UFS1 case. From Enami.
 1.39 08-Apr-2003  fvdl Since the size passed in may be different from the fs blocksize, just
allocate a buffer each time instead of using a static one.
 1.38 08-Apr-2003  fvdl dblk should be static. Fixes PR 21020, by Geoff Wing. Patch supplied
by him.
 1.37 02-Apr-2003  fvdl Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
 1.36 24-Jan-2003  fvdl Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
 1.35 30-Sep-2002  lukem Add fix from FreeBSD traverse.c 1.16:
Files in subdirectories of directories that have the nodump flag set
are sometimes incorrectly being dumped.

The problem arises because the subdirectory only gets its entry
cleared from usedinomap if it is also present in dumpinomap, and it is
the absence of a directory in usedinomap that internally indicates
that the directory is under the effects of UF_NODUMP (either directly
or inherited).

FreeBSD PR: 32414
Submitted by: David C Lawrence <tale@dd.org>
 1.34 23-Dec-2001  lukem unifdef sunos
 1.33 01-Nov-2001  lukem fix -Wshadow warnings
 1.32 14-Aug-2001  lukem s/filesystem/file system/dump.h
 1.31 28-May-2001  lukem * improve parsing of file-systems-to-dump when a path is given:
- if it's a path to an unmounted file-system listed in /etc/fstab, use
that instead of assuming the user wanted a subtree dump of the parent
directory. this restores the behaviour of dump before the subtree
dumping code went in.
- if it's a path to a mounted file-system which is not in /etc/fstab,
use the info from getmntinfo(3). previously, dump would choke.
* implement error checked malloc(), calloc(), strdup(), and use
appropriately (some of the calloc()s weren't being checked)
* use 'file-system' instead of 'filesystem' in the man page
 1.30 28-May-2001  lukem unifdef !__STDC__ (missed in previous)
 1.29 27-May-2001  lukem knf to ansi
 1.28 01-Oct-1999  perseant branches: 1.28.6;
Working version of aborted dump{,_lfs} join.
 1.27 30-Sep-1999  perseant Back out changes made on the 29th, not at all the changes I intended to commit.
(I don't know how I did it though ... I'll figure it out tonight.)
I'll reapply this, in a working form, this evening.
 1.26 29-Sep-1999  perseant Adapt dump(8) to use filestore-independent (but still ufs-specific)
replacements for NINDIR, fsbtodb, etc. Create dump_lfs by adding a few
LFS-filestore-specific routines. As described in PR#8317.
 1.25 05-May-1999  sommerfe branches: 1.25.2;
Avoid byte overflow in block estimate for large files
 1.24 23-Mar-1999  bouyer branches: 1.24.2;
Implement a read cache, as announced on tech-userlevel. Default is 32k
read buffer size, 512 buffer or 15% of the user memory. Can be changed
with the -k and -s options.
 1.23 09-Mar-1999  bouyer Handle "nodump" flag on directories, by not dumping any files or directories
under it. Based on some parts of PR 6705 by Brian Grayson.
In the Makefile, add (commented out) debug options that can be turned on.
 1.22 28-Dec-1998  lukem fix estimate of blocks for subsets.
fix from Brian Grayson <bgrayson@ece.utexas.edu> in [bin/6607]
 1.21 25-Aug-1998  ross from Erik Bertelsen <erik@mediator.uni-c.dk>
{ put } { in } { lots } { of } { these } { to } { shut } { up } { egcs }
 1.20 18-Mar-1998  bouyer Add support for non-native byte order FFS. The dump is in filesystem byte
order, restore already knows how to byteswap dumps.
 1.19 16-Sep-1997  lukem resolve conflicts from lite-2 import
 1.18 15-Sep-1997  lukem * cleanup for WARNS=1
* fix use of .Nm
* comment out some unused(?) functions
 1.17 05-Jun-1997  lukem * Add the ability to dump specific files & directories of a single
filesystem. This uses fts(3) to access the directory structure (and
not the raw device), so the standard access permissions are adhered
to (unlike dumping an entire filesystem, which just requires read
access to the raw disk device).
* Support SIGINFO status reporting.
* Remove now unused variables that previously stored the (e)uid.
* Be more informative in a couple of error messages.
 1.16 15-Apr-1997  lukem remove use of "register".
 1.15 30-Nov-1996  cgd patches from Tom I Helbekkmo <tih@nhh.no> to deal with type-size issues,
so this works (better, at least) on 64-bit machines (e.g. alpha).
 1.14 18-Jun-1995  cgd branches: 1.14.6;
update for posixified stat structure
 1.13 11-Jun-1995  mycroft Back out previous change.
 1.12 07-Jun-1995  cgd typeof(timeval.tv_sec) != time_t
 1.11 27-Mar-1995  mycroft Fix another bogus cast.
 1.10 27-Mar-1995  mycroft Remove incorrect cast on lseek() return value.
 1.9 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.8 30-Jan-1995  mycroft Don't mix stat flags and inode flags.
 1.7 23-Sep-1994  mycroft Eliminate uses of some obsolete functions.
 1.6 17-Sep-1994  mycroft Correct typo; IFMT -> S_IFMT.
 1.5 14-Jun-1994  mycroft Fix compatibility with old fastlinks.
 1.4 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.3 25-Apr-1994  cgd change some #ifdef's.
 1.2 14-Jan-1994  cgd fix for() starting condition in mapfiles()
 1.1 22-Dec-1993  cgd branches: 1.1.1;
new version from CSRG, via BSDI, with fixes
 1.1.1.2 16-Sep-1997  lukem imported from lite-2
 1.1.1.1 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.14.6.1 06-Dec-1996  rat Pullup request from Chris G Demetriou <Chris_G_Demetriou@ux2.sp.cs.cmu.edu>

>Make dump and restore usable on the alpha
 1.24.2.1 05-May-1999  perry pullup 1.24->1.25 (sommerfeld)
 1.25.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.28.6.1 16-Jan-2002  he Pull up revision 1.34 (via patch, requested by bouyer):
Various fixes:
o Fix error if first tape is write-protected; fixes PR#4754 and PR#6098
o Make error codes conform to manual page
o Use \a to make noise
o Fix estimated number of tapes for huge dumps to cartridges
o Use <sys/queue.h> SLIST_* macros instead of homegrown variants
o Do not exit if unable to read/create /etc/dumpdates
o Support output (tape) device returning ENOSPC for end-of-media on write
o Don't dump core if SIGINFO is received before 1 second has elapsed
o Only process SIGINFO in currently active child
o Ensure current (sub)block isn't past end of file system -- fixes
"spins forever but does nothing" bug.
o Some other minor fixes (types, whitespace, KNF, unifdef sunos, ...)
 1.47.24.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.47.20.1 28-Sep-2008  mjf Sync with HEAD.
 1.48.24.2 23-Jun-2013  tls resync from head
 1.48.24.1 25-Feb-2013  tls resync with head
 1.48.18.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.48.18.1 23-Jan-2013  yamt sync with head
 1.50.28.1 10-Jun-2019  christos Sync with HEAD
 1.50.20.1 29-Mar-2019  martin Pull up following revision(s) (requested by manu in ticket #1221):

sbin/dump/tape.c: revision 1.55
sbin/dump_lfs/dump_lfs.8: revision 1.18
sbin/dump/dump.h: revision 1.56
sbin/dump/dump.8: revision 1.69
sbin/dump/dump.h: revision 1.57
sbin/dump/ffs_inode.c: revision 1.23
sbin/dump/optr.c: revision 1.43
sbin/dump/itime.c: revision 1.21
sbin/dump/main.c: revision 1.74
sbin/dump/itime.c: revision 1.22
sbin/dump/main.c: revision 1.75
sbin/dump/dump.8: revision 1.70
sbin/dump/traverse.c: revision 1.52
sbin/dump/dump.8: revision 1.71

Document what rdump is (was once) for. PR 53442.

Use getfsspecname() to fill the filesystem argument in dumpdates.
While here, make sure that the error strings terminate with newline
consistently, and add a function that adds the system error string.

Add -U flag to dump(8) and dump_lfs(8) to specify dumpdates entry
This address situations where dump(8) cannot figure out the device being
dumped. It also allows tracking of subvolume dumps by using virtual
device as dumpdates entry.

Bump date for previous.
 1.17 15-Jun-2013  christos handle new lfs split
 1.16 13-Jan-2013  dholland Add some const.
 1.15 07-Aug-2003  agc branches: 1.15.56; 1.15.62;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22308, verified by myself.
 1.14 02-Apr-2003  fvdl Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
 1.13 27-May-2001  lukem knf to ansi
 1.12 04-Feb-1998  christos Use strptime() instead of a home grown parser.
 1.11 15-Sep-1997  lukem * cleanup for WARNS=1
* fix use of .Nm
* comment out some unused(?) functions
 1.10 15-Apr-1997  lukem remove use of "register".
 1.9 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.8 28-Dec-1994  mycroft Sync with CSRG.
 1.7 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.6 24-Dec-1993  jtc Replace emitl(), a function that converts a struct tm to a time_t, with
a call to C library function mktime(), which does the exact same thing
(using basically the same algorithm too).
 1.5 22-Dec-1993  cgd new version from CSRG, via BSDI, with fixes
 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.62.2 23-Jun-2013  tls resync from head
 1.15.62.1 25-Feb-2013  tls resync with head
 1.15.56.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.15.56.1 23-Jan-2013  yamt sync with head

RSS XML Feed