dragonfly.git
4 years agoFix immutable flag handling in our mtree(8) invocations.
Sascha Wildner [Sun, 6 Oct 2019 13:33:04 +0000 (15:33 +0200)]
Fix immutable flag handling in our mtree(8) invocations.

All of this only affects /var/empty so far.

* If NOSCHG isn't set (which is the default), pass -i to mtree(8) when
  installing the system or building an installer img.

* Pass -i always when we install a system from the installer. This
  installer usage of mtree(8) should not be needed. Expand the comment
  a bit.

Reported-by: zrj
4 years agokernel/isa: Bury the intrmask_t type.
zrj [Sun, 6 Oct 2019 07:30:47 +0000 (10:30 +0300)]
kernel/isa: Bury the intrmask_t type.

 It is neither MI nor MD nor pure PD type, it is ISA placeholder type.
 Also it is unfortunately named and implies bad things.  The only way to
 make it consistent is to split it, since this type usage falls under
 standard/isa options.  The vkernel64 was already wrongly declaring it.

 No differences in generated binary outputs.

4 years agokernel: Make chflags syscalls argument types consistent with userland.
zrj [Sun, 6 Oct 2019 07:30:02 +0000 (10:30 +0300)]
kernel: Make chflags syscalls argument types consistent with userland.

 There was an inconsistency between userland and syscalls argument types
 that was inherited after initial fork.  Adjust prototypes to use u_long
 and add missing const char* too.  Rerun sysent.  Change tmpfs/dirfs to
 use u_int for flags since mask for superuser changeable flags is
 SF_SETTABLE 0xffff0000 (most fs use uint32_t), adjust mksubr script.
 Remove no longer needed (u_long) casts I could find elsewhere.

 While there, adjust unistd.h prototypes to use generic types too.

4 years agoworld: Eliminate custom uintfptr_t/fptrdiff_t types.
zrj [Sun, 6 Oct 2019 07:28:35 +0000 (10:28 +0300)]
world: Eliminate custom uintfptr_t/fptrdiff_t types.

 These were not used consistently and have visibility limitations,
 types.h - #indef _KERNEL while profile.h - publicly.  Use cases like:
  "uintfptr_t selfpcdiff;" and "fptrdiff_t frompci;" only confuse.
 Given that underlying structs uprof, rawarc already use plain u_long
 types, there are plenty (u_long) casts elsewhere in the kernel code,
 follow OpenBSD and use use (u_long) casts that are clear what they do.
 The unused intfptr_t type does not make much sense anyway.

4 years ago<unistd.h>: Fix profil(2) prototype.
zrj [Sun, 6 Oct 2019 07:27:18 +0000 (10:27 +0300)]
<unistd.h>: Fix profil(2) prototype.

 First off the vm_offset_t is somewhat bogus in this context, same could
 be said about size_t variant in sys/sysproto.h.  Just use plain u_long
 type like it is already used in "struct uprof" and fix forth argument
 to take u_int.  In public headers prefer to use generic types.

4 years ago<sys/stdint.h>: Move out two MD types.
zrj [Sun, 6 Oct 2019 07:26:29 +0000 (10:26 +0300)]
<sys/stdint.h>: Move out two MD types.

 The <cpu/types.h> would be a better place for these, however it needs
 proper cleanup first and would only complicate visibility on other
 standard headers at the moment.

4 years ago<sys/types.h>: Eliminate __nl_item type.
zrj [Sun, 6 Oct 2019 07:26:02 +0000 (10:26 +0300)]
<sys/types.h>: Eliminate __nl_item type.

 It is MI type, so just use standard int type as per POSIX.

4 years ago<runetype.h>: Convert __rune_t to internal typedef.
zrj [Sun, 6 Oct 2019 07:25:29 +0000 (10:25 +0300)]
<runetype.h>: Convert __rune_t to internal typedef.

 The __ct_rune_t is a basic type for __rune_t/__wint_t/__wchar_t.
 No functional change.

 While there, remove two trailing white spaces.

4 years agoNuke legacy non standard rune_t type.
zrj [Sun, 6 Oct 2019 07:25:02 +0000 (10:25 +0300)]
Nuke legacy non standard rune_t type.

 Not used anywhere and comments indicate it is meant not to be used
 outside lib/libc/locale anyway.

4 years agosbin/fsck_hammer2: More refactoring
Tomohiro Kusumi [Sun, 6 Oct 2019 01:02:08 +0000 (10:02 +0900)]
sbin/fsck_hammer2: More refactoring

4 years agosbin/fsck_hammer2: Refactor zone/blockref scanning
Tomohiro Kusumi [Sat, 5 Oct 2019 21:52:39 +0000 (06:52 +0900)]
sbin/fsck_hammer2: Refactor zone/blockref scanning

Refactor duplicated code from zone/blockref scanning with support
for multiple options.

4 years agosbin/fsck_hammer2: Add -b to only scan best zone
Tomohiro Kusumi [Sat, 5 Oct 2019 21:20:39 +0000 (06:20 +0900)]
sbin/fsck_hammer2: Add -b to only scan best zone

