]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agolibbe(3): Document the import bug...
kevans [Sat, 11 Aug 2018 04:09:42 +0000 (04:09 +0000)]
libbe(3): Document the import bug...

5 years agolibbe(3): Add to bsd.libnames.mk
kevans [Sat, 11 Aug 2018 04:07:00 +0000 (04:07 +0000)]
libbe(3): Add to bsd.libnames.mk

5 years agobectl(8): Swap the order of ujail/umount documentation...
kevans [Sat, 11 Aug 2018 04:03:05 +0000 (04:03 +0000)]
bectl(8): Swap the order of ujail/umount documentation...

"Despite my inconsistency, consistency is king." -Anonymous

5 years agobectl(8): Document export/import
kevans [Sat, 11 Aug 2018 04:01:24 +0000 (04:01 +0000)]
bectl(8): Document export/import

5 years agolibbe(3): Brain dump...
kevans [Sat, 11 Aug 2018 03:33:10 +0000 (03:33 +0000)]
libbe(3): Brain dump...

5 years agoAdd libbe(3) to mdoc
kevans [Sat, 11 Aug 2018 01:54:45 +0000 (01:54 +0000)]
Add libbe(3) to mdoc

5 years agolibbe(3)/bectl(8): Make igor and mandoc -Tlint a little happier
kevans [Sat, 11 Aug 2018 01:40:24 +0000 (01:40 +0000)]
libbe(3)/bectl(8): Make igor and mandoc -Tlint a little happier

5 years agolibbe(3): Bring man page back into reality
kevans [Sat, 11 Aug 2018 01:05:44 +0000 (01:05 +0000)]
libbe(3): Bring man page back into reality

5 years agolibbe(3)/bectl(8): Kill off the 'add' functionality for now
kevans [Sat, 11 Aug 2018 01:02:27 +0000 (01:02 +0000)]
libbe(3)/bectl(8): Kill off the 'add' functionality for now

The mostly-undocumented 'add' functionality, from initial read-through, is
intended for construction of deep ("bdrewery style") boot environments.
However, it's mostly broken at this point. `#if SOON` it out on both sides
so that we're not exposing a broken API/feature.

Work will resume on it in due time.

5 years agolibbe(3): More error handling bits
kevans [Fri, 10 Aug 2018 21:23:56 +0000 (21:23 +0000)]
libbe(3): More error handling bits

be_add_child functionality gets split out into separate places as a bonus.
A lot of places here we'll gloss over libzfs errors, because they shouldn't
be happening given the conditions that we're operating under. "Unknown
error" is what I'm intending to use for the moment to indicate an
exceptional circumstance- exceptional enough that we can't tell the consumer
did because we're not so certain that they did anything.

5 years agolibbe(3): Plug some holes, do some more proper error returns
kevans [Fri, 10 Aug 2018 04:23:13 +0000 (04:23 +0000)]
libbe(3): Plug some holes, do some more proper error returns

For those returning just -1 before, have them set ERR_UNKNOWN for now.

5 years agolibbe(3): more small cleanup, const'ify and light style(9)
kevans [Fri, 10 Aug 2018 04:01:40 +0000 (04:01 +0000)]
libbe(3): more small cleanup, const'ify and light style(9)

5 years agolibbe(3): Some more light error handling...
kevans [Wed, 8 Aug 2018 03:46:12 +0000 (03:46 +0000)]
libbe(3): Some more light error handling...

5 years agolibbe(3): Clarify some errors
kevans [Wed, 8 Aug 2018 03:25:10 +0000 (03:25 +0000)]
libbe(3): Clarify some errors

While here, fix a bug with 'rename' that checked the wrong name for being
the active BE.

5 years agoCatch up on BE_ERR messages
kevans [Wed, 8 Aug 2018 03:11:13 +0000 (03:11 +0000)]
Catch up on BE_ERR messages

5 years agolibbe(3)/bectl(8): Standardize $FreeBSD$ IDs
kevans [Tue, 7 Aug 2018 14:02:41 +0000 (14:02 +0000)]
libbe(3)/bectl(8): Standardize $FreeBSD$ IDs

5 years agolibbe(3)/bectl(8): Standardize copyright headers
kevans [Tue, 7 Aug 2018 13:46:06 +0000 (13:46 +0000)]
libbe(3)/bectl(8): Standardize copyright headers

- File names don't necessarily need to be repeated
- Add SPDX tags
- Add a missing copyright for Kyle Kneitinger in bectl.8, originally written
  by him in GSoC 2017; his standard copyright notice has been copied from
  other files within the same directory to remain consistent with how he
  clearly wished to portray it

