dragonfly.git
3 years agoUpgrade vi(1). 1/2
Daniel Fojt [Wed, 9 Sep 2020 06:36:13 +0000 (08:36 +0200)]
Upgrade vi(1). 1/2

Merge branch 'vendor/NVI2' into master.

3 years agovendor/nvi2: upgrade from 2.1.3 to 2.2.0 vendor/NVI2
Daniel Fojt [Mon, 7 Sep 2020 17:33:17 +0000 (19:33 +0200)]
vendor/nvi2: upgrade from 2.1.3 to 2.2.0

Digest of notable changes from git commit messages:

- fix incompatible behaviour of T
- remove a needless NULL-checks before free()
- fix backward sentence deletion
- fix a few memory leaks and a double free
- prevent erroneous COLUMNS/LINES settings
- add Vim-style expandtab option
- align unprintable chars correctly

For complete "git log" see:

https://github.com/lichray/nvi2/commits/master

3 years agosys/vfs/hammer2: Add () around HAMMER2_XOPMASK_* macros
Tomohiro Kusumi [Tue, 8 Sep 2020 16:04:51 +0000 (01:04 +0900)]
sys/vfs/hammer2: Add () around HAMMER2_XOPMASK_* macros

3 years agosys/vfs/hammer2: Change hammer2_bref_type_str() to take btype
Tomohiro Kusumi [Tue, 8 Sep 2020 15:44:04 +0000 (00:44 +0900)]
sys/vfs/hammer2: Change hammer2_bref_type_str() to take btype

struct hammer2_blockref isn't the only data structure with blockref type.

3 years agosys/vfs/hammer2: Add hammer2_adjwritecounter()
Tomohiro Kusumi [Tue, 8 Sep 2020 15:27:57 +0000 (00:27 +0900)]
sys/vfs/hammer2: Add hammer2_adjwritecounter()

Separate counters adjustment from HAMMER2 I/O code.

3 years agosys/vfs/hammer2: Ignore HAMMER2_BREF_TYPE_EMPTY in dio_write_stats_update()
Tomohiro Kusumi [Tue, 8 Sep 2020 15:23:53 +0000 (00:23 +0900)]
sys/vfs/hammer2: Ignore HAMMER2_BREF_TYPE_EMPTY in dio_write_stats_update()

Same as 1de4fc15b2011a762e9001a3ad50d1a0e84e544f except this one
already ignored 0 (HAMMER2_BREF_TYPE_EMPTY).

3 years agosys/vfs/hammer2: Make hammer2_iod_inode_* static
Tomohiro Kusumi [Tue, 8 Sep 2020 15:12:05 +0000 (00:12 +0900)]
sys/vfs/hammer2: Make hammer2_iod_inode_* static

3 years agonrelease: Follow-up commit 10d767c30ac91
Antonio Huete Jimenez [Mon, 7 Sep 2020 23:30:44 +0000 (01:30 +0200)]
nrelease: Follow-up commit 10d767c30ac91

  - In our release disk image, create /firstboot so that any
    rc.d script using the KEYWORD firstboot can be run
    exactly once at boot. Since the firstboot code assumes
    a read-write root filesystem, do not add this file to
    our ISO image.

3 years agosys/vfs/hammer2: Implement missing errors in hammer2_err*_to_err*()
Tomohiro Kusumi [Mon, 7 Sep 2020 16:30:11 +0000 (01:30 +0900)]
sys/vfs/hammer2: Implement missing errors in hammer2_err*_to_err*()

Add missing HAMMER2_ERROR_* compatible with errnos.
The existing conversions stay the same.

3 years agosys/vfs/hammer2: Remove unused HAMMER2_LOOKUP_ALLNODES
Tomohiro Kusumi [Sun, 6 Sep 2020 16:13:10 +0000 (01:13 +0900)]
sys/vfs/hammer2: Remove unused HAMMER2_LOOKUP_ALLNODES

No longer used since 01d71aa5538cba09383737ddbea2fb05e1e75e78 in 2015.

3 years agosys/vfs/hammer2: Remove unused HAMMER2_CHAIN_EMBEDDED
Tomohiro Kusumi [Sun, 6 Sep 2020 15:28:40 +0000 (00:28 +0900)]
sys/vfs/hammer2: Remove unused HAMMER2_CHAIN_EMBEDDED

Appeared in 512beabd66d77a7cca8f73bf69030ffa90f0b9e3 in 2013,
but no longer used, only appears in KASSERT.

3 years agosys/vfs/hammer2: Remove unused HAMMER2_CHAIN_FICTITIOUS
Tomohiro Kusumi [Sun, 6 Sep 2020 15:03:15 +0000 (00:03 +0900)]
sys/vfs/hammer2: Remove unused HAMMER2_CHAIN_FICTITIOUS

Appeared in b93cc2e0815ec1ad6d6f8e60cc0becbdee247679 in 2015,
but never used.

3 years agodhcpcd: update README.DRAGONFLY
Roy Marples [Sun, 6 Sep 2020 16:20:31 +0000 (17:20 +0100)]
dhcpcd: update README.DRAGONFLY

3 years agoMerge branch 'vendor/DHCPCD'
Roy Marples [Sun, 6 Sep 2020 16:17:50 +0000 (17:17 +0100)]
Merge branch 'vendor/DHCPCD'