4 years agolibc: Add __errno_location() for language binding benefits.
zrj [Sat, 5 Oct 2019 10:04:12 +0000 (13:04 +0300)]
libc: Add __errno_location() for language binding benefits.

 Some languages have restrictions when it comes to C style TLS handling
 (thread local might be feature-gated) or simply it is inconvenient to
 add various OS specific binding wrappers just to access C errno values.

 The __errno_location() symbol provides externally callable version of
 __error() inline function.

 While there, add __WANT_NO_INLINED___ERROR guard for few python parsers
 in DPorts that are unable to parse inlined __error() code yet.

4 years agoppp(8): Re-enable RADIUS support.
zrj [Sat, 5 Oct 2019 10:00:16 +0000 (13:00 +0300)]
ppp(8): Re-enable RADIUS support.

 Until it is really decided to remove it from ppp(8).

 While there, add patches from DPorts to use newer
 LibreSSL/OpenSSL v1.1.x API.

4 years agoBump __DragonFly_version for libradius/libtacplus removal.
zrj [Sat, 5 Oct 2019 09:57:50 +0000 (12:57 +0300)]
Bump __DragonFly_version for libradius/libtacplus removal.

 While there, add entry to UPDATING.

4 years agoNuke libradius(3).
zrj [Sat, 5 Oct 2019 09:55:44 +0000 (12:55 +0300)]
Nuke libradius(3).

 It was moved to DPorts.

 For now keep radlib.c code directly in ppp(8). Other BSDs have it atm.

4 years agoppp(8): Disable RADIUS support.
zrj [Sat, 5 Oct 2019 09:54:45 +0000 (12:54 +0300)]
ppp(8): Disable RADIUS support.

 If there are still users making use of RADIUS support in ppp(8),
 then it could be added back directly into ppp(8).

 Add __unused for few arguments to pet WARNS in case of -DNORADIUS.

4 years agoNuke libtacplus(3).
zrj [Sat, 5 Oct 2019 09:54:16 +0000 (12:54 +0300)]
Nuke libtacplus(3).

 It was moved to DPorts.

4 years agoNuke pam_radius(8).
zrj [Sat, 5 Oct 2019 09:53:32 +0000 (12:53 +0300)]
Nuke pam_radius(8).

 It was moved to DPorts.

 While there, remove deps from MINUSPAM (including last dep on crypto).

4 years agoNuke pam_tacplus(8).
zrj [Sat, 5 Oct 2019 09:52:46 +0000 (12:52 +0300)]
Nuke pam_tacplus(8).

 It was moved to DPorts.

 While there, remove deps from MINUSPAM.

4 years agolib: Update dependencies.
zrj [Sat, 5 Oct 2019 09:51:55 +0000 (12:51 +0300)]
lib: Update dependencies.

 No libraries depend on libprivate_ssh, it can be built with rest.
 We could remove libprivate_ssh.so as and link with static version as it
 is done in upstream version, but for now save few bytes.

 While there, remove LIBSSH from MINUSPAM list.

4 years agoNuke pam_ssh(8). It was moved to DPorts.
zrj [Sat, 5 Oct 2019 09:51:26 +0000 (12:51 +0300)]
Nuke pam_ssh(8). It was moved to DPorts.

 Having it as security/pam_ssh solves several issues when using multiple
 LibreSSL/OpenSSL versions. Also this module poses a security risk for
 unsuspecting system admins, because users might create private ssh keys
 using very weak passphrases.

4 years agosys/vfs/msdosfs: Fix panic on corrupted fs in pcbmap()
Tomohiro Kusumi [Sat, 5 Oct 2019 19:44:56 +0000 (04:44 +0900)]
sys/vfs/msdosfs: Fix panic on corrupted fs in pcbmap()

from freebsd/freebsd@1d085394336dc06a0fd195ff4225080701b6fa5f

4 years agosys/vfs/msdosfs: Invalid filesystem might brelse(bp) with NULL
Tomohiro Kusumi [Sat, 5 Oct 2019 19:24:22 +0000 (04:24 +0900)]
sys/vfs/msdosfs: Invalid filesystem might brelse(bp) with NULL

from freebsd/freebsd@3dd6e87cb09dc334c97ca50dd65e567cfe453006

4 years agosys/vfs/msdosfs: Change the return on impossible condition into KASSERT()
Tomohiro Kusumi [Sat, 5 Oct 2019 19:01:33 +0000 (04:01 +0900)]
sys/vfs/msdosfs: Change the return on impossible condition into KASSERT()

from freebsd/freebsd@cc5d11fa86957084473b9eebf17dcdd1f3e7633d

Don't apply vnode lock assertion part yet.

4 years agosys/vfs/msdosfs: Ensure cluster allocation is within volume limits
Tomohiro Kusumi [Sat, 5 Oct 2019 18:07:41 +0000 (03:07 +0900)]
sys/vfs/msdosfs: Ensure cluster allocation is within volume limits

from freebsd/freebsd@097a1d5fbb7990980f8f806c6878537c964adf32

4 years agosys/vfs/msdosfs: Style
Tomohiro Kusumi [Sat, 5 Oct 2019 17:45:43 +0000 (02:45 +0900)]
sys/vfs/msdosfs: Style

from freebsd/freebsd@7721974753e2594dfeba7b2d625f7ea681c82a9b

4 years agosys/vfs/msdosfs: Verify BPB_Media value in FAT[0] in fillinusemap()
Tomohiro Kusumi [Sat, 5 Oct 2019 17:37:07 +0000 (02:37 +0900)]
sys/vfs/msdosfs: Verify BPB_Media value in FAT[0] in fillinusemap()