5 years agolibbe(3): Destroy all children of a BE dataset, too
kevans [Tue, 7 Aug 2018 03:39:29 +0000 (03:39 +0000)]
libbe(3): Destroy all children of a BE dataset, too

This fixes destruction of a deep BE returning an EBUSY because child
datasets still exist.

5 years agolibbe(3): Document that we'll clobber previous errors set by set_error
kevans [Tue, 7 Aug 2018 03:26:32 +0000 (03:26 +0000)]
libbe(3): Document that we'll clobber previous errors set by set_error

5 years agolibbe(3): Return some more proper error codes
kevans [Tue, 7 Aug 2018 03:25:28 +0000 (03:25 +0000)]
libbe(3): Return some more proper error codes

5 years agolibbe(3): Check that dataset is to be mounted at / for be_exists
kevans [Tue, 7 Aug 2018 03:07:54 +0000 (03:07 +0000)]
libbe(3): Check that dataset is to be mounted at / for be_exists

This makes the be_exists behavior match the comments that assert that we've
already checked that the dataset derived from the BE name is set to mount at
/.

Other changes of note:
- bectl_list sees another change; changing mountpoint based on mount status
  turns out to be a bad idea, so instead make the mounted property of the
  returned nvlist the path that it's mounted at

- Always return the "mountpoint" property in "mountpoint" if it's ste

5 years agobectl(8): Only show mountpoint if the dataset is actually mounted
kevans [Tue, 7 Aug 2018 03:01:04 +0000 (03:01 +0000)]
bectl(8): Only show mountpoint if the dataset is actually mounted

This is to accomodate a later change in libbe(3) that will always return the
mountpoint, whether it be the directory the dataset is actively mounted at
or the "mountpoint" property.

5 years agolibbe(3): Rename prop_list_builder and snapshot_prop_list_builder
kevans [Tue, 7 Aug 2018 02:40:00 +0000 (02:40 +0000)]
libbe(3): Rename prop_list_builder and snapshot_prop_list_builder

5 years agoThis snippet is no longer from zfsbootcfg
kevans [Tue, 7 Aug 2018 02:32:29 +0000 (02:32 +0000)]
This snippet is no longer from zfsbootcfg

5 years agolibbe(3): Rewrite activate temp bits to rely less on loader
kevans [Tue, 7 Aug 2018 01:56:37 +0000 (01:56 +0000)]
libbe(3): Rewrite activate temp bits to rely less on loader

Loader is still relied upon at the beginning of libbe to specify the be
root, but we can derive from that the primary zpool and any vdevs that we
need to set nextboot bits on.

This lets me successfully `bectl activate -t test`, but UEFI loader doesn't
quite yet understand so it's effectively defunct.

5 years agobectl(8): Provide -u option to unset jail parameters
kevans [Mon, 6 Aug 2018 15:21:46 +0000 (15:21 +0000)]
bectl(8): Provide -u option to unset jail parameters

All but name, host.hostname, and path may be completely unset.

5 years agobectl(8): Split list functionality out into its own file as well
kevans [Mon, 6 Aug 2018 03:41:52 +0000 (03:41 +0000)]
bectl(8): Split list functionality out into its own file as well

5 years agobectl(8): bectl jail improvements
kevans [Mon, 6 Aug 2018 03:32:25 +0000 (03:32 +0000)]
bectl(8): bectl jail improvements

- Support passing arbitrary jail arguments via -o
- Split the related (and rewritten since the GSoC) jail bits out into a new
  bectl_jail.c file, to reduce clutter in bectl.c
- Don't use RFC 1918 IP space [0]; we'll instead set no default IPv4 and let
  the user pass in any address options they wish via -o

Reported by: rgrimes [0], Shawn Webb [0]

5 years agobectl(8): Some light cleanup and commenting
kevans [Sun, 5 Aug 2018 20:03:05 +0000 (20:03 +0000)]
bectl(8): Some light cleanup and commenting

5 years agobectl(8): Implement `bectl list -s`
kevans [Sun, 5 Aug 2018 19:38:56 +0000 (19:38 +0000)]
bectl(8): Implement `bectl list -s`

be_get_dataset_snapshots has been added to libbe(3), effectively returning
the same information as be_get_bootenv_props but for snapshots of the given
dataset. The assumption is that one will have the BE dataset name before
wanting to grab snapshots.

5 years agobectl: Implement -D ("space if origin datasets were deleted")
kevans [Sun, 5 Aug 2018 04:40:13 +0000 (04:40 +0000)]
bectl: Implement -D ("space if origin datasets were deleted")

This also accomplishes the following:

- Proxy through zfs_nicenum as be_nicenum, because it looks better than
  humanize_number and would presumably be useful to other libbe consumers.

