freebsd-src/cddl/contrib/opensolaris/lib
Toomas Soome 722c2b4aca MFOpenZFS: Add support for boot environment data to be stored in the label
We are building new bootonce mechanism (previously zfs bootnext) and it is
based on this OpenZFS change. Since this patch is nicely self contained,
I am commiting it as is, and we can stack our changes.

Original patch description follows:

Modern bootloaders leverage data stored in the root filesystem to
enable some of their powerful features. GRUB specifically has a grubenv
file which can store large amounts of configuration data that can be
read and written at boot time and during normal operation. This allows
sysadmins to configure useful features like automated failover after
failed boot attempts. Unfortunately, due to the Copy-on-Write nature
of ZFS, the standard behavior of these tools cannot handle writing to
ZFS files safely at boot time. We need an alternative way to store
data that allows the bootloader to make changes to the data.

This work is very similar to work that was done on Illumos to enable
similar functionality in the FreeBSD bootloader. This patch is different
in that the data being stored is a raw grubenv file; this file can store
arbitrary variables and values, and the scripting provided by grub is
powerful enough that special structures are not required to implement
advanced behavior.

We repurpose the second padding area in each label to store the grubenv
file, protected by an embedded checksum. We add two ioctls to get and
set this data, and libzfs_core and libzfs functions to access them more
easily. There are no direct command line interfaces to these functions;
these will be added directly to the bootloader utilities.

Reviewed-by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes #10009

Obtained from:	OpenZFS
Sponsored by:	Netflix, Klara Inc.
2020-08-05 14:32:20 +00:00
..
libcmdutils MFV r325013,r325034: 640 number_to_scaled_string is duplicated in several commands 2017-10-27 12:37:22 +00:00
libctf/common Reference stdint.h types in ctf.5. 2019-07-17 16:31:50 +00:00
libdtrace Restore the binary compatibility for link_map l_addr. 2020-05-21 22:24:23 +00:00
libgen/common Mechanically convert cddl sun #ifdef's to illumos 2015-01-17 14:44:59 +00:00
libnvpair MFV r337223: 2018-08-03 01:52:25 +00:00
libuutil/common cddl/contrib/opensolaris/lib/libuutil/common/uu_avl.c 2014-03-07 23:01:35 +00:00
libzfs/common MFOpenZFS: Add support for boot environment data to be stored in the label 2020-08-05 14:32:20 +00:00
libzfs_core/common MFOpenZFS: Add support for boot environment data to be stored in the label 2020-08-05 14:32:20 +00:00
libzpool/common vfs: add a file missed in r356337 2020-01-03 22:47:31 +00:00
pyzfs/common MFV r260154 + 260182: 2014-01-02 07:34:36 +00:00