from freebsd/freebsd@18480c36c8d3d1f6b8996ceebd5b9c7d5daa9273

4 years agosys/vfs/msdosfs: Properly update ClnShutBitMask in FAT[1] in updatefats()
Tomohiro Kusumi [Sat, 5 Oct 2019 16:51:59 +0000 (01:51 +0900)]
sys/vfs/msdosfs: Properly update ClnShutBitMask in FAT[1] in updatefats()

from freebsd/freebsd@35907051bb7af5a3d9532671d959a88be064bce7

4 years agosys/vfs/msdosfs: Clear cluster bitmap on chainalloc() failure
Tomohiro Kusumi [Sat, 5 Oct 2019 15:56:15 +0000 (00:56 +0900)]
sys/vfs/msdosfs: Clear cluster bitmap on chainalloc() failure

from freebsd/freebsd@65a0ccdfc80cbc095717bdbc98bd3d061d9885ef

4 years agosys/vfs/msdosfs: Add clusteralloc1()
Tomohiro Kusumi [Sat, 5 Oct 2019 15:41:44 +0000 (00:41 +0900)]
sys/vfs/msdosfs: Add clusteralloc1()

bits from freebsd/freebsd@eb2b3c8672da21da1d5b72a0b44f0e8c3271cc1e
"Use pm_fatlock to protect fat bitmap."

Reduce diff against FreeBSD.

MP lock part is ignored.
sys/vfs/msdosfs isn't MPSAFE'd yet.

4 years agosys/vfs/msdosfs: ANSIfy sys/fs/msdosfs
Tomohiro Kusumi [Sat, 5 Oct 2019 15:22:04 +0000 (00:22 +0900)]
sys/vfs/msdosfs: ANSIfy sys/fs/msdosfs

bits from freebsd/freebsd@9d6a34744f8b822b0ba909b701876a2dd8f9c987

4 years agosys/vfs/msdosfs: Use struct dirent
Tomohiro Kusumi [Fri, 4 Oct 2019 16:36:39 +0000 (01:36 +0900)]
sys/vfs/msdosfs: Use struct dirent

Fix/sync the code diverged by DragonFly commits from around 2009
with FreeBSD.

Keep mbnambuf_flush() call in VOP_REDDIR() the same for now using
compat version. FreeBSD has other fixes here from recent years.

4 years agosys/vfs/msdosfs: Remove diff noises vs FreeBSD from iconv support
Tomohiro Kusumi [Fri, 4 Oct 2019 15:35:55 +0000 (00:35 +0900)]
sys/vfs/msdosfs: Remove diff noises vs FreeBSD from iconv support

commits in 2009 or so.

4 years agosys/vfs/msdosfs: Long names of files are created incorrectly
Tomohiro Kusumi [Fri, 4 Oct 2019 15:21:49 +0000 (00:21 +0900)]
sys/vfs/msdosfs: Long names of files are created incorrectly

from freebsd/freebsd@1ac70fc5481e16dc0207e50e5d6ec4336cc00162

4 years agosys/vfs/msdosfs: Prevent buffer overflow when expanding win95 names
Tomohiro Kusumi [Fri, 4 Oct 2019 15:10:12 +0000 (00:10 +0900)]
sys/vfs/msdosfs: Prevent buffer overflow when expanding win95 names

from freebsd/freebsd@b91af2a23dcf0bf7ce2d13ab11bd3c5256d02745

4 years agosys/vfs/msdosfs: Use __DECONST()
Tomohiro Kusumi [Thu, 3 Oct 2019 23:20:07 +0000 (08:20 +0900)]
sys/vfs/msdosfs: Use __DECONST()

from freebsd/freebsd@07f28f1df7815f81403f5d937040fa604d8b915c

4 years agosys/vfs/msdosfs: Discarding local array based on return values
Tomohiro Kusumi [Fri, 4 Oct 2019 00:44:47 +0000 (09:44 +0900)]
sys/vfs/msdosfs: Discarding local array based on return values

from freebsd/freebsd@e043036a251d22e3cb85c0db5bd28c8ee58cbd24

4 years agosys/vfs/msdosfs: Fixes for undefined behavior
Tomohiro Kusumi [Thu, 3 Oct 2019 20:53:47 +0000 (05:53 +0900)]
sys/vfs/msdosfs: Fixes for undefined behavior

freebsd/freebsd@c0db7289c3de290d821311942d5533f2284af77f

These were found by the Undefined Behaviour GsoC project at NetBSD.

4 years agosys/vfs/msdosfs: Avoid excessive flushing of FSInfo hints in updatefats()
Tomohiro Kusumi [Thu, 3 Oct 2019 17:07:59 +0000 (02:07 +0900)]
sys/vfs/msdosfs: Avoid excessive flushing of FSInfo hints in updatefats()

freebsd/freebsd@5cdc06872e1ac2b6529e1182078d48fa6fe57ff0
freebsd/freebsd@e5238fcb15d4fbacf835cb112ac49dcb28ff894d

4 years agosys/vfs/msdosfs: Use FSInfo instead of random# on cluster allocation
Tomohiro Kusumi [Thu, 3 Oct 2019 15:12:03 +0000 (00:12 +0900)]
sys/vfs/msdosfs: Use FSInfo instead of random# on cluster allocation

freebsd/freebsd@fb1dc96e7297ef975bb8867201aa88d1a1d7f379

