summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/fs/zfs/sys
diff options
context:
space:
mode:
authorJason King <jason.king@joyent.com>2020-11-16 16:37:31 +0000
committerJason King <jason.king@joyent.com>2020-11-16 16:37:31 +0000
commit5ffcb7f72a2f7a214b40ea8d0ef402f68aeada38 (patch)
tree86b767ee8b3625c219d1f5438eb25530c9703534 /usr/src/uts/common/fs/zfs/sys
parent45f7bf1d4508f8d85c7add1bdeb9f7ea099f0ab2 (diff)
parentde0f04687a2a3fe3692d9ad1254738343bf9c4eb (diff)
downloadillumos-joyent-5ffcb7f72a2f7a214b40ea8d0ef402f68aeada38.tar.gz
[illumos-gate merge]
commit de0f04687a2a3fe3692d9ad1254738343bf9c4eb 13310 Remove auto_ef.3ext as we don't have the software commit 25befe07d3c1488cbbdecdb765cd0558e12cc364 13302 pthread_attr_get_np.3c erroneously refers to pthread_getattr_np commit 509a605d87b8005c687f8d8264f1be379620e886 13304 bhyve ioport handling bungled on reinit commit 83cd75bb2949d26e6eb38ddefc60fdeed1909643 13309 bhyve movs emulation leaks mem refcnt commit b713c91e508f40be7797bedd4ae1146ef0652625 7537 want nextboot (one time boot) support commit 09fcda9fe16a733cc35aa3156a47ef4b909251a6 13172 Port OpenZFS: zfs label bootenv should store data as nvlist commit c4ecba8aa5f13f00c2439c06af2aa1198771ee66 13025 Port OpenZFS: Add support for boot environment data to be stored in the label commit 1a2acdcd3ce765904dbf2bfc511e92d68022d100 13308 testrunner/run needs updates for python 3.9 commit 04573c73a7ab1505c46b2c4db26bfde5176dd6a5 13286 bhyve ins/outs emulation misuses %rax commit 3dfdac06b0c70e672dbe56a2f38ec05fc0254d07 13278 CTF assertion failed cmp->cm_tmap[id].cmt_map == suid commit a676209deb2ce5d0c98f331659de25e2483f8c4c 13252 ctf_update()/ctf_dwarf_convert_function() leak memory commit effb27ee30c48fe502152c38487ced379d9f8693 13247 CTF conversion fails with large files 13251 CTF conversion fails if any CU is missing DWARF data Conflicts: usr/src/test/test-runner/cmd/run usr/src/lib/libctf/common/libctf.h usr/src/lib/libctf/common/ctf_convert.c
Diffstat (limited to 'usr/src/uts/common/fs/zfs/sys')
-rw-r--r--usr/src/uts/common/fs/zfs/sys/vdev.h4
-rw-r--r--usr/src/uts/common/fs/zfs/sys/vdev_impl.h36
-rw-r--r--usr/src/uts/common/fs/zfs/sys/zfs_bootenv.h52
3 files changed, 87 insertions, 5 deletions
diff --git a/usr/src/uts/common/fs/zfs/sys/vdev.h b/usr/src/uts/common/fs/zfs/sys/vdev.h
index b8c2ee5c9e..b839ed2359 100644
--- a/usr/src/uts/common/fs/zfs/sys/vdev.h
+++ b/usr/src/uts/common/fs/zfs/sys/vdev.h
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, 2017 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2020 by Delphix. All rights reserved.
* Copyright (c) 2017, Intel Corporation.
* Copyright (c) 2019, Datto Inc. All rights reserved.
*/
@@ -180,6 +180,8 @@ extern void vdev_uberblock_load(vdev_t *, struct uberblock *, nvlist_t **);
extern void vdev_config_generate_stats(vdev_t *vd, nvlist_t *nv);
extern void vdev_label_write(zio_t *zio, vdev_t *vd, int l, abd_t *buf, uint64_t
offset, uint64_t size, zio_done_func_t *done, void *private, int flags);
+extern int vdev_label_read_bootenv(vdev_t *, nvlist_t *);
+extern int vdev_label_write_bootenv(vdev_t *, nvlist_t *);
typedef enum {
VDEV_LABEL_CREATE, /* create/add a new device */
diff --git a/usr/src/uts/common/fs/zfs/sys/vdev_impl.h b/usr/src/uts/common/fs/zfs/sys/vdev_impl.h
index fc0f90c8c9..4e42247345 100644
--- a/usr/src/uts/common/fs/zfs/sys/vdev_impl.h
+++ b/usr/src/uts/common/fs/zfs/sys/vdev_impl.h
@@ -20,8 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, 2018 by Delphix. All rights reserved.
- * Copyright (c) 2011, 2019 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2020 by Delphix. All rights reserved.
* Copyright (c) 2017, Intel Corporation.
* Copyright 2019 Joyent, Inc.
* Copyright 2020 Joshua M. Clulow <josh@sysmgr.org>
@@ -412,7 +411,7 @@ struct vdev {
#define VDEV_RAIDZ_MAXPARITY 3
#define VDEV_PAD_SIZE (8 << 10)
-/* 2 padding areas (vl_pad1 and vl_pad2) to skip */
+/* 2 padding areas (vl_pad1 and vl_be) to skip */
#define VDEV_SKIP_SIZE VDEV_PAD_SIZE * 2
#define VDEV_PHYS_SIZE (112 << 10)
#define VDEV_UBERBLOCK_RING (128 << 10)
@@ -439,9 +438,38 @@ typedef struct vdev_phys {
zio_eck_t vp_zbt;
} vdev_phys_t;
+typedef enum vbe_vers {
+ /*
+ * The bootenv file is stored as ascii text in the envblock.
+ * It is used by the GRUB bootloader used on Linux to store the
+ * contents of the grubenv file. The file is stored as raw ASCII,
+ * and is protected by an embedded checksum. By default, GRUB will
+ * check if the boot filesystem supports storing the environment data
+ * in a special location, and if so, will invoke filesystem specific
+ * logic to retrieve it. This can be overriden by a variable, should
+ * the user so desire.
+ */
+ VB_RAW = 0,
+
+ /*
+ * The bootenv file is converted to an nvlist and then packed into the
+ * envblock.
+ */
+ VB_NVLIST = 1
+} vbe_vers_t;
+
+typedef struct vdev_boot_envblock {
+ uint64_t vbe_version;
+ char vbe_bootenv[VDEV_PAD_SIZE - sizeof (uint64_t) -
+ sizeof (zio_eck_t)];
+ zio_eck_t vbe_zbt;
+} vdev_boot_envblock_t;
+
+CTASSERT(sizeof (vdev_boot_envblock_t) == VDEV_PAD_SIZE);
+
typedef struct vdev_label {
char vl_pad1[VDEV_PAD_SIZE]; /* 8K */
- char vl_pad2[VDEV_PAD_SIZE]; /* 8K */
+ vdev_boot_envblock_t vl_be; /* 8K */
vdev_phys_t vl_vdev_phys; /* 112K */
char vl_uberblock[VDEV_UBERBLOCK_RING]; /* 128K */
} vdev_label_t; /* 256K total */
diff --git a/usr/src/uts/common/fs/zfs/sys/zfs_bootenv.h b/usr/src/uts/common/fs/zfs/sys/zfs_bootenv.h
new file mode 100644
index 0000000000..703a1c8fa6
--- /dev/null
+++ b/usr/src/uts/common/fs/zfs/sys/zfs_bootenv.h
@@ -0,0 +1,52 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2020 Toomas Soome <tsoome@me.com>
+ */
+
+#ifndef _ZFS_BOOTENV_H
+#define _ZFS_BOOTENV_H
+
+/*
+ * Define macros for label bootenv nvlist pair keys.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define BOOTENV_VERSION "version"
+
+#define BE_ILLUMOS_VENDOR "illumos"
+#define BE_FREEBSD_VENDOR "freebsd"
+#define BE_GRUB_VENDOR "grub"
+
+#define BOOTENV_OS BE_ILLUMOS_VENDOR
+
+#define GRUB_ENVMAP BE_GRUB_VENDOR ":" "envmap"
+
+#define FREEBSD_BOOTONCE BE_FREEBSD_VENDOR ":" "bootonce"
+#define FREEBSD_BOOTONCE_USED BE_FREEBSD_VENDOR ":" "bootonce-used"
+#define ILLUMOS_BOOTONCE BE_ILLUMOS_VENDOR ":" "bootonce"
+#define ILLUMOS_BOOTONCE_USED BE_ILLUMOS_VENDOR ":" "bootonce-used"
+#define FREEBSD_NVSTORE BE_FREEBSD_VENDOR ":" "nvstore"
+#define ILLUMOS_NVSTORE BE_ILLUMOS_VENDOR ":" "nvstore"
+
+#define OS_BOOTONCE BOOTENV_OS ":" "bootonce"
+#define OS_BOOTONCE_USED BOOTENV_OS ":" "bootonce-used"
+#define OS_NVSTORE BOOTENV_OS ":" "nvstore"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ZFS_BOOTENV_H */