dragonfly.git
3 years agobinutils227: Backport binutils commit 333d0055f6f16
Antonio Huete Jimenez [Sun, 13 Sep 2020 14:49:45 +0000 (14:49 +0000)]
binutils227: Backport binutils commit 333d0055f6f16

-------
Fix problems with -r.

The fix committed for PR gold/19291 ended up breaking other cases. The
commit added adjustment code to write_local_symbols, but in many cases
compute_final_local_value_internal had already subtracted the output
section's address. To fix this, all other adjustments are now removed, so
only the one in write_local_symbols is left.

gold/
PR gold/22266
* object.cc (Sized_relobj_file::compute_final_local_value_internal):
Drop relocatable parameter and stop adjusting output value based on
it.
(Sized_relobj_file::compute_final_local_value): Stop passing
relocatable to compute_final_local_value_internal.
(Sized_relobj_file::do_finalize_local_symbols): Ditto.
* object.h (Sized_relobj_file::compute_final_local_value_internal):
Drop relocatable parameter.
-------

3 years agosbin/hammer2: Set error code if "grow" failed
Tomohiro Kusumi [Tue, 15 Sep 2020 16:00:22 +0000 (01:00 +0900)]
sbin/hammer2: Set error code if "grow" failed

3 years agoUpdate the pciconf(8) database.
Sascha Wildner [Tue, 15 Sep 2020 11:15:01 +0000 (13:15 +0200)]
Update the pciconf(8) database.

August 19, 2020 snapshot from https://pci-ids.ucw.cz

3 years agoecclesiastical.c: Fix comment error to easter()
Aaron LI [Mon, 14 Sep 2020 13:53:33 +0000 (21:53 +0800)]
ecclesiastical.c: Fix comment error to easter()

Well, the comment of easter() was copied from orthodox_easter() but
forgot to update it.

Reported-by: Sascha Wildner
3 years agocalendar.1: Fix a grammar mistake and avoid Pinyin symbols
Aaron LI [Mon, 14 Sep 2020 13:52:02 +0000 (21:52 +0800)]
calendar.1: Fix a grammar mistake and avoid Pinyin symbols

3 years agomkcsmapper(1): Move yylex() declaration to the .y file.
Sascha Wildner [Sun, 13 Sep 2020 17:38:13 +0000 (19:38 +0200)]
mkcsmapper(1): Move yylex() declaration to the .y file.

3 years agomille(6): Remove local erasechar()/killchar() definitions.
Sascha Wildner [Sat, 12 Sep 2020 23:56:41 +0000 (01:56 +0200)]
mille(6): Remove local erasechar()/killchar() definitions.

This also reverts f2a508fe031425cd16ce86e24837668eeffbc6f7 which is
no longer needed after this commit.

3 years agosbin/newfs_hammer2: Remove -f in SYNOPSIS
Tomohiro Kusumi [Sat, 12 Sep 2020 16:12:19 +0000 (01:12 +0900)]
sbin/newfs_hammer2: Remove -f in SYNOPSIS

7b2944d3f07cfec26f629f9ed161157b42a0af32 missed removal of -f in SYNOPSIS.

3 years agoedk2: Sync our TianoCore EDK II headers with the edk2-stable202008 tag.
Sascha Wildner [Sat, 12 Sep 2020 09:10:36 +0000 (11:10 +0200)]
edk2: Sync our TianoCore EDK II headers with the edk2-stable202008 tag.

3 years agoUpgrade libressl. 2/2
Daniel Fojt [Sat, 12 Sep 2020 07:43:41 +0000 (09:43 +0200)]
Upgrade libressl. 2/2

Update README.DRAGONFLY.

3 years agoUpgrade libressl. 1/2
Daniel Fojt [Sat, 12 Sep 2020 07:40:26 +0000 (09:40 +0200)]
Upgrade libressl. 1/2

Merge branch 'vendor/LIBRESSL' into master.

3 years agovendor/libressl: upgrade from 3.1.3 to 3.1.4
Daniel Fojt [Fri, 11 Sep 2020 14:58:25 +0000 (16:58 +0200)]
vendor/libressl: upgrade from 3.1.3 to 3.1.4