Provides *huge* performance improvement, that FAT is finally
usable on DragonFly.

4 years agosys/vfs/msdosfs: Add FULL_RUN for (u_int)-1
Tomohiro Kusumi [Wed, 2 Oct 2019 22:57:44 +0000 (07:57 +0900)]
sys/vfs/msdosfs: Add FULL_RUN for (u_int)-1

freebsd/freebsd@1e5991e49446d3096b0c8d3e0a184180ad5c3dff

4 years agosbin/fsck_hammer2: Test icrc_volheader in verify_volume_header()
Tomohiro Kusumi [Wed, 2 Oct 2019 22:09:49 +0000 (07:09 +0900)]
sbin/fsck_hammer2: Test icrc_volheader in verify_volume_header()

icrc_volheader is untested on mount time, but sbin/hammer2 "volhdr"
does test this.

4 years agosys/vfs/msdosfs: Fix loading msdos_iconv.ko
Tomohiro Kusumi [Wed, 2 Oct 2019 19:50:58 +0000 (04:50 +0900)]
sys/vfs/msdosfs: Fix loading msdos_iconv.ko

Temporary fix.
Will eventually be fully synced with FreeBSD.

4 years agosys/vfs/msdosfs: Fix build break on LINT64 by 411df81600
Tomohiro Kusumi [Wed, 2 Oct 2019 19:17:17 +0000 (04:17 +0900)]
sys/vfs/msdosfs: Fix build break on LINT64 by 411df81600

4 years agokernel - Fix lockfz wait state
Matthew Dillon [Wed, 2 Oct 2019 16:43:22 +0000 (09:43 -0700)]
kernel - Fix lockfz wait state

* Fix a bug in the lockf code which could degenerate into
  a situation where it tsleep()'s uninterruptibly and
  ignores signals, making it impossible to kill the related
  process.

* Fixes issues when trying to kill postfix's smtpd daemons.

4 years agosbin/fsck_hammer2: Refactor verify_blockref()
Tomohiro Kusumi [Wed, 2 Oct 2019 16:50:56 +0000 (01:50 +0900)]
sbin/fsck_hammer2: Refactor verify_blockref()

Not interested in blockref with no data once counter is incremented,
so just return if !bytes.

4 years agosbin/fsck_hammer2: Print blockref stats once if -q
Tomohiro Kusumi [Wed, 2 Oct 2019 16:50:25 +0000 (01:50 +0900)]
sbin/fsck_hammer2: Print blockref stats once if -q

Better with this when redirecting output.

4 years agosbin/fsck_hammer2: Fix return value on -f
Tomohiro Kusumi [Wed, 2 Oct 2019 16:49:54 +0000 (01:49 +0900)]
sbin/fsck_hammer2: Fix return value on -f

4 years agosbin/fsck_hammer2: Add -p and -l option for per PFS scan
Tomohiro Kusumi [Tue, 1 Oct 2019 21:48:40 +0000 (06:48 +0900)]
sbin/fsck_hammer2: Add -p and -l option for per PFS scan

4 years agosbin/hammer2: Use old "show"/"freemap" format for -q
Tomohiro Kusumi [Tue, 1 Oct 2019 23:23:57 +0000 (08:23 +0900)]
sbin/hammer2: Use old "show"/"freemap" format for -q

which existed until aa2131f062.

The original format had better readability and grep-ability for
-q where only blockref itself was printed without referenced data.
A single line format works out better for this.

4 years agosbin/hammer2: Assert bytes > 0 for inode/indirect in "show"/"freemap"
Tomohiro Kusumi [Tue, 1 Oct 2019 22:50:37 +0000 (07:50 +0900)]
sbin/hammer2: Assert bytes > 0 for inode/indirect in "show"/"freemap"

`bytes` must not be 0 for blockref types which refer to data.

4 years agosys/vfs/msdosfs: Assert mount is not read-only when FAT modifications requested
Tomohiro Kusumi [Wed, 2 Oct 2019 16:05:19 +0000 (01:05 +0900)]
sys/vfs/msdosfs: Assert mount is not read-only when FAT modifications requested

freebsd/freebsd@95e51995786685d7cceb893fae4a6c359ce7aee9

4 years agosys/vfs/msdosfs: Add assertions for FAT bitmap state
Tomohiro Kusumi [Wed, 2 Oct 2019 16:04:40 +0000 (01:04 +0900)]
sys/vfs/msdosfs: Add assertions for FAT bitmap state

freebsd/freebsd@452113665587ed27ad543c49c84d142ef8bd5481

4 years agosys/vfs/msdosfs: Remove unused global statistic about fat cache usage
Tomohiro Kusumi [Wed, 2 Oct 2019 15:14:03 +0000 (00:14 +0900)]
sys/vfs/msdosfs: Remove unused global statistic about fat cache usage

freebsd/freebsd@9be56bb3cbf4a01715415777c05d15ed42ba4c63

4 years agosys/vfs/msdosfs: Remove unused find_lcode()
Tomohiro Kusumi [Wed, 2 Oct 2019 15:02:05 +0000 (00:02 +0900)]
sys/vfs/msdosfs: Remove unused find_lcode()

4 years agosys/vfs/msdosfs: Mount msdosfs with longnames support by default
Tomohiro Kusumi [Tue, 1 Oct 2019 18:27:35 +0000 (03:27 +0900)]
sys/vfs/msdosfs: Mount msdosfs with longnames support by default