- Rename be_get_snapshot_props to be_get_dataset_props, make it more useful

5 years agobectl(8): Take -H parameter to list into account
kevans [Sun, 5 Aug 2018 04:16:00 +0000 (04:16 +0000)]
bectl(8): Take -H parameter to list into account

-H is for a scripted format, where all fields are tab-delimited and the
headers go away. We accomplish this by splitting out pad printing to a
separate function that'll take into account whether we're supposed to be
scripted or not.

This has the nice side effect of maintaining positive column sizes again.

5 years agobectl(8): Sort BEs lightly by active (now or later) BE, then others
kevans [Sat, 4 Aug 2018 06:29:46 +0000 (06:29 +0000)]
bectl(8): Sort BEs lightly by active (now or later) BE, then others

While it could be preferred to do this at insert in libbe(3), there's no
convenient way to insert at the head of an nvlist. Instead, we'll make two
passes over- once to print anything active either now or at nextboot, and
another to print everything else.

This doesn't actually impact performance in a significant way here, so we'll
worry about further optimizations if the need actually arises.

5 years agobectl(8): Add some relevant `bectl list -a` information
kevans [Sat, 4 Aug 2018 06:14:54 +0000 (06:14 +0000)]
bectl(8): Add some relevant `bectl list -a` information

bectl list -a should show the boot environment, its relevant dataset, and
the snapshot it was created from. The header also changes to indicate the
rough order in which these things will show.

While here, start doing a little bit of spring cleaning and splitting
different bits out.

5 years agobectl(8): Take origin snapshot into account when calculating used space
kevans [Fri, 3 Aug 2018 02:04:57 +0000 (02:04 +0000)]
bectl(8): Take origin snapshot into account when calculating used space

This more closely matches the behavior for beadm. The associated libbe(3)
API is still getting worked out a little bit.

5 years agobectl(8): Just use a single pointer for all string props
kevans [Fri, 3 Aug 2018 01:51:44 +0000 (01:51 +0000)]
bectl(8): Just use a single pointer for all string props

5 years agobectl(8): Move dataset printing out into its own function
kevans [Fri, 3 Aug 2018 01:46:46 +0000 (01:46 +0000)]
bectl(8): Move dataset printing out into its own function

This may later get reused for printing snapshot and/or origin snapshot
information.

5 years agolibbe(3): Fix checking of zfs_prop_get's return value
kevans [Fri, 3 Aug 2018 01:43:51 +0000 (01:43 +0000)]
libbe(3): Fix checking of zfs_prop_get's return value

Rather than a boolean_t, it returns an int != 0 for error or 0 for OK.

5 years agobectl(8): Remove sneaky comment
kevans [Thu, 26 Jul 2018 18:57:51 +0000 (18:57 +0000)]
bectl(8): Remove sneaky comment

5 years agobectl(8): Hack together a more proper `bectl list`
kevans [Thu, 26 Jul 2018 18:56:50 +0000 (18:56 +0000)]
bectl(8): Hack together a more proper `bectl list`

Note that the space is currently just the 'used' property of the dataset.

5 years agobectl(8): Remove the jail mount point with unjail
kevans [Thu, 26 Jul 2018 04:12:31 +0000 (04:12 +0000)]
bectl(8): Remove the jail mount point with unjail

5 years agobectl(8): Redo jail using jail(3) API
kevans [Thu, 26 Jul 2018 04:07:36 +0000 (04:07 +0000)]
bectl(8): Redo jail using jail(3) API

The jail is created with allow.mount, allow.mount.devfs, and
enforce_statfs=1. Upon creation, we immediately attach, chdir to "/", and
drop the user into a shell inside the jail.

The default IP for this is arbitrarily 10.20.30.40.

5 years agobectl(8): Support unjailing a boot environment
kevans [Thu, 26 Jul 2018 03:14:58 +0000 (03:14 +0000)]
bectl(8): Support unjailing a boot environment

The given parameter may either be a jid, jail name, or a BE name.  In all
cases, the parameter will be resolved to a jid and bectl(8) will
sanity-check that there's actually a BE mounted at the requested jail root
before invoking jail_remove(2).

5 years agolibbe(3): Add be_mounted_at to check a mount point
kevans [Thu, 26 Jul 2018 03:13:07 +0000 (03:13 +0000)]
libbe(3): Add be_mounted_at to check a mount point

At a bare minimum, this function will return 0 if a BE is mounted at the
given path or non-zero otherwise.  If the optional 'details' nvlist is
supplied, it is filled with an nvpair containing just the information about
the BE mounted at the path.  This nvpair is structured just as it is for
be_get_bootenv_props, except limited to just the single mount point.

