Commit 14f7f62
committed
bootenv: reorganise and document
In 99d7453 I split out the "OS-specific" zfs_bootenv_os.h for
userspace, added a placeholder "posix" vendor and set BOOTENV_OS to use
it by default. This turned out to be the wrong thing to do. BOOTENV_OS
is not actually OS-specific but rather, part of a protocol coordinating
behaviour between libzfsbootenv and the bootloader. So, all bootenv keys
now get prefixed with posix:, and their respective loaders can no longer
find them[1].
Reverting would have been straightforward, however, I am more interested
in trying to reorganise libzfsbootenv and surrounds to provide all the
pieces a loader, its support tools and the kernel module need in order
to have agreement on how to communicate with each other. This commit is
attempting that rework.
The two goals here are:
- it should be possible to set and get the loader prefix in
libzfsbootenv at run time, allowing the possibility for the library to
work on loader prefixes other than the one it was compiled with.
- a loader is a constrained environment, and so should be able to get
all the config it needs from a single header that libzfsbootenv and
the kernel at least default to using.
FreeBSD (and illumos, which borrows heavily from it) is the only system
out there that currently has this tight integration between loader,
kernel and tools, so it is the obvious target to focus on here, but I'm
also trying to clearly draw the lines for future systems.
First, we remove sys/zfs_bootenv.h and the various sys/zfs_bootenv_os.h.
This is not really a public API, and as discussed, is not the proper way
to target a loader anyway.
The important macros for a consumer have been moved to fs/zfs.h as
public and supported names. These are the minimum necessary to use
libzfsbootenv (actually lzc_get_bootenv/lzc_set_bootenv) effectively
anyway, and since they live in headers, a standalone loader can make use
of them.
Here we have macros nvlist keys for "known" loaders, and for
common/known bootenv vars. Worth noting that only "bootonce" is
currently used in libzfsbootenv proper, but listing them out at least
makes sure they're documented and we can encourage future systems to do
it the same way.
libzfsbootenv gains an internal notion of the current loader, just the
string prefix. Two new functions are added, lzbe_set_loader() and
lzbe_get_loader(), allowing runtime changes. By compiler define, we set
the default on FreeBSD and illumos to the matching macro from fs/zfs.h,
and "unknown" otherwise. This should keep existing consumers working
without change.
The rest is simple cleanup.
Sponsored-by: https://despairlabs.com/sponsor/
Signed-off-by: Rob Norris <[email protected]>
1. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=2912111 parent 7f7d493 commit 14f7f62
File tree
18 files changed
+165
-222
lines changed- include
- os
- freebsd
- zfs/sys
- linux
- zfs/sys
- sys
- fs
- lib
- libzfsbootenv
- libzpool/include
- sys
- module/zfs
- tests/zfs-tests/cmd
18 files changed
+165
-222
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | 126 | | |
128 | 127 | | |
129 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| 40 | + | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
86 | 85 | | |
87 | 86 | | |
88 | 87 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
2003 | 2004 | | |
2004 | 2005 | | |
2005 | 2006 | | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
2006 | 2042 | | |
2007 | 2043 | | |
2008 | 2044 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
503 | 503 | | |
504 | 504 | | |
505 | 505 | | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | 506 | | |
527 | 507 | | |
528 | 508 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
0 commit comments