The old behavior depended on the FAT version and on what files were in the
root directory. "mount_msdosfs -o shortnames" is still supported.

(If any *real* user issue with this, we could consider reverting this.)

freebsd/freebsd@ca02d20de1b306a2e855e41dda6a9087a04b841a

4 years agosys/vfs/msdosfs: Fix wrong memcpy(3) usage
Tomohiro Kusumi [Tue, 1 Oct 2019 16:54:44 +0000 (01:54 +0900)]
sys/vfs/msdosfs: Fix wrong memcpy(3) usage

* Fix 65c1174772fa185d24d1d0978367da3f4b6582f3.

* Pick up missing memset(3) conversion from
  freebsd/freebsd@304b0a16bbe84af211b6bd820b44b90ed9405012.

4 years agosys/vfs/msdosfs: Extend fatcache size for extend write performance
Tomohiro Kusumi [Tue, 1 Oct 2019 15:57:48 +0000 (00:57 +0900)]
sys/vfs/msdosfs: Extend fatcache size for extend write performance

freebsd/freebsd@317819a5f62502c2daad8b2f578f62e1cd7f4017
freebsd/freebsd@9d167f82e426b3c6481ebd3bcdba5afbae063a7d

4 years agosys/vfs/hammer2: Use correct typedef for uint64_t for inode#
Tomohiro Kusumi [Tue, 1 Oct 2019 15:06:07 +0000 (00:06 +0900)]
sys/vfs/hammer2: Use correct typedef for uint64_t for inode#

4 years agoFix two comments (in trek and the installer): whereever -> wherever.
Sascha Wildner [Tue, 1 Oct 2019 09:39:58 +0000 (11:39 +0200)]
Fix two comments (in trek and the installer): whereever -> wherever.

4 years agohammer2.8: Fix some mdoc and other issues.
Sascha Wildner [Tue, 1 Oct 2019 09:00:47 +0000 (11:00 +0200)]
hammer2.8: Fix some mdoc and other issues.

* Remove an unneeded .Pp.

* Use a numbered list instead of rolling our own numbers.

* Use .Er for an errno.

* Start sentences on a new line.

* Capitalize UUID and CPU.

4 years agosys/vfs/msdosfs: msdos_iconv -> msdosfs_iconv (minimize diff noises)
Tomohiro Kusumi [Mon, 30 Sep 2019 15:10:05 +0000 (00:10 +0900)]
sys/vfs/msdosfs: msdos_iconv -> msdosfs_iconv (minimize diff noises)

and also fix/sync some typos/etc with FreeBSD.

4 years agosbin/hammer2: Use hammer2_uuid_to_str()
Tomohiro Kusumi [Sun, 29 Sep 2019 18:18:36 +0000 (03:18 +0900)]
sbin/hammer2: Use hammer2_uuid_to_str()

4 years agosbin/hammer2: Align usage output for "emergency-mode-disable"
Tomohiro Kusumi [Sun, 29 Sep 2019 18:15:46 +0000 (03:15 +0900)]
sbin/hammer2: Align usage output for "emergency-mode-disable"

4 years agohammer2 - Add emergency mode to allow recovery of ENOSPC edge cases
Matthew Dillon [Sun, 29 Sep 2019 18:06:08 +0000 (11:06 -0700)]
hammer2 - Add emergency mode to allow recovery of ENOSPC edge cases

* Because HAMMER2 is a copy-on-write filesystem, even 'rm' operations
  require block allocations.  H2 gives 'rm' operations extra reserve
  but it is still relatively easy to get into a situation where the
  normal copy-on-write allocation fails and the filesystem gets stuck
  in a ENOSPC situation that cannot be recovered from under normal
  operation.

  We add two directives, 'emergency-mode-enable' and
  'emergency-mode-disable' as a fail-safe to allow recovery of
  filesystems that have gotten into this situation.

* When this mode is enabled HAMMER2 will still attempt to use a
  copy-on-write operation for any blocks that might have been
  snapshotted.  However, any blocks which have not been snapshotted
  (or if the copy-on-write fails) will now be modified in-place,
  allowing chflags and rm operations to be run even when the filesystem
  is over-full.

  Such operation is fragile because the tree cannot be updated safely,
  so this mode can permanently destroy the filesystem if power is lost
  or a panic occurs during the file removal or chflags/chmod operations.
  Great care must be taken when using this mode.

  In addition, use of this mode will likely corrupt any snapshots sharing
  the same meta-data.  If you use this mode and have snapshots it is
  recommended that the snapshots be deleted.

* If you have to use this mode, be sure to disable it after the
  filesystem is operational again.

* The bulkfree scan now reports which PFS(es) a CRC failure occurs on.
  Bulkfree will attempt to alert the user as to which snapshots are
  corrupt, but it isn't perfect.

4 years agosbin/hammer2: Add sbin/hammer2/hammer2_subs.h
Tomohiro Kusumi [Sun, 29 Sep 2019 16:14:41 +0000 (01:14 +0900)]
sbin/hammer2: Add sbin/hammer2/hammer2_subs.h

Separate a header for subs.c from <hammer2.h>.

This lets other HAMMER2 binaries drop unneeded dependencies
required to use sbin/hammer2/subs.c (various unneeded OpenSSL
header includes via <dmsg.h> via <hammer2.h>, global variables
via <hammer2.h>).