5 years agolibbe(3)/bectl(8): Provide and use proper alloc/free for property lists
kevans [Wed, 25 Jul 2018 16:00:48 +0000 (16:00 +0000)]
libbe(3)/bectl(8): Provide and use proper alloc/free for property lists

5 years agolibbe(3): Use zfs_is_mounted to check mounted and mountpoint
kevans [Wed, 25 Jul 2018 15:45:42 +0000 (15:45 +0000)]
libbe(3): Use zfs_is_mounted to check mounted and mountpoint

5 years agolibbe(3)/be(8): Drop WARNS overrides, fix all fallout
kevans [Wed, 25 Jul 2018 15:14:35 +0000 (15:14 +0000)]
libbe(3)/be(8): Drop WARNS overrides, fix all fallout

Based on the idea that we shouldn't have all-new library and utility going
into base that need WARNS=1...

- Decent amount of constification
- Lots of parentheses
- Minor other nits

5 years agolibbe(3): Add nextboot flag to returned BE information
kevans [Wed, 25 Jul 2018 14:45:00 +0000 (14:45 +0000)]
libbe(3): Add nextboot flag to returned BE information

5 years agobectl(8): Start dumping out BE information with `bectl list`
kevans [Wed, 25 Jul 2018 14:30:47 +0000 (14:30 +0000)]
bectl(8): Start dumping out BE information with `bectl list`

For the moment, this is a primitive nvlist dump of what we get back from
be_get_bootenv_props as a proof-of-concept and to make sure that we're
getting back the kind of information we want to see from list.

5 years agobectl(8): Consistent style
kevans [Wed, 25 Jul 2018 04:06:09 +0000 (04:06 +0000)]
bectl(8): Consistent style

5 years agobectl(8): Rename error messages
kevans [Wed, 25 Jul 2018 03:57:28 +0000 (03:57 +0000)]
bectl(8): Rename error messages

5 years agolibbe(3): make style consistent with what I'll use going forward
kevans [Wed, 25 Jul 2018 03:50:01 +0000 (03:50 +0000)]
libbe(3): make style consistent with what I'll use going forward

5 years agolibbe(3): Find rootfs instead by enumerating child datasets of BE root
kevans [Wed, 25 Jul 2018 03:30:01 +0000 (03:30 +0000)]
libbe(3): Find rootfs instead by enumerating child datasets of BE root

This makes us more resilient to a rename of the bootfs, but still wouldn't
withstand pool renames or guid renames. More importantly, this allows `bectl
create <foo>` work out of the box to create a boot environment based on the
currently booted one.

5 years agolibbe(3): Disambiguate 'active' a little bit, add 'bootfs'
kevans [Wed, 25 Jul 2018 03:08:11 +0000 (03:08 +0000)]
libbe(3): Disambiguate 'active' a little bit, add 'bootfs'

- Rename 'active' to 'rootfs', which is used in other places to describe the
currently booted (or about to be booted) BE.

- Add 'bootfs', which indicates the next boot environment to be booted. This
  is pulled from the BOOTFS zpool property.

- Go ahead and keep an open handle to the active zpool. We might need to
  enumerate datasets, get properties, and set properties (e.g. bootfs)
  throughout other libbe bits, and a single handle isn't overly expensive.

5 years agobectl.c: Chase rename
kevans [Wed, 25 Jul 2018 01:04:50 +0000 (01:04 +0000)]
bectl.c: Chase rename

5 years agoNormalize bectl(8)/libbe(3) Makefiles, remove Makefile copyright/license
kevans [Tue, 24 Jul 2018 19:55:02 +0000 (19:55 +0000)]
Normalize bectl(8)/libbe(3) Makefiles, remove Makefile copyright/license

Approved by: hselaskey

5 years agolibbe(3): Add to cddl build, adjust src.libnames.mk as needed
kevans [Tue, 24 Jul 2018 15:42:23 +0000 (15:42 +0000)]
libbe(3): Add to cddl build, adjust src.libnames.mk as needed

5 years agosrc.libnames.mk: Make libbe entry consistent with others
kevans [Tue, 24 Jul 2018 13:31:50 +0000 (13:31 +0000)]
src.libnames.mk: Make libbe entry consistent with others

Perhaps using libbe.a from "${DESTDIR}${LIBDIR}" might have been the
prevailing technique at one point, but nowadays it appears to be to
preferred to spell this as "${OBJTOP}/lib" -- make it so.

5 years agobectl(8): Chase rename in manpage
kevans [Tue, 24 Jul 2018 13:24:30 +0000 (13:24 +0000)]
bectl(8): Chase rename in manpage