Interoperability and bug fixes for the TLSv1.3 client:

 * Improve client certificate selection to allow EC certificates
   instead of only RSA certificates.

 * Do not error out if a TLSv1.3 server requests an OCSP response as
   part of a certificate request.

 * Fix SSL_shutdown behavior to match the legacy stack.  The previous
   behaviour could cause a hang.

 * Fix a memory leak and add a missing error check in the handling of
   the key update message.

 * Fix a memory leak in tls13_record_layer_set_traffic_key.

 * Avoid calling freezero with a negative size if a server sends a
   malformed plaintext of all zeroes.

 * Ensure that only PSS may be used with RSA in TLSv1.3 in order
   to avoid using PKCS1-based signatures.

 * Add the P-521 curve to the list of curves supported by default
   in the client.

3 years ago<sys/cdefs.h>: Restore to original behavior for __{BEGIN,END}_DECLS.
Sascha Wildner [Fri, 11 Sep 2020 18:48:33 +0000 (20:48 +0200)]
<sys/cdefs.h>: Restore to original behavior for __{BEGIN,END}_DECLS.

Specifically, to how it was after a1671b4d6c66bceb629394590c46c15be034d14e
until 07a9133651472164d0ff4a0b6ffd6ecec4f46b30. I messed it up a little in
the latter commit.

Add __{BEGIN,END}_PUBLIC_DECLS too.

3 years agosys/vfs/hammer2: Remove unused hammer2_iod_invals sysctl
Tomohiro Kusumi [Fri, 11 Sep 2020 18:40:46 +0000 (03:40 +0900)]
sys/vfs/hammer2: Remove unused hammer2_iod_invals sysctl

No longer used since 85b1f267a5c33386e0761edb93a486fce13e8e88 in 2017.

3 years agosys/vfs/hammer2: Remove unused hammer2_chain_frees sysctl
Tomohiro Kusumi [Fri, 11 Sep 2020 18:37:29 +0000 (03:37 +0900)]
sys/vfs/hammer2: Remove unused hammer2_chain_frees sysctl

Appeared in 7d565a4f16015b664e90560061ad7574c3e68737 in 2016,
but never used.

3 years agosys/vfs/hammer2: Remove unused hammer2_inval_enable sysctl
Tomohiro Kusumi [Fri, 11 Sep 2020 18:34:59 +0000 (03:34 +0900)]
sys/vfs/hammer2: Remove unused hammer2_inval_enable sysctl

No longer used since 85b1f267a5c33386e0761edb93a486fce13e8e88 in 2017.

3 years agodrm/linux: Fix __test_and_set_bit()
François Tigeot [Fri, 11 Sep 2020 17:19:16 +0000 (19:19 +0200)]
drm/linux: Fix __test_and_set_bit()

Its arguments were inverted.

3 years agodrm/linux: Add pagevec_space()
François Tigeot [Fri, 11 Sep 2020 17:12:37 +0000 (19:12 +0200)]
drm/linux: Add pagevec_space()

Obtained-from: OpenBSD

3 years agoterminfo: drop repeat-character capability from 'xterm-new' (2)
Matthew Dillon [Fri, 11 Sep 2020 16:31:18 +0000 (09:31 -0700)]
terminfo: drop repeat-character capability from 'xterm-new' (2)

* Drop all use cases, output is mis-generated in some situations
  (LANG and LC_CTYPE envs both unset, vi (nvi) a file with 0x0000000
  sequences in it).

  Frankly, its beyond stupid to even implement ansi sequences that were
  designed for an era of 1200 baud modems.

* Add comment describing why ansi+rep was removed.

3 years agosbin/newfs_hammer2: Remove/fix obsolete stuff from HAMMER1
Tomohiro Kusumi [Fri, 11 Sep 2020 15:18:20 +0000 (00:18 +0900)]
sbin/newfs_hammer2: Remove/fix obsolete stuff from HAMMER1

Remove unused -f option. HAMMER1 had this to force creation when
devices were smaller than expected, but HAMMER2 has no such limitation.
The man page also had incorrect description.

Fix incorrect code/description for -r option originally from HAMMER1.

3 years agocalendar.1: Fix minor formatting issues
Aaron LI [Fri, 11 Sep 2020 15:02:26 +0000 (23:02 +0800)]
calendar.1: Fix minor formatting issues

* Fix markup of the '-s' flag
* Use 'Cm' to itemize the values of the '-s' flag
* Use 'Rs' and 'Re' macros to format the reference book
* Update the usage text against the man page