This doesn't affect existing files which include <hammer2.h>.

4 years agokprintf.9: Adjust for return value of krateprintf().
Sascha Wildner [Sun, 29 Sep 2019 08:02:26 +0000 (10:02 +0200)]
kprintf.9: Adjust for return value of krateprintf().

4 years agokernel - Enhance krateprintf() API
Matthew Dillon [Sun, 29 Sep 2019 04:30:47 +0000 (21:30 -0700)]
kernel - Enhance krateprintf() API

* Have krateprintf() return a boolean, 0 if it did not
  print anything, 1 if it did, allowing code to issue follow-up
  kprintf()s if desired.

4 years agohammer2 - Fix pfs-delete panic
Matthew Dillon [Sun, 29 Sep 2019 01:12:02 +0000 (18:12 -0700)]
hammer2 - Fix pfs-delete panic

* Do not try to scan pmp->xop_groups if it is NULL.

4 years agoinstallworld - Generate /etc/os-release
Matthew Dillon [Sat, 28 Sep 2019 21:10:01 +0000 (14:10 -0700)]
installworld - Generate /etc/os-release

* Generate an /etc/os-release file during an installworld.

4 years agohammer2 - Optimize hammer2 support threads and dispatch
Matthew Dillon [Sat, 28 Sep 2019 21:03:06 +0000 (14:03 -0700)]
hammer2 - Optimize hammer2 support threads and dispatch

* Refactor the XOP groups in order to be able to queue strategy
  calls, whenever possible, to the same CPU as the issuer.  This
  optimizes several cases and reduces unnecessary IPI traffic between
  cores.  The next best thing to do would be to not queue certain XOPs
  to an H2 support thread at all, but I would like to keep the threads
  intact for later clustering work.

  The best scaling case for this is when one has a large number of user
  threads doing I/O.  One instance of a single-threaded program on
  an otherwise idle machine might see a slightly reduction in performance
  but at the same time we completely avoid unnecessarily spamming all
  cores in the system on the behalf of a single program, so overhead is
  also significantly lower.

* This will tend to increase the number of H2 support threads since
  we need a certain degree of multiplication for domain separation.

* This should significantly increase I/O performance for multi-threaded
  workloads.

4 years agosbin/hammer2: Minor adjustments for "volhdr"
Tomohiro Kusumi [Sat, 28 Sep 2019 21:01:58 +0000 (06:01 +0900)]
sbin/hammer2: Minor adjustments for "volhdr"

* Fix argument name in prototype.
* volhdr is which=2 out of (0,1,2).
* Align volhdr line with other commands.

4 years agosbin/hammer2: Add "volhdr" to man
Tomohiro Kusumi [Sat, 28 Sep 2019 21:01:42 +0000 (06:01 +0900)]
sbin/hammer2: Add "volhdr" to man

4 years agosbin/hammer2: Sync checksum format in "show"/"freemap" with aa2131f062
Tomohiro Kusumi [Sat, 28 Sep 2019 20:20:52 +0000 (05:20 +0900)]
sbin/hammer2: Sync checksum format in "show"/"freemap" with aa2131f062

HAMMER2_CHECK_XXHASH64, HAMMER2_CHECK_SHA192, HAMMER2_CHECK_FREEMAP
were left with old output format, so update those.

4 years agohammer2 - add 'volhdr' directive to dump volume header
Matthew Dillon [Sat, 28 Sep 2019 18:58:40 +0000 (11:58 -0700)]
hammer2 - add 'volhdr' directive to dump volume header

* Add the 'volhdr' directive to dump the volume header.

* Correct a bug in 'show' and 'freemap' where it was always dumping
  the last volume header and not the best volume header.

* Reformat the output a bit to make it neater.

4 years agolib/libdmsg: Use libkern instead of lib/libdmsg/icrc.c
Tomohiro Kusumi [Fri, 27 Sep 2019 19:16:49 +0000 (04:16 +0900)]
lib/libdmsg: Use libkern instead of lib/libdmsg/icrc.c

Remove yet another copy of icrc file in lib/libdmsg, with only
difference in function names which start with dmsg_ prefix.

4 years agoshare/mk: Install bsd.crunchgen.mk
Antonio Huete Jimenez [Fri, 27 Sep 2019 22:37:51 +0000 (00:37 +0200)]
share/mk: Install bsd.crunchgen.mk

- Allows using the functionality it provides from outside the source tree.

4 years agorc: Rename jail's rc default variables
Antonio Huete Jimenez [Fri, 27 Sep 2019 22:27:21 +0000 (00:27 +0200)]
rc: Rename jail's rc default variables

- Also add the remaining sysctls that were not handled. Here's
  the current list:

      jail_default_set_hostname_allow       (default: enabled)
      jail_default_socket_unixiproute_only  (default: enabled)
      jail_default_sysvipc_allow            (default: disabled)
      jail_default_chflags_allow            (default: disabled)
      jail_default_raw_sockets_allow        (default: disabled)

- You can override the default by editing rc.conf(5) as usual, please
  make sure you adjust these variables if you're using them.

4 years agodsynth - Allow the package suffix to be configured
Matthew Dillon [Fri, 27 Sep 2019 19:28:15 +0000 (12:28 -0700)]
dsynth - Allow the package suffix to be configured

* Add support for a 'Package_suffix' configuration variable in
  dsynth.ini.  This may be set to any of:

  .tar
  .tgz
  .txz
  .tbz