3 years agoUpdate to dhcpcd-9.2.0 with the following changes:
Roy Marples [Sun, 6 Sep 2020 16:15:23 +0000 (17:15 +0100)]
Update to dhcpcd-9.2.0 with the following changes:

 * route: ensure IPv4LL routes come last in priority
 * DHCP: fix many issues with extending the last lease
 * privsep: don't read control group from config in privsep
 * privsep: only the master process responds to signals
 * privsep: use a socketpair for stderr/stdin rather than dupping /dev/null
 * privsep: right limit stdin/stderr/stdout
 * privsep: dumping a lease is now run in a sandbox
 * options: check if kernel supports INET or INET6 before enabling default
 * options: let clientid override a prior duid
 * options: allow -1 to represent infinity for requested lease time
 * dhcpcd: fix a crash initing a new interface after route overflow

3 years agosys/vfs/hammer2: Remove #if0'd function hammer2_allocsize()
Tomohiro Kusumi [Sat, 5 Sep 2020 18:14:17 +0000 (03:14 +0900)]
sys/vfs/hammer2: Remove #if0'd function hammer2_allocsize()

This is obsolete version of hammer2_getradix() which won't be used again.

3 years agosys/vfs/hammer2: Ignore HAMMER2_BREF_TYPE_EMPTY in hammer2_adjreadcounter()
Tomohiro Kusumi [Sat, 5 Sep 2020 18:02:24 +0000 (03:02 +0900)]
sys/vfs/hammer2: Ignore HAMMER2_BREF_TYPE_EMPTY in hammer2_adjreadcounter()

3 years agolibm: Mark some functions hidden (syncs math_private.h with OpenBSD).
Sascha Wildner [Sun, 6 Sep 2020 11:12:08 +0000 (13:12 +0200)]
libm: Mark some functions hidden (syncs math_private.h with OpenBSD).

3 years ago<sys/cdefs.h>: Add __{BEGIN,END}_HIDDEN_DECLS definitions and use them.
Sascha Wildner [Sun, 6 Sep 2020 11:06:37 +0000 (13:06 +0200)]
<sys/cdefs.h>: Add __{BEGIN,END}_HIDDEN_DECLS definitions and use them.

Remove local empty definitions of these macros in some Makefiles.

Thanks to zrj for testing with a full bulk build.

Taken-from: OpenBSD

3 years ago<sys/cdefs.h>: Move __dso_{public,hidden} to the other visibility defs.
Sascha Wildner [Sun, 6 Sep 2020 11:01:17 +0000 (13:01 +0200)]
<sys/cdefs.h>: Move __dso_{public,hidden} to the other visibility defs.

3 years ago<sys/cdefs.h>: Untangle the __{BEGIN,END}_DECLS definitions a bit.
Sascha Wildner [Sun, 6 Sep 2020 10:58:30 +0000 (12:58 +0200)]
<sys/cdefs.h>: Untangle the __{BEGIN,END}_DECLS definitions a bit.

Mainly separate the defined(__cplusplus) and the __GNU_PREREQ__(4, 0)
parts.

3 years agosys/vfs/hammer2: Fix function names in kprintf
Tomohiro Kusumi [Sat, 5 Sep 2020 12:34:07 +0000 (21:34 +0900)]
sys/vfs/hammer2: Fix function names in kprintf

3 years agoworld - Add /usr/projects maintenance to /usr/Makefile.
Matthew Dillon [Fri, 4 Sep 2020 18:18:04 +0000 (11:18 -0700)]
world - Add /usr/projects maintenance to /usr/Makefile.

* Add /usr/projects maintenance to /usr/Makefile.  This allows the
  dragonfly projects repo to be pulled and maintained, if desired.

3 years agocalendar(1): Rewrite to support Chinese & Julian calendars
Aaron LI [Sun, 2 Aug 2020 14:17:59 +0000 (22:17 +0800)]
calendar(1): Rewrite to support Chinese & Julian calendars

I wanted to use Chinese calendar in the calendar(1) utility, so I started
working on it.  The Chinese calendar is a lunisolar calendar and requires
calculations of Sun and Moon positions.  Along the way of implementing the
Chinese calendar support, more and more parts of the old code has been
replaced.  Now, the new calendar(1) code base has been mostly rewritten to
be more extensible to support multiple calendars.  Although only the
Gregorian (the default), Chinese and Julian calendars are currently
supported, more calendars now becomes much easier to add.

Highlights:
* Support Chinese calendar
* Support Julian calendar
* More accurate Sun and Moon calculations
* More extensible
* More calendar files/entries and more accurate information
* Better code base

Major Changes:
* If no user's calendar file, default to '/etc/calendar/default'
* Search calendar files in '/etc/calendar', which allows to override the
  calendar file in '/usr/share/calendar' in a system-wide way
* Add '-s' option to show information of Chinese/Julian calendar or
  Sun/Moon
* Add '-H' option to specify the calendar home directory
* Add '-L' option to specify the location, which should be set to get
  accurate Sun/Moon information
* Add '-T' option to specify the current time for Sun/Moon calculations
* Much Improved calendar file parser
* More clean man page
* More helpful error messages
* Some bug fixes and various cleanups

The new calendar algorithms are implemented by referring to this great
book:
Calendrical Calculations: The Ultimate Edition (4th Edition)
by Edward M. Reingold and Nachum Dershowitz.
Cambridge University Press, 2018.
ISBN: 9781107057623