3 years agoterminfo: drop repeat-character capability from 'xterm-new'
Daniel Fojt [Fri, 11 Sep 2020 14:12:44 +0000 (16:12 +0200)]
terminfo: drop repeat-character capability from 'xterm-new'

Remove ANSI capability 'rep' from xterm-new entry as it's causing
misbehaviour (at least) in nvi2 editor from base.

Reported by: Matthew Dillon

3 years agoterminfo: avoid alternate buffer in 'xterm-basic'
Daniel Fojt [Thu, 10 Sep 2020 18:01:31 +0000 (20:01 +0200)]
terminfo: avoid alternate buffer in 'xterm-basic'

Remove smcup and rmcup capabilities from xterm-basic entry to avoid screen
content restoration upon leaving viewers and editors (like less, vi, etc).

Reported by: Peeter Must, Matthew Dillon

3 years agocalendar(1): Define some days in Austria in relation to 'Advent' as well.
Sascha Wildner [Fri, 11 Sep 2020 10:27:34 +0000 (12:27 +0200)]
calendar(1): Define some days in Austria in relation to 'Advent' as well.

3 years agocalendar(1): Define various German entries relative to "Advent".
Sascha Wildner [Fri, 11 Sep 2020 06:15:00 +0000 (08:15 +0200)]
calendar(1): Define various German entries relative to "Advent".

Now that we have the special "Advent" day defined, we can make this
much better readable and unambiguous.

3 years agoflex - Fix buildworld issue when compiling on older releases
Matthew Dillon [Fri, 11 Sep 2020 04:11:15 +0000 (21:11 -0700)]
flex - Fix buildworld issue when compiling on older releases

* Conditionalize use of reallocarray() so flex can bootstrap during
  a buildworld on an older release.

3 years agosbin/newfs_hammer2: Fix comments/assert on 4MB segments
Tomohiro Kusumi [Thu, 10 Sep 2020 16:30:18 +0000 (01:30 +0900)]
sbin/newfs_hammer2: Fix comments/assert on 4MB segments

The 4MB segments exist at every 1GB (every level1 freemap),
not every 2GB "zone".

3 years agosys/vfs/hammer2: Remove obsolete comments on volume headers
Tomohiro Kusumi [Thu, 10 Sep 2020 15:36:24 +0000 (00:36 +0900)]
sys/vfs/hammer2: Remove obsolete comments on volume headers

Some comments here from 2012 seem obsolete.

3 years agosys/vfs/hammer2: Remove obsolete comments on hardlink
Tomohiro Kusumi [Thu, 10 Sep 2020 15:25:07 +0000 (00:25 +0900)]
sys/vfs/hammer2: Remove obsolete comments on hardlink

Hardlink in HAMMER2 is dirents which refer to the same inode#.
It was initially designed differently.

3 years agocalendar(1): Remove Volkstrauertag. It's already in calendar.kirche.
Sascha Wildner [Thu, 10 Sep 2020 17:18:39 +0000 (19:18 +0200)]
calendar(1): Remove Volkstrauertag. It's already in calendar.kirche.

3 years agocalendar(1): Add three more commemoration days to the german calendar.
Sascha Wildner [Thu, 10 Sep 2020 14:58:35 +0000 (16:58 +0200)]
calendar(1): Add three more commemoration days to the german calendar.

3 years agoSync tpm(4) with FreeBSD.
Sascha Wildner [Thu, 10 Sep 2020 04:02:11 +0000 (06:02 +0200)]
Sync tpm(4) with FreeBSD.

Adds TPM 2.0 support, mainly.

3 years agosbin/newfs_hammer2: Assert inodes/volhdrs don't cross 64KB boundary
Tomohiro Kusumi [Wed, 9 Sep 2020 16:01:19 +0000 (01:01 +0900)]
sbin/newfs_hammer2: Assert inodes/volhdrs don't cross 64KB boundary

Assert they fit within a pbuf in addition to existing asserts.

3 years agoUpgrade vi(1). 2/2
Daniel Fojt [Tue, 8 Sep 2020 08:49:35 +0000 (10:49 +0200)]
Upgrade vi(1). 2/2

- update README.{DRAGONFLY,DELETED}
- adjust Makefile
- regenerate header files

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