* By default .txz is used for maximum compression, at the cost of
  longer bulk build times due to decompression overhead, the same
  as synth.

  For faster bulk builds we recommend using .tgz.  This will
  significant increase the size of the repo since the compression is
  not as good.

4 years agodsynth - Dump final summary to the 00 log as well
Matthew Dillon [Fri, 27 Sep 2019 19:15:02 +0000 (12:15 -0700)]
dsynth - Dump final summary to the 00 log as well

* Dump the final summary the 00 log in addition to stdout.

* Ensure that the monitor picks up the final log lines before
  exiting.

4 years agoSome cleanup regarding the removal of the old clang 3.8 framework.
Sascha Wildner [Fri, 27 Sep 2019 11:16:40 +0000 (13:16 +0200)]
Some cleanup regarding the removal of the old clang 3.8 framework.

Forgotten in 9f47dde1b3a468c6ec0f5593a50c214b95f51ebc.

4 years agodsynth - add 'dsynth monitor' directive
Matthew Dillon [Thu, 26 Sep 2019 21:10:54 +0000 (14:10 -0700)]
dsynth - add 'dsynth monitor' directive

* Create a statistics monitoring file in LOGS/stats/monitor.dat and a
  lock file in LOGS/stats/monitor.lk that can be used to test whether
  dsynth is running or not.

* Add 'dsynth monitor', a front-end which monitors a dsynth already
  running in the background.  Any number of monitors can be in
  operation and killing the monitor has no effect on the running dsynth.

  If no additional argument is given the directive locates the
  monitor.dat file via the configuration (LOGS/stats/monitor.dat).

  You may specify a specific monitor.dat file if desired but note
  that if you do so logs will not be available and the monitor will
  also not be able to detect if dsynth is not running or when dsynth
  exits.

* Reorganize a few things so we can use the ncurses code for both
  the ncurses display feature and the monitor feature.

* Compartmentalize the log line reading code.

4 years agonmalloc(3): Add missing #include "namespace.h" and adjust.
Sascha Wildner [Thu, 26 Sep 2019 18:43:44 +0000 (20:43 +0200)]
nmalloc(3): Add missing #include "namespace.h" and adjust.

4 years agofsck_msdosfs(8): Add missing free()s.
Sascha Wildner [Thu, 26 Sep 2019 18:17:32 +0000 (20:17 +0200)]
fsck_msdosfs(8): Add missing free()s.

4 years agosort(1): Remove duplicate option check.
Sascha Wildner [Thu, 26 Sep 2019 18:16:12 +0000 (20:16 +0200)]
sort(1): Remove duplicate option check.

4 years agodsynth - Check template change / worker count change
Matthew Dillon [Thu, 26 Sep 2019 16:06:07 +0000 (09:06 -0700)]
dsynth - Check template change / worker count change

* Be more robust when creating the template, detect
  if the worker count has changed or if a new world
  has been installed in the system base, and check
  $/bin/ls in all template copies instead of just one.

* The source of the "x\n" in the logs has been identified
  but not yet fixed.  Its due to the master/slave handshake.
  Master pty echo causes it to also get logged.

4 years agosys/vfs/msdosfs: Reduce size of struct defid
Tomohiro Kusumi [Thu, 26 Sep 2019 21:11:56 +0000 (06:11 +0900)]
sys/vfs/msdosfs: Reduce size of struct defid

freebsd/freebsd@149e5a04f74fb1cfc857fa0f9ef9b70cd86520f5

4 years agosys/vfs/msdosfs: Whitespace fixes (minimize diff noises against FreeBSD)
Tomohiro Kusumi [Thu, 26 Sep 2019 20:55:17 +0000 (05:55 +0900)]
sys/vfs/msdosfs: Whitespace fixes (minimize diff noises against FreeBSD)

4 years agoSync zoneinfo database with tzdata2019c from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Thu, 26 Sep 2019 09:19:12 +0000 (11:19 +0200)]
Sync zoneinfo database with tzdata2019c from ftp://ftp.iana.org/tz/releases

* Fiji observes DST from 2019-11-10 to 2020-01-12.

* Norfolk Island starts observing Australian-style DST.

* Many corrections to time in Turkey from 1940 through 1985.
    (Thanks to Oya Vulaş via Alois Treindl, and to Kıvanç Yazan.)

* The Norfolk Island 1975-03-02 transition was at 02:00 standard
    time, not 02:00 DST.  (Thanks to Michael Deckers.)

* South Korea observed DST from 1948 through 1951.  Although this
    info was supposed to appear in release 2014j, a typo inadvertently
    suppressed the change.  (Thanks to Alois Treindl.)

* Detroit observed DST in 1967 and 1968 following the US DST rules,
    except that its 1967 DST began on June 14 at 00:01.  (Thanks to
    Alois Treindl for pointing out that the old data entries were
    probably wrong.)

* Fix several errors in pre-1970 transitions in Perry County, IN.
    (Thanks to Alois Triendl for pointing out the 1967/9 errors.)

* Edmonton did not observe DST in 1967 or 1969.  In 1946 Vancouver
    ended DST on 09-29 not 10-13, and Vienna ended DST on 10-07 not
    10-06.  In 1945 Königsberg (now Kaliningrad) switched from +01/+02
    to +02/+03 on 04-10 not 01-01, and its +02/+03 is abbreviated
    EET/EEST, not CET/CEST.  (Thanks to Alois Triendl.)  In 1946
    Königsberg switched to +03 on 04-07 not 01-01.