More information about the development history of this calendar(1) utility
can be found in my GitHub repository:
https://github.com/liweitianux/ccalendar

3 years agoMakefile.usr: Always use pkg-static
Antonio Huete Jimenez [Thu, 3 Sep 2020 23:32:53 +0000 (01:32 +0200)]
Makefile.usr: Always use pkg-static

  - Should help in between LibreSSL upgrades.

3 years agosbin/newfs_hammer2: Fail if no free space left
Tomohiro Kusumi [Thu, 3 Sep 2020 15:17:02 +0000 (00:17 +0900)]
sbin/newfs_hammer2: Fail if no free space left

stat[v]fs shows negative free space if newfs/mount'd with <0 free_space.

3 years agosys/vfs/hammer2: Remove obsolete comments for hammer2_install_volume_header()
Tomohiro Kusumi [Thu, 3 Sep 2020 15:10:06 +0000 (00:10 +0900)]
sys/vfs/hammer2: Remove obsolete comments for hammer2_install_volume_header()

First two are implemented.
bread will fail for a small device with <4 volume headers (4 isn't mandatory).

3 years agokernel: avoid possible use-after-free in ipv6
Daniel Fojt [Thu, 3 Sep 2020 06:59:12 +0000 (08:59 +0200)]
kernel: avoid possible use-after-free in ipv6

Fix improper mbuf handling when processing IPv6 Hop-by-Hop options.

Taken from: FreeBSD (FreeBSD-SA-20:24.ipv6)

3 years agofdisk - Add storage expansion option
Matthew Dillon [Wed, 2 Sep 2020 20:00:56 +0000 (13:00 -0700)]
fdisk - Add storage expansion option

* Add the -x option to fdisk.  This will expand the last valid
  slice for an existing dos label to fit the storage.

  fdisk will refuse to expand an EFI GPT label, use 'gpt expand ...'
  instead.

3 years agogpt, disklabel64 - Add storage expansion options (2)
Matthew Dillon [Wed, 2 Sep 2020 18:51:15 +0000 (11:51 -0700)]
gpt, disklabel64 - Add storage expansion options (2)

* Cleanup debugging printfs and improve messages.

3 years agogpt, disklabel64 - Add storage expansion options
Matthew Dillon [Wed, 2 Sep 2020 18:24:47 +0000 (11:24 -0700)]
gpt, disklabel64 - Add storage expansion options

* Add gpt expand directive.  For example 'gpt expand /dev/da0' will
  expand the gpt to fill /dev/da0.  This allows the gpt to be enlarged
  to fit a new, larger storage device or expanded storage and can be issued
  on a live gpt if desired.

* Add disklabel64 -x and -xx features.  This expands the disklabel to
  fit the new enlarged slice that it resides in.  If -xx is specified,
  the last partition configured in the disklabel will also be enlarged.

* And we already have 'hammer2 growfs <mountpt>' to grow a live hammer2
  filesystem to fit an enlarged partition.

3 years agosys/vfs/hammer2: Remove unused HAMMER2_INODE_RENAME_INPROG
Tomohiro Kusumi [Wed, 2 Sep 2020 16:10:07 +0000 (01:10 +0900)]
sys/vfs/hammer2: Remove unused HAMMER2_INODE_RENAME_INPROG

Appeared in 51bf8e9b90e371ed867e5fd82f8ad6fb74867b22 in 2013,
but never used.

Also fix obsolete comments for inode flags.

3 years agosys/vfs/hammer2: Fix wrong comment for hammer2_inode_modify()
Tomohiro Kusumi [Wed, 2 Sep 2020 16:03:54 +0000 (01:03 +0900)]
sys/vfs/hammer2: Fix wrong comment for hammer2_inode_modify()

Sync with changes after 815e1c13cd185a8d3507c7d200b6f53a78b6a364 in 2015.

3 years agosys/vfs/ext2fs: Cleanup empty lines (sync with FreeBSD)
Tomohiro Kusumi [Wed, 2 Sep 2020 15:50:17 +0000 (00:50 +0900)]
sys/vfs/ext2fs: Cleanup empty lines (sync with FreeBSD)

from freebsd/freebsd@db86a2fd1ccdf6fcdfe452f21d38a7f038b368a7

3 years agosys/vfs/msdosfs: Cleanup empty lines (sync with FreeBSD)
Tomohiro Kusumi [Wed, 2 Sep 2020 15:37:18 +0000 (00:37 +0900)]
sys/vfs/msdosfs: Cleanup empty lines (sync with FreeBSD)

from freebsd/freebsd@db86a2fd1ccdf6fcdfe452f21d38a7f038b368a7

3 years agosys/vfs/autofs: Cleanup empty lines (sync with FreeBSD)
Tomohiro Kusumi [Wed, 2 Sep 2020 15:36:36 +0000 (00:36 +0900)]
sys/vfs/autofs: Cleanup empty lines (sync with FreeBSD)

from freebsd/freebsd@db86a2fd1ccdf6fcdfe452f21d38a7f038b368a7

3 years agokernel: Fix LINT64 build after Linux RCU changes
François Tigeot [Wed, 2 Sep 2020 08:10:08 +0000 (10:10 +0200)]
kernel: Fix LINT64 build after Linux RCU changes

3 years agohammer2 - Add HAMMER2IOC_GROWFS ioctl (2)
Matthew Dillon [Tue, 1 Sep 2020 21:29:36 +0000 (14:29 -0700)]
hammer2 - Add HAMMER2IOC_GROWFS ioctl (2)

* Fix minor bug to not try to write volume headers beyond the new size.
  Only applicable to H2 filesystems less than 8GB in size.

3 years agohammer2 - Implement 'growfs' directive
Matthew Dillon [Tue, 1 Sep 2020 21:25:19 +0000 (14:25 -0700)]
hammer2 - Implement 'growfs' directive

* Implement the 'growfs' directive, as in:

  hammer2 growfs /mnt

* If you resize the partition a hammer2 filesystem resides on, you
  can grow the filesystem into the partition via this command.

  The hammer2 filesystem must be mounted to issue this command.

* Note that disklabel partitions can be made larger in-place, even
  with the filesystem using the partition already mounted, as long
  as the drive actually has room to spare.

3 years agohammer2 - Add HAMMER2IOC_GROWFS ioctl
Matthew Dillon [Tue, 1 Sep 2020 21:24:28 +0000 (14:24 -0700)]
hammer2 - Add HAMMER2IOC_GROWFS ioctl

* This ioctl allows a live filesystem to be resized into a partition
  that has increased in size.

3 years agodrm - Implement poor-man's RCU
Matthew Dillon [Tue, 1 Sep 2020 18:13:25 +0000 (11:13 -0700)]
drm - Implement poor-man's RCU

* Implement a really poor-man's RCU.  Not even remotely perfect, this
  is just a brute-force tie-in for now.

  RCU operations are queued and then executed on the calling cpu
  1 second later.

3 years agokernel - Revamp ifsq_watchdog*() a bit
Matthew Dillon [Tue, 1 Sep 2020 18:06:23 +0000 (11:06 -0700)]
kernel - Revamp ifsq_watchdog*() a bit

* Add a flags argument to ifsq_watchdog_init() and implement two
  flags:

  IF_WDOG_ALLTICKS Watchdog callback occurs each second
prior to terminal count, and on terminal
count.

  IF_WDOG_LASTTICK Watchdog callback occurs one second prior
to terminal count, and on terminal count.

  0 Watchdog callback only occurs on terminal
count.

  Note that the ifnet lock is fully serialized when a watchdog
  callback is made, so generally speaking to avoid hicups you
  only want to use IF_WDOG_LASTTICK.

* This feature allows the watchdog code to flush any tx buffers
  (call *_txeof()) that have completed transmission.  Many NICs
  and virtual NICs don't bother to generate interrupts to clean-up
  such buffers when the rings are only lightly loaded.

* Fix spurious vtnet watchdog events on lightly loaded vtnet
  interfaces, loosly using the same code that FreeBSD uses
  (just txeof from the second-prior watchdog callback and then
  check on terminal count).

3 years agosys/vfs/hammer2: Remove Debugger() call for debugging in normal paths
Tomohiro Kusumi [Tue, 1 Sep 2020 15:03:12 +0000 (00:03 +0900)]
sys/vfs/hammer2: Remove Debugger() call for debugging in normal paths

3 years agosys/vfs/hammer2: Remove obsolete comments on indirect block
Tomohiro Kusumi [Mon, 31 Aug 2020 17:18:21 +0000 (02:18 +0900)]
sys/vfs/hammer2: Remove obsolete comments on indirect block

These comments from 9061bde5ad5e46bcaee746ed03d598a75b38691f in 2013
aren't really true today. Depends on blockref type, but indirect
blocks are usually 4, 16, or 32 KB, and blockref is 128 bytes.

3 years agosys/vfs/hammer2: Use hammer2_spin_t
Tomohiro Kusumi [Mon, 31 Aug 2020 15:21:00 +0000 (00:21 +0900)]
sys/vfs/hammer2: Use hammer2_spin_t

Use hammer2_spin_t instead of DragonFly specific lock primitive
structure "struct spinlock" for spinlock.

3 years agoPartially revert commit bdaacb9f+.
Daniel Fojt [Mon, 31 Aug 2020 10:09:13 +0000 (12:09 +0200)]
Partially revert commit bdaacb9f+.

Make *_RB_SCAN() back inlined. Possible inlining failures should be
treated gracefully with particular WORLD_CCOPTLEVEL.

Pointed out by: Sascha Wildner

3 years agofsck_hammer2(8): de-inline couple of functions
Daniel Fojt [Sun, 30 Aug 2020 11:30:30 +0000 (13:30 +0200)]
fsck_hammer2(8): de-inline couple of functions

Fix -Werror=inline ("call is unlikely and code size would grow") exposed
when building world with -Os.

3 years agolibefivar: use correct types in conversion macros
Daniel Fojt [Mon, 31 Aug 2020 06:46:28 +0000 (08:46 +0200)]
libefivar: use correct types in conversion macros

Adjust Strtoi() and Strtoi64() to return unsigned results, to match
upstream implementation.

Discussed with: Sascha Wildner

3 years agolibefivar: avoid accessing type-punned pointer
Daniel Fojt [Sat, 29 Aug 2020 10:23:53 +0000 (12:23 +0200)]
libefivar: avoid accessing type-punned pointer

Fix -Werror=strict-aliasing in Strtoi64() macro exposed when building
world with -O2.

3 years agolibfetch: avoid dereferencing possibly uninitialized pointer
Daniel Fojt [Sat, 29 Aug 2020 08:58:35 +0000 (10:58 +0200)]
libfetch: avoid dereferencing possibly uninitialized pointer

Fix -Werror=maybe-uninitialized exposed when building world with -Os.

3 years agosys/vfs/hammer2: Minor cleanup from cecb915381c4268602e4dfb4725d792e633b326d
Tomohiro Kusumi [Sun, 30 Aug 2020 16:40:03 +0000 (01:40 +0900)]
sys/vfs/hammer2: Minor cleanup from cecb915381c4268602e4dfb4725d792e633b326d

3 years agosys/vfs/hammer2: Remove nonexistent function prototypes
Tomohiro Kusumi [Sun, 30 Aug 2020 15:00:12 +0000 (00:00 +0900)]
sys/vfs/hammer2: Remove nonexistent function prototypes

3 years agolibc & libkvm: Fix wrong calculations in getloadavg() functions.
Sascha Wildner [Sun, 30 Aug 2020 07:52:34 +0000 (09:52 +0200)]
libc & libkvm: Fix wrong calculations in getloadavg() functions.

41ca9afb26bd2f0654acb8462f6abe441e329f80 changed the ldavg field of
struct loadavg to an array of __uint64_t from previously fixpt_t
which is __uint32_t.

Adjust two associated nelem calculations to use __uint64_t as well.

3 years ago<sys/if_media.h>: Fix typo.
Sascha Wildner [Sat, 29 Aug 2020 18:10:48 +0000 (20:10 +0200)]
<sys/if_media.h>: Fix typo.

3 years agosys/vfs/hammer2: Remove unused HAMMER2_MODIFY_{NO_MODIFY_TID,UNUSED0008}
Tomohiro Kusumi [Sat, 29 Aug 2020 15:37:28 +0000 (00:37 +0900)]
sys/vfs/hammer2: Remove unused HAMMER2_MODIFY_{NO_MODIFY_TID,UNUSED0008}

No longer used since 504565062f34ec55037ac0cf308fe3562f091460 in 2014.

3 years agosys/vfs/hammer2: Remove unused HAMMER2_BMAP_*
Tomohiro Kusumi [Sat, 29 Aug 2020 15:27:42 +0000 (00:27 +0900)]
sys/vfs/hammer2: Remove unused HAMMER2_BMAP_*

No longer used since d7bfb2cbc2b575acb989d4aad0d2477b2f2fe693 in 2013.
These were used in vop_bmap.

3 years agosys/vfs/hammer2: Remove unused HAMMER2_FREECACHE_*
Tomohiro Kusumi [Sat, 29 Aug 2020 15:19:13 +0000 (00:19 +0900)]
sys/vfs/hammer2: Remove unused HAMMER2_FREECACHE_*

No longer used since 91abd41080e36691a2b192d816cd4bd90bcd7d12 in 2013.

The freemap layout when these were added is no longer compatible
with the current one, so these won't be used again either.

3 years agosys/vfs/hammer2: Remove unused HAMMER2_DELDUP_RECORE
Tomohiro Kusumi [Sat, 29 Aug 2020 15:15:11 +0000 (00:15 +0900)]
sys/vfs/hammer2: Remove unused HAMMER2_DELDUP_RECORE

No longer used since da6f36f44bb9c76612e31b56cdfe4d787e53d61f in 2014.
hammer2_chain_delete_duplicate() was also removed.

3 years agovkernel: Adjust vke(4) for the if_media.h changes (fixes vkernel build).
Sascha Wildner [Sat, 29 Aug 2020 12:40:18 +0000 (14:40 +0200)]
vkernel: Adjust vke(4) for the if_media.h changes (fixes vkernel build).

3 years ago<net/if_media.h>: Adjust ethernet media types some more.
Sascha Wildner [Sat, 29 Aug 2020 10:13:58 +0000 (12:13 +0200)]
<net/if_media.h>: Adjust ethernet media types some more.

* IFM_1000_FX was cleaned up long ago in FreeBSD (see r95702) and
  NetBSD.

* Add a useful comment from FreeBSD.

* Adjust some whitespace and indentation.

While here, clean up the ifmedia.4 manual page a bit and add a
IFM_10G_TWINAX description (from NetBSD).

3 years agox86_64/machdep.c: Fix two minor typos and indentation
Aaron LI [Sat, 29 Aug 2020 08:00:38 +0000 (16:00 +0800)]
x86_64/machdep.c: Fix two minor typos and indentation

3 years agokernel - Fix KVM implosion by enabling the IOAPIC
Matthew Dillon [Sat, 29 Aug 2020 01:32:43 +0000 (18:32 -0700)]
kernel - Fix KVM implosion by enabling the IOAPIC

* We were disabling the IOAPIC universally when running under a VM,
  because older VMs sometimes broke when it was enabled.

  However, this can actually implode the virtual machine by causing
  interrupt routing to go haywire.

  Add a case statement and always enable the IOAPIC on bare hardware
  and KVM guests.

* Change the default to also enable the IOAPIC on all other VMs.
  Cases can be added for specific disablement if necessary.

* Fixes Google Cloud Environment booting.

3 years agokernel - Be more verbose about disabling the IOAPIC
Matthew Dillon [Sat, 29 Aug 2020 01:27:46 +0000 (18:27 -0700)]
kernel - Be more verbose about disabling the IOAPIC

* Be more verbose when disabling the IOAPIC.

* We current disable auto-EOI on the lapic.  Add some code in
  case we enable in the future to ensure that it remains disabled
  for KVM guests.

3 years agokernel - Fix atomicy issue in APIC EOI and enable_icus
Matthew Dillon [Sat, 29 Aug 2020 01:23:50 +0000 (18:23 -0700)]
kernel - Fix atomicy issue in APIC EOI and enable_icus

* Change ICU_INTREN() and ICU_INTRDIS() to only modify the ICU
  whos bit is being changed, rather than always setting the mask
  for both ICUs.

* If masking a level IRQ on the APIC, make sure the EOI
  to the APIC is atomic with the masking operation.

* Make sure that ICU enablement is atomic with ICU masking
  operations.

* Does not fix any known bugs

3 years agosbin/hammer2: Introduce HAMMER2_SHOW_DEPTH to limit "show" depth
Tomohiro Kusumi [Fri, 28 Aug 2020 15:24:28 +0000 (00:24 +0900)]
sbin/hammer2: Introduce HAMMER2_SHOW_DEPTH to limit "show" depth

Useful to check HAMMER2 radix tree nodes not so deep in the tree.

3 years agosbin/hammer2: Drop extra indentation in "show" when -q
Tomohiro Kusumi [Fri, 28 Aug 2020 15:23:46 +0000 (00:23 +0900)]
sbin/hammer2: Drop extra indentation in "show" when -q

3 years agosbin/hammer2: Fix "show" and "volhdr" output format
Tomohiro Kusumi [Fri, 28 Aug 2020 15:39:59 +0000 (00:39 +0900)]
sbin/hammer2: Fix "show" and "volhdr" output format

3 years agolibc/getdate: Add getdate_err to the Symbol.map too.
Sascha Wildner [Fri, 28 Aug 2020 11:29:32 +0000 (13:29 +0200)]
libc/getdate: Add getdate_err to the Symbol.map too.

Seems lang/clisp picks up getdate().

Reported-by: zrj
3 years agokernel: Adjust wmesg.
Sascha Wildner [Fri, 28 Aug 2020 04:38:08 +0000 (06:38 +0200)]
kernel: Adjust wmesg.

Just like in vfs_rootmountalloc().

Pointed-out-by: aly
3 years ago<net/if_media.h>: IFM_HPNA_1 != IFM_10G_LR, renumber as needed.
Sascha Wildner [Thu, 27 Aug 2020 15:41:04 +0000 (17:41 +0200)]
<net/if_media.h>: IFM_HPNA_1 != IFM_10G_LR, renumber as needed.

Reported-by: zrj
3 years agosys/vfs/hammer2: Remove HAMMER2_MINIO* macros
Tomohiro Kusumi [Thu, 27 Aug 2020 15:08:07 +0000 (00:08 +0900)]
sys/vfs/hammer2: Remove HAMMER2_MINIO* macros

HAMMER2_MINIO* were added in 1a7cfe5ae3c897f704a358fd3e556a55e430dcb1
in 2013 to switch HAMMER2_MINIO* values with ifdefs when ondisk format
wasn't stable.

This is no longer needed, and using both HAMMER2_MINIO* and HAMMER2_LBUF*
should be avoided. Users of HAMMER2_MINIO* exist in several userspace
programs which walk through blockrefs from top to bottom.

3 years agoefibootmgr(8): Sync with FreeBSD.
Sascha Wildner [Thu, 27 Aug 2020 15:17:52 +0000 (17:17 +0200)]
efibootmgr(8): Sync with FreeBSD.

Adds the -f (--fw-ui) and -F (--no-fw-ui) options to enter (or not) the
firmware's user interface upon next boot.

Taken-from: FreeBSD

3 years agotmpfs - Improve assertions
Matthew Dillon [Thu, 27 Aug 2020 05:55:54 +0000 (22:55 -0700)]
tmpfs - Improve assertions

* Improve assertions to detect failed RB_INSERT() operations.

3 years agokernel - Deal with VOP_NRENAME races
Matthew Dillon [Thu, 27 Aug 2020 05:41:05 +0000 (22:41 -0700)]
kernel - Deal with VOP_NRENAME races

* VOP_NRENAME() as implemented by the kernel can race any number of
  ways, including deadlocking, allowing duplicate entries, and panicing
  tmpfs.  It typically requires a heavy test load to replicate this but
  a dsynth build triggered the issue at least once.

  Other recently reported tmpfs issues with log file handling might also
  be effected.

* A per-mount (semi-global) lock is now obtained whenever a directory
  is renamed.  This helps deal with numerous MP races that can cause
  lock order reversals.

  Loosely taken from netbsd and linux (mjg brought me up to speed on
  this).  Renaming directories is fraught with issues and this fix,
  while somewhat brutish, is fine.  Directories are very rarely renamed
  at a high rate.

* kern_rename() now proactively locks all four elements of a rename
  operation (source_dir, source_file, dest_dir, dest_file) instead of
  only two.

* The new locking function, cache_lock4_tondlocked(), takes no chances
  on lock order reversals and will use a (currently brute-force)
  non-blocking and lock cycling algorithm.  Probably needs some work.

* Fix a bug in cache_nlookup() related to reusing DESTROYED entries
  in the hash table.  This algorithm tried to reuse the entries while
  maintaining shared locks, since only the entries need to be manipulate
  to reuse them.  However, this resulted in lookup races which could
  cause duplicate entries.  The duplicate entries then triggered
  assertions in TMPFS.

* nlookup now tries a little harder and will retry if the parent of an
  element is flagged DESTROYED after its lock was released.  DESTROYED
  elements are not necessarily temporary events as an operation can wind
  up running in a deleted directory and must properly fail under those
  conditions.

* Use krateprintf() to reduce debug output related to rename race
  reporting.

* Revamp nfsrv_rename() as well (requires more testing).

* Allow nfs_namei() to be called in a loop for retry purposes if
  desired.  It now detects that the nd structure is initialized
  from a prior run and won't try to re-parse the mbuf (needs testing).

Reported-by: zrj, mjg
3 years agokernel - Document confusing physmap[1] initialization
Matthew Dillon [Wed, 26 Aug 2020 18:56:52 +0000 (11:56 -0700)]
kernel - Document confusing physmap[1] initialization

* Document confusing physmap[1] initialization

3 years agotmpfs - Enhance assertion (not a bug fix)
Matthew Dillon [Wed, 26 Aug 2020 17:47:50 +0000 (10:47 -0700)]
tmpfs - Enhance assertion (not a bug fix)

* Enhance a reported assertion to provide more information.

Reported-by: zrj
3 years agokernel - Remove tty-related debug message
Matthew Dillon [Wed, 26 Aug 2020 17:44:42 +0000 (10:44 -0700)]
kernel - Remove tty-related debug message

* Remove a debugging message that is no longer needed.  The kprintf was
  added to determine if a particular handled race could actually happen.
  Answer is: yes it can.

3 years agosys/vfs/hammer2: Remove comment on nonexistent MINALLOCSIZE
Tomohiro Kusumi [Wed, 26 Aug 2020 15:15:40 +0000 (00:15 +0900)]
sys/vfs/hammer2: Remove comment on nonexistent MINALLOCSIZE

Removed in 1a7cfe5ae3c897f704a358fd3e556a55e430dcb1 in 2013.

3 years agosbin/newfs_hammer2: Use ~HAMMER2_PBUFMASK64 to obtain pbuf offset
Tomohiro Kusumi [Wed, 26 Aug 2020 15:15:18 +0000 (00:15 +0900)]
sbin/newfs_hammer2: Use ~HAMMER2_PBUFMASK64 to obtain pbuf offset

HAMMER2 in practice uses ~HAMMER2_PBUFMASK64 for this purpose
rather than HAMMER2_OFF_MASK_HI which is only used here.
Also more readable considering use of PBUF macros in HAMMER2.

3 years agokernel/{a,b}list: Use __func__ in panic messages.
Sascha Wildner [Wed, 26 Aug 2020 09:54:37 +0000 (11:54 +0200)]
kernel/{a,b}list: Use __func__ in panic messages.

This fixes some mistakes too (*_radix_free -> *_leaf_free).

3 years agosys/vfs/hammer2: Fix whitespace to align indentation
Tomohiro Kusumi [Tue, 25 Aug 2020 17:16:15 +0000 (02:16 +0900)]
sys/vfs/hammer2: Fix whitespace to align indentation

3 years agosys/vfs/hammer2: Remove unused HAMMER2_AV* macros
Tomohiro Kusumi [Tue, 25 Aug 2020 17:10:19 +0000 (02:10 +0900)]
sys/vfs/hammer2: Remove unused HAMMER2_AV* macros

Appeared in 9061bde5ad5e46bcaee746ed03d598a75b38691f in 2013,
but never used.

The freemap layout when these were added is no longer compatible
with the current one, so these won't be used again either.

3 years agokernel/nata: Fix operator precedence issue.
Sascha Wildner [Tue, 25 Aug 2020 04:43:26 +0000 (06:43 +0200)]
kernel/nata: Fix operator precedence issue.

3 years agozoneinfo: Update /etc/localtime when upgrading timezones.
Sascha Wildner [Mon, 24 Aug 2020 19:04:04 +0000 (21:04 +0200)]
zoneinfo: Update /etc/localtime when upgrading timezones.

* Add tzsetup(8) to the bootstrap-tools.

* Install the backward file to retain obsolete timezones as links
  for backward compatibility. Remove all these timezones from
  Makefile_upgrade.inc again. Also extend mtree/BSD.usr.dist for
  this and remove the old 'dragonfly' file (which was only for UTC).

* After installing new timezones, run tzsetup -r to upgrade the user's
  chosen timezone. Allow this to fail for quickworlders. It will start
  working after the next full buildworld.

Taken-from: FreeBSD (with modifications)

3 years agosys/vfs/hammer2: Remove unused HAMMER2_OFF_NOPREF
Tomohiro Kusumi [Mon, 24 Aug 2020 16:20:11 +0000 (01:20 +0900)]
sys/vfs/hammer2: Remove unused HAMMER2_OFF_NOPREF

Appeared in 1a7cfe5ae3c897f704a358fd3e556a55e430dcb1 in 2013,
but never used.

3 years agosys/vfs/hammer2: Remove unused HAMMER2_OFF_BAD and HAMMER2_MAX_COPIES
Tomohiro Kusumi [Mon, 24 Aug 2020 16:14:36 +0000 (01:14 +0900)]
sys/vfs/hammer2: Remove unused HAMMER2_OFF_BAD and HAMMER2_MAX_COPIES

Appeared in 703720e4d599857d052f0a65f2840224ce36ec5a in 2012,
but never used.

3 years agosys/vfs/hammer2: Remove unused HAMMER2_SPECTHREADS
Tomohiro Kusumi [Sun, 23 Aug 2020 15:44:38 +0000 (00:44 +0900)]
sys/vfs/hammer2: Remove unused HAMMER2_SPECTHREADS

No longer used since 2085215738c03d949e60de63843cb91e84836eb9 in 2016.

3 years ago<sys/systm.h>: Fix muldivu64() comment.
Sascha Wildner [Sun, 23 Aug 2020 09:50:00 +0000 (11:50 +0200)]
<sys/systm.h>: Fix muldivu64() comment.

3 years agokernel/pmap: Remove code under !defined(PMAP_ADVANCED).
Sascha Wildner [Sat, 22 Aug 2020 18:03:16 +0000 (20:03 +0200)]
kernel/pmap: Remove code under !defined(PMAP_ADVANCED).

We've been running with PMAP_ADVANCED by default since February 27.
Remove the old, inactive code.

Approved-by: dillon
3 years agokernel - Remove global cwd statistics counters
Matthew Dillon [Fri, 21 Aug 2020 18:17:05 +0000 (11:17 -0700)]
kernel - Remove global cwd statistics counters

* These were only used for debugging purposes and interfere with
  MP operation.  Just remove them.

3 years agomake(1): Fix default search path back to just /usr/share/mk.
Sascha Wildner [Fri, 21 Aug 2020 17:36:48 +0000 (19:36 +0200)]
make(1): Fix default search path back to just /usr/share/mk.

This '...' hack was intended to fix pkgsrc problems at the time but
didn't work (see 2b01fcf91a45a96b and 3db89b525e9bf920). And it was
then left in in the hopes it might be useful for something.

However, in practice it can only lead to confusion when you're
building in another BSD's tree for testing purposes and make starts
looking for and using .mk files we don't have in the upper levels
of the foreign tree instead of properly reporting that it could not
find the file.

3 years agodhclient: teach the script about resolvconf(8)
Roy Marples [Thu, 20 Aug 2020 19:53:00 +0000 (20:53 +0100)]
dhclient: teach the script about resolvconf(8)

3 years agokate.4: Sort SEE ALSO.
Sascha Wildner [Thu, 20 Aug 2020 09:55:58 +0000 (11:55 +0200)]
kate.4: Sort SEE ALSO.

3 years agogames/sail: adjust to updated ncurses
Daniel Fojt [Wed, 19 Aug 2020 18:14:00 +0000 (20:14 +0200)]
games/sail: adjust to updated ncurses

Reported by: Rimvydas Jasinskas

3 years agogames/mille: adjust to updated ncurses
Daniel Fojt [Wed, 19 Aug 2020 18:12:11 +0000 (20:12 +0200)]
games/mille: adjust to updated ncurses

Reported by: Rimvydas Jasinskas

3 years agosys/vfs/hammer2: Remove unused tailq structs
Tomohiro Kusumi [Wed, 19 Aug 2020 15:12:33 +0000 (00:12 +0900)]
sys/vfs/hammer2: Remove unused tailq structs

No longer used since
da6f36f44bb9c76612e31b56cdfe4d787e53d61f in 2014 and
ecfe89b8868b30c9ddfa9c86cb4b0a20365a248d in 2018.

3 years agokernel - Remove machdep.hack_efifb_probe_early hack
Michael Neumann [Wed, 19 Aug 2020 14:11:34 +0000 (16:11 +0200)]
kernel - Remove machdep.hack_efifb_probe_early hack

* This hack was introduced as a temporary fix for bug #3167 (see commit c2a57f42).

* Since commit faeb2db "kernel - Hack the DMAP size" the temporary hack is no longer required.

* Tested on TUXEDO InfinityBook Pro 14v4 laptop where this bug initially occured.

3 years agokernel: recognize newer Intel I219 ethernet controllers
David Shao [Tue, 18 Aug 2020 11:18:36 +0000 (04:18 -0700)]
kernel: recognize newer Intel I219 ethernet controllers

Define additional Intel I219-LM and I219-V Ethernet PCI device numbers.

Taken from NetBSD current sys/dev/pci/pcidevs.h, verified on physical
hardware for I219-V11 0x0D4D.

Submitted via: https://bugs.dragonflybsd.org/issues/3244

3 years agoUpgrade ncurses. 2/2
Daniel Fojt [Fri, 14 Aug 2020 19:28:41 +0000 (21:28 +0200)]
Upgrade ncurses. 2/2

- update README.{DELETED,DRAGONFLY}
- adapt Makefiles
- regenerate header files
- import new generated include/comp_userdefs.c
- adjust Symbol.map

3 years agoUpgrade ncurses. 1/2
Daniel Fojt [Thu, 13 Aug 2020 16:27:16 +0000 (18:27 +0200)]
Upgrade ncurses. 1/2

Merge branch 'vendor/NCURSES' into master.