History log of /freebsd-current/lib/libbe/be_impl.h
Revision Date Author Comments
# 5086b6ec 26-Jan-2024 R. Christian McDonald <rcm@FreeBSD.org>

libbe: handle destroying/renaming temporary/bootonce boot environments

When a temporary/bootonce boot environment is renamed, we need to also
update the bootenv nvlist on-disk to reflect the new name. Additionally,
when a temporary/bootonce boot environment is destroyed, we also need to
clear out the on-disk state.

Reviewed by: kevans
Approved by: kp
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D43591


# b3e76948 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# e307eb94 21-Sep-2020 Toomas Soome <tsoome@FreeBSD.org>

loader: zfs should support bootonce an nextboot

bootonce feature is temporary, one time boot, activated by
"bectl activate -t BE", "bectl activate -T BE" will reset the bootonce flag.

By default, the bootonce setting is reset on attempt to boot and the next
boot will use previously active BE.

By setting zfs_bootonce_activate="YES" in rc.conf, the bootonce BE will
be set permanently active.

bootonce dataset name is recorded in boot pool labels, bootenv area.

in case of nextboot, the nextboot_enable boolean variable is recorded in
freebsd:nvstore nvlist, also stored in boot pool label bootenv area.
On boot, the loader will process /boot/nextboot.conf if nextboot_enable
is "YES", and will set nextboot_enable to "NO", preventing /boot/nextboot.conf
processing on next boot.

bootonce and nextboot features are usable in both UEFI and BIOS boot.

To use bootonce/nextboot features, the boot loader needs to be updated on disk;
if loader.efi is stored on ESP, then ESP needs to be updated and
for BIOS boot, stage2 (zfsboot or gptzfsboot) needs to be updated
(gpart or other tools).

At this time, only lua loader is updated.

Sponsored by: Netflix, Klara Inc.
Differential Revision: https://reviews.freebsd.org/D25512


# 6966ac05 23-Jan-2020 Kyle Evans <kevans@FreeBSD.org>

Drop "All Rights Reserved" from all libbe/bectl files

I sent out an e-mail on 2020/01/21 with a plan to do this to Kyle, Rob, and
Wes; all parties have responded in the affirmative that it's OK to drop it
from these files.


# fa30d9ed 22-Apr-2019 Kyle Evans <kevans@FreeBSD.org>

libbe(3): allow creation of arbitrary depth boot environments

libbe currently only provides an API to create a recursive boot environment,
without any formal support for intentionally limiting the depth. This
changeset adds an API, be_create_depth, that may be used to arbitrarily
restrict the depth of the new BE.

Submitted by: Rob Fairbanks <rob.fx907 gmail com>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18564


# fc13fc1c 09-Jan-2019 Kyle Evans <kevans@FreeBSD.org>

libbe(3): move altroot augmentation bits around a little bit

We could perhaps have a method that does this given a dataset, but it's yet
clear that we'll always want to bypass the altroot when we grab the
mountpoint. For now, we'll refactor things a bit so we grab the altroot
length when libbe is initialized and have a common method that does the
necessary augmentation (replace with / if it's the root, return a pointer to
later in the string if not).

This will be used in some upcoming work to make be_mount work properly for
deep BEs.

MFC after: 1 week


# af43c24d 18-Nov-2018 Kyle Evans <kevans@FreeBSD.org>

libbe(3): Properly account for altroot when creating new BEs

Previously we would blindly copy the 'mountpoint' property, which includes
the altroot. The altroot needs to be snipped off prior to setting it on the
new BE, though, or you'll end up with a new BE and a mountpoint of /mnt with
altroot=/mnt

MFC after: 3 days


# 55b0e92b 16-Aug-2018 Kyle Evans <kevans@FreeBSD.org>

libbe(3)/bectl(8): Hit rewind on a bunch of off-by-ones

While here, use sizeof() in some places that it makes sense to reduce room
for error and prefer strlcpy to strncpy


# cc4deabc 14-Aug-2018 Kyle Evans <kevans@FreeBSD.org>

libbe(3): Fix leaky faucets

Amongst them:
- Resource leaks
- Logically dead code
- Unused values
- Null termination issues

Reported by: asomers (pointer to Coverity), Coverity
CID: 1394777, 1394791, 1394830, 1394844, 1394872, 1394894,
CID: 1394900, 1394907, 1394950, 1394965


# b6e7c421 07-Aug-2018 Kyle Evans <kevans@FreeBSD.org>

libbe(3)/bectl(8): Standardize $FreeBSD$ IDs


# b179da01 07-Aug-2018 Kyle Evans <kevans@FreeBSD.org>

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


# 20b7b8d8 06-Aug-2018 Kyle Evans <kevans@FreeBSD.org>

libbe(3): Document that we'll clobber previous errors set by set_error


# 5468566e 06-Aug-2018 Kyle Evans <kevans@FreeBSD.org>

libbe(3): Rename prop_list_builder and snapshot_prop_list_builder


# 4146029b 02-Aug-2018 Kyle Evans <kevans@FreeBSD.org>

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.


# 843e39ce 25-Jul-2018 Kyle Evans <kevans@FreeBSD.org>

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.


# b29bf2f8 25-Jul-2018 Kyle Evans <kevans@FreeBSD.org>

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


# c3a34c08 24-Jul-2018 Kyle Evans <kevans@FreeBSD.org>

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.


# 28f16a0f 24-Jul-2018 Kyle Evans <kevans@FreeBSD.org>

Import libbe(3)/be(1) from socsvn/soc2017/kneitinger/libbe-head