* In 1946 Louisville switched from CST to CDT on 04-28 at 00:01, not
    01-01 at 00:00.  (Thanks to Alois Treindl and Michael Deckers.)
    Also, it switched from CST to CDT on 1950-04-30, not 1947-04-27.

* The 1892-05-01 transition in Brussels was at 00:17:30, not at noon.
    (Thanks to Michael Deckers.)

* Hong Kong Winter Time, observed from 1941-10-01 to 1941-12-25,
    is now flagged as DST and is abbreviated HKWT not HKT.

For a detailed list of changes, see share/zoneinfo/NEWS.

4 years agoRemove Theory. Available via https://data.iana.org/time-zones/theory.html
Sascha Wildner [Thu, 26 Sep 2019 09:16:01 +0000 (11:16 +0200)]
Remove Theory. Available via https://data.iana.org/time-zones/theory.html

4 years agodsynth(1): Some minor fixes / cleanup.
Sascha Wildner [Thu, 26 Sep 2019 07:03:34 +0000 (09:03 +0200)]
dsynth(1): Some minor fixes / cleanup.

* Remove a duplicate return.

* Remove an "if (force)" within an "if (force)".

4 years agodsynth(1): Change script perms to 644. install(1) handles final ones.
Sascha Wildner [Thu, 26 Sep 2019 06:41:46 +0000 (08:41 +0200)]
dsynth(1): Change script perms to 644. install(1) handles final ones.

4 years agousr.sbin/autofs: Change autounmountd(8) to use time_t for duration instead of double
Tomohiro Kusumi [Thu, 26 Sep 2019 11:50:01 +0000 (20:50 +0900)]
usr.sbin/autofs: Change autounmountd(8) to use time_t for duration instead of double

freebsd/freebsd@d1115235daf2a6a2f3bcdb3c840722fbc548d2ee

4 years agousr.sbin/autofs: Fix segfault that could occur on "automount -LL"
Tomohiro Kusumi [Thu, 26 Sep 2019 11:33:22 +0000 (20:33 +0900)]
usr.sbin/autofs: Fix segfault that could occur on "automount -LL"

freebsd/freebsd@6481c0f9038450666abe90d235d2a8454b12a7cb

4 years agousr.sbin/autofs: Add DOLLAR
Tomohiro Kusumi [Thu, 26 Sep 2019 11:30:09 +0000 (20:30 +0900)]
usr.sbin/autofs: Add DOLLAR

freebsd/freebsd@abc2058c6033886873a3c02254eb3e9cb8d4e489

4 years ago<sys/time.h>: Add 3rd arg to timespecadd()/sub() and make them public.
Sascha Wildner [Wed, 25 Sep 2019 17:40:52 +0000 (19:40 +0200)]
<sys/time.h>: Add 3rd arg to timespecadd()/sub() and make them public.

* Switch to the three argument versions of the timespecadd() and
  timespecsub() macros. These are now the predominant ones. FreeBSD,
  OpenBSD, NetBSD, and Solaris (albeit only for the kernel) have them.

* Make those macros public too. This allows for a number of cleanups
  where they were defined locally.

Pointed-out-by: zrj
Reviewed-by: dillon
4 years agosys/vfs/msdosfs: Use timespec2fattime()/fattime2timespec()
Tomohiro Kusumi [Wed, 25 Sep 2019 16:35:08 +0000 (01:35 +0900)]
sys/vfs/msdosfs: Use timespec2fattime()/fattime2timespec()

freebsd/freebsd@abedeeee558af25b4abd739c4dbe7cf90e743857

4 years agosys/kern: Bring in timespec2fattime()/fattime2timespec() from FreeBSD
Tomohiro Kusumi [Wed, 25 Sep 2019 16:20:18 +0000 (01:20 +0900)]
sys/kern: Bring in timespec2fattime()/fattime2timespec() from FreeBSD

freebsd/freebsd@e74f0ab1401b205bfe9ee22d26d1800157598185
freebsd/freebsd@cc74fcabb418a714919dc9abc75e57e47b0a058c
says

"""
    Add two new functions to convert FAT filesystem format timestamps
    to and from struct timespec, to replace the crummy conversion
    function which have been copy&pasted into three different
    filesystems already.

    Apart from general crummyness as indicated by code like:

            for (year = 1970;; year++) {
                    inc = year & 0x03 ? 365 : 366;
                    if (days < inc)
                            break;
                    days -= inc;
            }

    They also contain specialized crummyness which tries to compensate
    for the general crummyness by caching recent conversion results,
    with no regard for locking or consistency.

    These replacement functions are smaller, O(1) and handle the Y2.1K
    leap-year correctly.

    Ideally, these functions should live in a module of their own,
    which the three offending filesystems would depend on, but the
    size is 877 bytes of code (on i386), so that would be false
    economy.
"""

Note that utc argument is ignored in DragonFly (unused by FAT).

4 years agosys/vfs/msdosfs: b*() -> mem*() (sync with FreeBSD mostly)
Tomohiro Kusumi [Tue, 24 Sep 2019 18:03:48 +0000 (03:03 +0900)]
sys/vfs/msdosfs: b*() -> mem*() (sync with FreeBSD mostly)