5 years agoRename be(1) to bectl(8); continues to live in /sbin
kevans [Tue, 24 Jul 2018 13:21:44 +0000 (13:21 +0000)]
Rename be(1) to bectl(8); continues to live in /sbin

Discussed with: rpokala, allanjude

5 years agoImport libbe(3)/be(1) from socsvn/soc2017/kneitinger/libbe-head
kevans [Tue, 24 Jul 2018 13:17:40 +0000 (13:17 +0000)]
Import libbe(3)/be(1) from socsvn/soc2017/kneitinger/libbe-head

5 years agoIn C remquol() and thus also in C remainderl(), don't clobber the sign bit
bde [Tue, 24 Jul 2018 11:50:05 +0000 (11:50 +0000)]
In C remquol() and thus also in C remainderl(), don't clobber the sign bit
of NaNs before possible returning a NaN.

The remquo*() and remainder*() functions should now give bitwise identical
results across arches and implementations, and bitwise consistent results
(with lower precisions having truncated mantissas) across precisions.  x86
already had consistency across amd64 and i386 and precisions by using the
i387 consistently and normally not using the C versions.  Inconsistencies
for C reqmquol() were first detected on sparc64.

Remove double second clearing of the sign bit and extra blank lines.

5 years agolld: fix addends with partial linking
emaste [Tue, 24 Jul 2018 11:35:22 +0000 (11:35 +0000)]
lld: fix addends with partial linking

[ELF] Update addends in non-allocatable sections for REL targets when
creating a relocatable output.

LLVM PR: 37735
LLVM Differential Revision: https://reviews.llvm.org/D48929

PR: 225128
Obtained from: LLVM r336799 by Igor Kudrin

5 years agoFix the conversion to use nan_mix() in r336362. fmod*(x, y),
bde [Tue, 24 Jul 2018 10:10:16 +0000 (10:10 +0000)]
Fix the conversion to use nan_mix() in r336362.  fmod*(x, y),
remainder*(x, y) and remquo*(x, y, quo) were broken for y = 0 by changing
multiplication by y to addition of y.  (When y is 0, the result should be
NaN but became 1 for finite x.)

Use a new macro nan_mix_op() to give more control over the mixing, and
expand comments.

Recent re-testing missed finding this bug since I only tested the macro
version on amd64 and i386 and these arches don't use the C versions (they
use either asm versions or builtins).

Reported by: enh via freebsd-numerics

5 years agoDeprecate jedec_ts(4) and point users to jedec_dimm(4) instead
rpokala [Tue, 24 Jul 2018 08:15:02 +0000 (08:15 +0000)]
Deprecate jedec_ts(4) and point users to jedec_dimm(4) instead

jedec_dimm(4) is a superset of the functionality of jedec_ts(4). Mark
jedec_ts(4) as removed in FreeBSD 12, and include a pointer to the migration
instructions in the jedec_dimm(4) manpage, in both the jedec_ts(4) code and
the jedec_ts(4) manpage. Add a note to the jedec_dimm(4) manpage about the
fact that it is a superset of jedec_ts(4).

This change will be MFCed to stable/11 and stable/10; the followup change
to actually remove jedec_ts(4) from -HEAD will not.

Reviewed by: avg
MFC after: 1 week
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D16412

5 years agoZFS: Reserve DMU_BACKUP_FEATURE flags for Native Encryption and ZSTD
allanjude [Tue, 24 Jul 2018 04:38:11 +0000 (04:38 +0000)]
ZFS: Reserve DMU_BACKUP_FEATURE flags for Native Encryption and ZSTD

5 years agogeli init: Allow initialization of multiple geli providers at once if
woodsb02 [Mon, 23 Jul 2018 23:04:43 +0000 (23:04 +0000)]
geli init: Allow initialization of multiple geli providers at once if
they use same passphrase and keyfiles.

Unique salt will be randomly generated for each provider to ensure the
Master Key for each is unique.

This change follows on from r335673 and r336602, which allowed multiple
providers to be attached in a single command.

Reviewed by: asomers
Approved by: sobomax
Differential Revision: https://reviews.freebsd.org/D16115

5 years agoSay a little more about the new protocol.
imp [Mon, 23 Jul 2018 22:15:36 +0000 (22:15 +0000)]
Say a little more about the new protocol.

Requested by: emaste@

5 years agoarch.7: fix whitespace from r336435
emaste [Mon, 23 Jul 2018 21:09:57 +0000 (21:09 +0000)]
arch.7: fix whitespace from r336435

Previously armeb's Final Release rendered as 'Ta 11.x'.

Sponsored by: The FreeBSD Foundation

5 years agoFinalize the boot manager protocol support for next-stage boot
imp [Mon, 23 Jul 2018 20:36:59 +0000 (20:36 +0000)]
Finalize the boot manager protocol support for next-stage boot
loading.

