diff options
author | Ian Lepore <ian@FreeBSD.org> | 2018-12-03 03:58:30 +0000 |
---|---|---|
committer | Ian Lepore <ian@FreeBSD.org> | 2018-12-03 03:58:30 +0000 |
commit | df108aafe9a50f5eafc9344862691b1322ee9eb4 (patch) | |
tree | c39f7a806a74746b86a5f0a59c86409df815d9bd /stand/i386/gptboot | |
parent | e860439466b5dc0d9867ca241c59acffa7d9a568 (diff) | |
download | src-df108aafe9a50f5eafc9344862691b1322ee9eb4.tar.gz src-df108aafe9a50f5eafc9344862691b1322ee9eb4.zip |
Eliminate duplicated code and struct member definitions in the handoff
of args data between gptboot/zfsboot and loader(8).
Despite what seems like a lot of changes here, there are no actual
changes in behavior, or in the data layout in the structures involved.
This is just eliminating identical code pasted into multiple locations.
In detail, the changes are...
- Move struct zfs_boot_args definition from libsa/zfs/libzfs.h to
i386/common/bootargs.h because it is specific to x86 booting and the
handoff between zfsboot and loader, and has no relation to the zfs
library code in general.
- The geli_boot_args and zfs_boot_args structs both contain an identical
set of member variables containing geli information. Extract this out
to a new geli_boot_data struct, and embed it in the arg-passing structs.
- Provide new routines geli_import_boot_data() and geli_export_boot_data()
that can be shared between gptboot, zfsboot, and loader instead of
pasting identical code into several different .c files.
- Remove some checks for a NULL pointer that can never be true because the
pointer being tested was set using pointer math (kargs + 1) and that can
never result in NULL in this code.
Notes
Notes:
svn path=/head/; revision=341420
Diffstat (limited to 'stand/i386/gptboot')
-rw-r--r-- | stand/i386/gptboot/gptboot.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/stand/i386/gptboot/gptboot.c b/stand/i386/gptboot/gptboot.c index 04212be0786d..9c52de7cb941 100644 --- a/stand/i386/gptboot/gptboot.c +++ b/stand/i386/gptboot/gptboot.c @@ -114,7 +114,6 @@ static int vdev_read(void *vdev __unused, void *priv, off_t off, void *buf, #ifdef LOADER_GELI_SUPPORT #include "geliboot.h" static char gelipw[GELI_PW_MAXLEN]; -static struct keybuf *gelibuf; #endif struct gptdsk { @@ -480,12 +479,7 @@ load(void) #ifdef LOADER_GELI_SUPPORT geliargs.size = sizeof(geliargs); explicit_bzero(gelipw, sizeof(gelipw)); - gelibuf = malloc(sizeof(struct keybuf) + - (GELI_MAX_KEYS * sizeof(struct keybuf_ent))); - geli_export_key_buffer(gelibuf); - geliargs.notapw = '\0'; - geliargs.keybuf_sentinel = KEYBUF_SENTINEL; - geliargs.keybuf = gelibuf; + export_geli_boot_data(&geliargs.gelidata); #endif /* * Note that the geliargs struct is passed by value, not by pointer. |