If we are booting in a conforming UEFI Boot Manager Environment, then
use the BootCurrent variable to find the BootXXXX we're using. Once we
find that, then if it contains more than one EFI_DEVICE_PATH in its
what to boot section, try to use the last one as the kernel to
load. This will also set the default root partition as well. If
there's only one path, or if there's an error along the way, assume
that nothing specific was specified and revert to the old
algorithm. If something was specified, but not found, then fail the
boot. Otherwise you that, specific thing. On FreeBSD, this can be set
using efibootmgr -l <loader> -k <kernel>. We try a few variations of
kernel to cope with the fact that UEFI comes from a DOS world where
paths might be upper case and/or contain back-slashes.

Note: In an ideal world, we'd work out where we are in chain loading
by looking at the passed-in image handle and doing name
matching. However, that's unreliable since at least boot1.efi booted
images don't have that, hence the assumption that loader.efi needs to
load the last thing on the list, if possible.

The reason we fail for something specific is so that we can fully
participate in the UEFI Boot Manager Protocol and fail over to the
next item in the list of BootOrder choices when something goes wrong
at this stage.

This implements was was talked about in freebsd-arch@ last year
https://docs.freebsd.org/cgi/getmsg.cgi?fetch=3576+0+archive/2017/freebsd-arch/20171022.freebsd-arch
and documented in full (after changed resulting from the discussion) in
https://docs.google.com/document/d/1aK9IqF-60JPEbUeSAUAkYjF2W_8EnmczFs6RqCT90Jg/edit#
although one or two minor details may have been modified in this
implementation to make it work, and the ZFS MEDIA PATH extension isn't
implemented. This does not yet move things to ESP:\efi\freebsd\loader.efi.

RelNotes: Yes
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D16403

5 years agoImplement efiblk_get_pdinfo_by_device_path
imp [Mon, 23 Jul 2018 20:36:54 +0000 (20:36 +0000)]
Implement efiblk_get_pdinfo_by_device_path

Lookup a block device by it's device path. We use a 'loose' lookup
whereby we scan forward to the first Media Path portion of the device
path, then look at all our handles for one whose first Media Path
matches. This will also work if the device path pointed to has a
following file path (or paths) as that's ignored. It assumes that
there's only one media path node that describes the entire device,
which is true as of the latest UEFI spec (2.7 Errata A) as far as I've
been able to determine.

Sponsored by: Netflix

5 years agoImplement efi_devpath_length
imp [Mon, 23 Jul 2018 20:36:50 +0000 (20:36 +0000)]
Implement efi_devpath_length

Return the total length, in bytes, of the device path (including the
terminating node at the end).

Sponsored by: Netflix

5 years agoImplement efi_devpath_match_node
imp [Mon, 23 Jul 2018 20:36:45 +0000 (20:36 +0000)]
Implement efi_devpath_match_node

Returns true if the first node pointed to by devpath1 is identical to
the first node pointed to by devpath2, with care taken to not read
past the end of the valid parts of either devpath1 or
devpath2. Otherwise, returns false.

Sponsored by: Netflix

5 years agoStore the number of handles we get back in efipart_nhandles rather
imp [Mon, 23 Jul 2018 20:36:41 +0000 (20:36 +0000)]
Store the number of handles we get back in efipart_nhandles rather
than the number of bytes. Don't divide by the element size every time
we have to iterate. Eliminate now-unused variables.

Sponsored by: Netflix

5 years agoImplement efi_devpath_to_media_path
imp [Mon, 23 Jul 2018 20:36:25 +0000 (20:36 +0000)]
Implement efi_devpath_to_media_path

Takes a generic device path as its input. Scans through it to find the
first media_path node in it and returns a pointer to it. If none is
found, NULL is returned.

Sponsored by: Netflix

5 years agoUse __riscv to determine building for RISC-V
lwhsu [Mon, 23 Jul 2018 19:49:54 +0000 (19:49 +0000)]
Use __riscv to determine building for RISC-V

Reviewed by: br
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16398

5 years agoarch.7: Clarify architecture-specific macro use
emaste [Mon, 23 Jul 2018 19:39:20 +0000 (19:39 +0000)]
arch.7: Clarify architecture-specific macro use

Compilers may define multiple variants of architecture-specific macros
(for example, both __x86_64 and __x86_64__).  Add a note that the macros
documented in arch.7 are the preferred ones for FreeBSD.

Sponsored by: The FreeBSD Foundation

5 years agoNow that we set the busy_detect bit in the bas to support setting it
imp [Mon, 23 Jul 2018 19:27:11 +0000 (19:27 +0000)]
Now that we set the busy_detect bit in the bas to support setting it
for the console, set our override in the bas as well.

Tested by: emaste@

5 years agoSupport compressed crash dumps in crashinfo(8).
jhb [Mon, 23 Jul 2018 18:08:56 +0000 (18:08 +0000)]
Support compressed crash dumps in crashinfo(8).

Temporarily decompress a copy of a crash dump compressed with either
gzip or zstd and run various tools against the decompressed copy while
generating the crash information.  The uncompressed copy is deleted when
the script exits.

Note that crashinfo is enabled by default, so this will attempt to
decompress the most recent compressed crash dump after a crash that
generates a compressed crash dump.  Users who wish to only do offline
analysis of compressed crash dumps can disable crashinfo in rc.conf.

Tested by: ler
Reviewed by: markj
MFC after: 2 weeks

5 years agoRevert r336619, it appears to cause problems with ssh, and probably other
ian [Mon, 23 Jul 2018 17:26:38 +0000 (17:26 +0000)]
Revert r336619, it appears to cause problems with ssh, and probably other
things which use pw_scan().

5 years agofix incorrect operator in the AUDITPIPE_SET_QLIMIT bounds check
avg [Mon, 23 Jul 2018 16:56:49 +0000 (16:56 +0000)]
fix incorrect operator in the AUDITPIPE_SET_QLIMIT bounds check

PR: 229983
Submitted by: Aniket Pandey <aniketp@iitk.ac.in>
Reported by: Aniket Pandey <aniketp@iitk.ac.in>
MFC after: 1 week

5 years agoAdd the initial DIRS infrastructure for creating directories with the
brd [Mon, 23 Jul 2018 16:11:03 +0000 (16:11 +0000)]
Add the initial DIRS infrastructure for creating directories with the
necessary owner, group, mode and flags.

Approved by: bapt (mentor)
Differential Revision: https://reviews.freebsd.org/D16405

5 years agofollow-up to r336635, update TAILQ to CK_SLIST for ie_handlers
avg [Mon, 23 Jul 2018 15:36:55 +0000 (15:36 +0000)]
follow-up to r336635, update TAILQ to CK_SLIST for ie_handlers

arm, mips and sparc64 were affected.

5 years agoRevert r336625 until I figure out why it worked with simple testing but
ian [Mon, 23 Jul 2018 14:58:44 +0000 (14:58 +0000)]
Revert r336625 until I figure out why it worked with simple testing but
reportedly fails the kyua tests and causes other real-world problems.

Reported by: cy@ asomers@

5 years agochange interrupt event's list of handlers from TAILQ to CK_SLIST
avg [Mon, 23 Jul 2018 12:51:23 +0000 (12:51 +0000)]
change interrupt event's list of handlers from TAILQ to CK_SLIST

The primary reason for this commit is to separate mechanical and nearly
mechanical code changes from an upcoming fix for unsafe teardown of
shared interrupt handlers that have only filters (see D15905).

The technical rationale is that SLIST is sufficient.  The only operation
that gets worse performance -- O(n) instead of O(1) is a removal of a
handler,  but it is not a critical operation and the list is expected to
be rather short.

Additionally, it is easier to reason about SLIST when considering the
concurrent lock-free access to the list from the interrupt context and
the interrupt thread.

CK_SLIST is used because the upcoming change depends on the memory order
provided by CK_SLIST insert and the fact that CL_SLIST remove does not
trash the linkage in a removed element.

While here, I also fixed a couple of whitespace issues, made code under
ifdef notyet compilable, added a lock assertion to ithread_update() and
made intr_event_execute_handlers() static as it had no external callers.

Reviewed by: cem (earlier version)
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D16016

5 years agoMFV CK@r336629: Import CK as of commit 1c1f9901c2dea7a883342cd03d3906a1bc482583
avg [Mon, 23 Jul 2018 11:21:43 +0000 (11:21 +0000)]
MFV CK@r336629: Import CK as of commit 1c1f9901c2dea7a883342cd03d3906a1bc482583

This adds CK_SLIST_INSERT_PREVPTR and CK_SLIST_REMOVE_PREVPTR macros
as well as ck_pr_dec_is_zero family of functions.

MFC after: 3 weeks

5 years agoFix setjmp for RISC-V:
br [Mon, 23 Jul 2018 09:54:28 +0000 (09:54 +0000)]
Fix setjmp for RISC-V:
o The correct value for _JB_SIGMASK is 27.
o The storage size for double-precision floating
  point register is 8 bytes.

Submitted by: "James Clarke" <jrtc4@cam.ac.uk>
Reviewed by: markj@
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D16344

5 years agoUpdate modify counter when setting a mixer control.
hselasky [Mon, 23 Jul 2018 09:16:23 +0000 (09:16 +0000)]
Update modify counter when setting a mixer control.

PR: 229969
MFC after: 1 week

5 years agoRemove duplicated entry
uqs [Mon, 23 Jul 2018 08:52:57 +0000 (08:52 +0000)]
Remove duplicated entry

5 years agoepair(4): make sure we do not duplicate MAC addresses
eugen [Mon, 23 Jul 2018 07:11:58 +0000 (07:11 +0000)]
epair(4): make sure we do not duplicate MAC addresses
in case of reused if_index.

PR: 229957
Tested by: O. Hartmann <ohartmann@walstatt.org>
Approved by: avg (mentor)

5 years agoFix the attempt to see if we're overriding the console in the command
imp [Mon, 23 Jul 2018 06:38:48 +0000 (06:38 +0000)]
Fix the attempt to see if we're overriding the console in the command
line args. I had thought console would be NULL, but it's efi. Set it
to efi (as a clue) before we initialize the console, then test it to
see if it changed on the command line to do the automatic
override. This gets my serial console back.

5 years agoOlder zfs boot blocks don't support symlinks. install the link to
imp [Mon, 23 Jul 2018 06:04:05 +0000 (06:04 +0000)]
Older zfs boot blocks don't support symlinks. install the link to
zfsloader as a hard link. While newer ones do, the whole point of the
link was to transition to the new world order smoothly. A hard link is
less flexible, but it works and will result in fewer bumps. Adjust
UPDATING entry to match.

5 years agoMake pw(8) showuser work the same with or without -R <path> for non-root
ian [Sun, 22 Jul 2018 23:41:40 +0000 (23:41 +0000)]
Make pw(8) showuser work the same with or without -R <path> for non-root
users.  Without -R, pw(8) uses getpwnam(3), which will open master.passwd
for the root user or passwd for non-root users.  With -R <path> pw(8) was
always opening <path>/master.passwd, which would fail for a non-root user,
then falsely claim the userid you're trying to show doesn't exist.

Now for a non-root user it opens <path>/passwd and zeroes out the 3 fields
that aren't available in the passwd file, which duplicates the behavior of
getpwnam(3).  The net effect is that the showuser output is identical
whether using -R or not.

5 years agofix use of empty in Makefile.ec2
mmacy [Sun, 22 Jul 2018 23:33:48 +0000 (23:33 +0000)]
fix use of empty in Makefile.ec2

empty() takes a variable name - not the expanded value

Reported by: sjg

5 years agoAdd busy detect quirk to list of console options
mmacy [Sun, 22 Jul 2018 23:32:21 +0000 (23:32 +0000)]
Add busy detect quirk to list of console options

This change allows one to set the busy_detect flag
required by the synopsys UART at the loader prompt.
This is needed by the EPYC 3000 SoC.

This will give users a working console up to the point where getty is required:
hw.uart.console="mm:0xfedc9000,rs:2,bd:1"

Reviewed by: imp
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D16399

5 years agoCorrectly reference SRCTOP, avoid multiple invocations of svn
mmacy [Sun, 22 Jul 2018 23:20:24 +0000 (23:20 +0000)]
Correctly reference SRCTOP, avoid multiple invocations of svn

Reported by: sjg

5 years agofix build non-svn checkouts post r336593
mmacy [Sun, 22 Jul 2018 22:57:52 +0000 (22:57 +0000)]
fix build non-svn checkouts post r336593

The change made in r336593 assumes that the build is happening in a
svn checkout resulting in misleading debug output. Check that we're
actually working in an svn checkout before proceeding to call svn.

5 years agoAdd udma_barrier definitions for RISC-V
lwhsu [Sun, 22 Jul 2018 22:35:17 +0000 (22:35 +0000)]
Add udma_barrier definitions for RISC-V

Reviewed by: kib
Sponsored by: The FreeBSD Foundation

5 years agoSet the pw_class field to NULL when scanning the non-master passwd file.
ian [Sun, 22 Jul 2018 22:34:20 +0000 (22:34 +0000)]
Set the pw_class field to NULL when scanning the non-master passwd file.
This avoids a null pointer deref in pw_dup(), which assumes that all
pointers are either NULL or valid.

5 years agoTemporarily disable the sys/acl/00 and sys/acl/02 tests
asomers [Sun, 22 Jul 2018 21:00:11 +0000 (21:00 +0000)]
Temporarily disable the sys/acl/00 and sys/acl/02 tests

These tests are failing due to PR 229930.  Unfortunately, TAP tests can't be
marked as expected failures.

PR: 229930
Reported by: Jenkins