Date: Sat, 2 Dec 2017 00:07:37 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326448 - in head: stand stand/geli stand/i386/gptboot stand/i386/libi386 stand/i386/zfsboot stand/libsa stand/zfs sys/cddl/boot/zfs Message-ID: <201712020007.vB207bVF034051@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Sat Dec 2 00:07:37 2017 New Revision: 326448 URL: https://svnweb.freebsd.org/changeset/base/326448 Log: Fix all warnings related to geli and ZFS support on x86. Default WARNS to 0 still, since there's still some warnings on other architectures. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D13301 Modified: head/stand/defs.mk head/stand/geli/Makefile head/stand/geli/geliboot.c head/stand/i386/gptboot/gptboot.c head/stand/i386/libi386/biosdisk.c head/stand/i386/zfsboot/zfsboot.c head/stand/libsa/Makefile head/stand/zfs/zfsimpl.c head/sys/cddl/boot/zfs/zfssubr.c Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Sat Dec 2 00:07:31 2017 (r326447) +++ head/stand/defs.mk Sat Dec 2 00:07:37 2017 (r326448) @@ -2,6 +2,8 @@ .include <src.opts.mk> +WARNS?=0 + .if !defined(__BOOT_DEFS_MK__) __BOOT_DEFS_MK__=${MFILE} Modified: head/stand/geli/Makefile ============================================================================== --- head/stand/geli/Makefile Sat Dec 2 00:07:31 2017 (r326447) +++ head/stand/geli/Makefile Sat Dec 2 00:07:37 2017 (r326448) @@ -12,8 +12,6 @@ INTERNALLIB= MK_PROFILE= no NO_PIC= -WARNS?= 0 - # Our password input method SRCS+= pwgets.c Modified: head/stand/geli/geliboot.c ============================================================================== --- head/stand/geli/geliboot.c Sat Dec 2 00:07:31 2017 (r326447) +++ head/stand/geli/geliboot.c Sat Dec 2 00:07:37 2017 (r326448) @@ -222,7 +222,7 @@ geli_taste(int read_func(void *vdev, void *priv, off_t */ static int geli_attach(struct geli_entry *ge, struct dsk *dskp, const char *passphrase, - const u_char *mkeyp) + u_char *mkeyp) { u_char key[G_ELI_USERKEYLEN], mkey[G_ELI_DATAIVKEYLEN], *mkp; u_int keynum; @@ -248,7 +248,7 @@ geli_attach(struct geli_entry *ge, struct dsk *dskp, c } else if (geli_e->md.md_iterations == 0) { g_eli_crypto_hmac_update(&ctx, geli_e->md.md_salt, sizeof(geli_e->md.md_salt)); - g_eli_crypto_hmac_update(&ctx, passphrase, + g_eli_crypto_hmac_update(&ctx, (const uint8_t *)passphrase, strlen(passphrase)); } else if (geli_e->md.md_iterations > 0) { printf("Calculating GELI Decryption Key disk%dp%d @ %d" @@ -294,7 +294,7 @@ found_key: /* * The encryption key is: ekey = HMAC_SHA512(Data-Key, 0x10) */ - g_eli_crypto_hmac(mkp, G_ELI_MAXKEYLEN, "\x10", 1, + g_eli_crypto_hmac(mkp, G_ELI_MAXKEYLEN, (const uint8_t *)"\x10", 1, geli_e->sc.sc_ekey, 0); } explicit_bzero(mkey, sizeof(mkey)); Modified: head/stand/i386/gptboot/gptboot.c ============================================================================== --- head/stand/i386/gptboot/gptboot.c Sat Dec 2 00:07:31 2017 (r326447) +++ head/stand/i386/gptboot/gptboot.c Sat Dec 2 00:07:37 2017 (r326448) @@ -32,6 +32,10 @@ __FBSDID("$FreeBSD$"); #include <btxv86.h> +/* Forward declared to avoid warnings -- these shouldn't be needed */ +int strcasecmp(const char *s1, const char *s2); +void explicit_bzero(void *b, size_t len); + #include "bootargs.h" #include "lib.h" #include "rbx.h" @@ -254,7 +258,7 @@ gptinit(void) #ifdef LOADER_GELI_SUPPORT if (geli_taste(vdev_read, &dsk, (gpttable[curent].ent_lba_end - gpttable[curent].ent_lba_start)) == 0) { - if (geli_havekey(&dsk) != 0 && geli_passphrase(&gelipw, + if (geli_havekey(&dsk) != 0 && geli_passphrase(gelipw, dsk.unit, 'p', curent + 1, &dsk) != 0) { printf("%s: unable to decrypt GELI key\n", BOOTPROG); return (-1); @@ -265,6 +269,8 @@ gptinit(void) dsk_meta = 0; return (0); } + +int main(void); int main(void) Modified: head/stand/i386/libi386/biosdisk.c ============================================================================== --- head/stand/i386/libi386/biosdisk.c Sat Dec 2 00:07:31 2017 (r326447) +++ head/stand/i386/libi386/biosdisk.c Sat Dec 2 00:07:37 2017 (r326448) @@ -146,8 +146,7 @@ enum isgeli { }; static enum isgeli geli_status[MAXBDDEV][MAXTBLENTS]; -int bios_read(void *vdev __unused, struct dsk *priv, off_t off, char *buf, - size_t bytes); +int bios_read(void *, void *, off_t off, void *buf, size_t bytes); #endif /* LOADER_GELI_SUPPORT */ struct devsw biosdisk = { @@ -482,10 +481,10 @@ bd_open(struct open_file *f, ...) /* Use the cached passphrase */ bcopy(passphrase, &gelipw, GELI_PW_MAXLEN); } - if (geli_passphrase(&gelipw, dskp.unit, 'p', + if (geli_passphrase(gelipw, dskp.unit, 'p', (dskp.slice > 0 ? dskp.slice : dskp.part), &dskp) == 0) { - setenv("kern.geom.eli.passphrase", &gelipw, 1); + setenv("kern.geom.eli.passphrase", gelipw, 1); bzero(gelipw, sizeof(gelipw)); geli_status[dev->d_unit][dskp.slice] = ISGELI_YES; geli_part++; @@ -882,7 +881,7 @@ bd_read(struct disk_devdesc *dev, daddr_t dblk, int bl /* GELI needs the offset relative to the partition start */ p_off = alignlba - dskp.start; - err = geli_read(&dskp, p_off * BD(dev).bd_sectorsize, tmpbuf, + err = geli_read(&dskp, p_off * BD(dev).bd_sectorsize, (u_char *)tmpbuf, alignblks * BD(dev).bd_sectorsize); if (err) return (err); @@ -992,9 +991,10 @@ bd_getdev(struct i386_devdesc *d) #ifdef LOADER_GELI_SUPPORT int -bios_read(void *vdev __unused, struct dsk *priv, off_t off, char *buf, size_t bytes) +bios_read(void *vdev __unused, void *xpriv, off_t off, void *buf, size_t bytes) { struct disk_devdesc dev; + struct dsk *priv = xpriv; dev.d_dev = &biosdisk; dev.d_type = priv->type; Modified: head/stand/i386/zfsboot/zfsboot.c ============================================================================== --- head/stand/i386/zfsboot/zfsboot.c Sat Dec 2 00:07:31 2017 (r326447) +++ head/stand/i386/zfsboot/zfsboot.c Sat Dec 2 00:07:37 2017 (r326448) @@ -36,6 +36,10 @@ __FBSDID("$FreeBSD$"); #include <btxv86.h> +/* Forward declared to avoid warnings -- these shouldn't be needed */ +int strcasecmp(const char *s1, const char *s2); +void explicit_bzero(void *b, size_t len); + #include "lib.h" #include "rbx.h" #include "drv.h" @@ -96,7 +100,6 @@ static int comspeed = SIOSPD; static struct bootinfo bootinfo; static uint32_t bootdev; static struct zfs_boot_args zfsargs; -static struct zfsmount zfsmount; vm_offset_t high_heap_base; uint32_t bios_basemem, bios_extmem, high_heap_size; @@ -200,7 +203,7 @@ static vdev_t *primary_vdev; * buffer pointer crosses a 64k boundary. */ static int -vdev_read(vdev_t *vdev, void *priv, off_t off, void *buf, size_t bytes) +vdev_read(void *xvdev, void *priv, off_t off, void *buf, size_t bytes) { char *p; daddr_t lba, alignlba; @@ -262,7 +265,14 @@ vdev_read(vdev_t *vdev, void *priv, off_t off, void *b return 0; } +/* Match the signature exactly due to signature madness */ +static int +vdev_read2(vdev_t *vdev, void *priv, off_t off, void *buf, size_t bytes) +{ + return vdev_read(vdev, priv, off, buf, bytes); +} + static int vdev_write(vdev_t *vdev, void *priv, off_t off, void *buf, size_t bytes) { @@ -557,7 +567,7 @@ probe_drive(struct dsk *dsk) /* * If we find a vdev on the whole disk, stop here. */ - if (vdev_probe(vdev_read, dsk, NULL) == 0) + if (vdev_probe(vdev_read2, dsk, NULL) == 0) return; #ifdef LOADER_GELI_SUPPORT @@ -572,9 +582,9 @@ probe_drive(struct dsk *dsk) elba--; } if (geli_taste(vdev_read, dsk, elba) == 0) { - if (geli_havekey(dsk) == 0 || geli_passphrase(&gelipw, dsk->unit, + if (geli_havekey(dsk) == 0 || geli_passphrase(gelipw, dsk->unit, ':', 0, dsk) == 0) { - if (vdev_probe(vdev_read, dsk, NULL) == 0) { + if (vdev_probe(vdev_read2, dsk, NULL) == 0) { return; } } @@ -621,7 +631,7 @@ probe_drive(struct dsk *dsk) dsk->size = ent->ent_lba_end - ent->ent_lba_start + 1; dsk->slice = part + 1; dsk->part = 255; - if (vdev_probe(vdev_read, dsk, NULL) == 0) { + if (vdev_probe(vdev_read2, dsk, NULL) == 0) { /* * This slice had a vdev. We need a new dsk * structure now since the vdev now owns this one. @@ -631,12 +641,12 @@ probe_drive(struct dsk *dsk) #ifdef LOADER_GELI_SUPPORT else if (geli_taste(vdev_read, dsk, ent->ent_lba_end - ent->ent_lba_start) == 0) { - if (geli_havekey(dsk) == 0 || geli_passphrase(&gelipw, + if (geli_havekey(dsk) == 0 || geli_passphrase(gelipw, dsk->unit, 'p', dsk->slice, dsk) == 0) { /* * This slice has GELI, check it for ZFS. */ - if (vdev_probe(vdev_read, dsk, NULL) == 0) { + if (vdev_probe(vdev_read2, dsk, NULL) == 0) { /* * This slice had a vdev. We need a new dsk * structure now since the vdev now owns this one. @@ -665,18 +675,18 @@ trymbr: dsk->start = dp[i].dp_start; dsk->size = dp[i].dp_size; dsk->slice = i + 1; - if (vdev_probe(vdev_read, dsk, NULL) == 0) { + if (vdev_probe(vdev_read2, dsk, NULL) == 0) { dsk = copy_dsk(dsk); } #ifdef LOADER_GELI_SUPPORT else if (geli_taste(vdev_read, dsk, dp[i].dp_size - dp[i].dp_start) == 0) { - if (geli_havekey(dsk) == 0 || geli_passphrase(&gelipw, dsk->unit, + if (geli_havekey(dsk) == 0 || geli_passphrase(gelipw, dsk->unit, 's', i, dsk) == 0) { /* * This slice has GELI, check it for ZFS. */ - if (vdev_probe(vdev_read, dsk, NULL) == 0) { + if (vdev_probe(vdev_read2, dsk, NULL) == 0) { /* * This slice had a vdev. We need a new dsk * structure now since the vdev now owns this one. Modified: head/stand/libsa/Makefile ============================================================================== --- head/stand/libsa/Makefile Sat Dec 2 00:07:31 2017 (r326447) +++ head/stand/libsa/Makefile Sat Dec 2 00:07:37 2017 (r326448) @@ -17,7 +17,6 @@ LIBC_SRC= ${SRCTOP}/lib/libc LIB?= sa NO_PIC= -WARNS?= 0 # standalone components and stuff we have modified locally SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c environment.c getopt.c gets.c \ Modified: head/stand/zfs/zfsimpl.c ============================================================================== --- head/stand/zfs/zfsimpl.c Sat Dec 2 00:07:31 2017 (r326447) +++ head/stand/zfs/zfsimpl.c Sat Dec 2 00:07:37 2017 (r326448) @@ -43,6 +43,7 @@ struct zfsmount { objset_phys_t objset; uint64_t rootobj; }; +static struct zfsmount zfsmount; /* * List of all vdevs, chained through v_alllink. @@ -913,7 +914,7 @@ spa_all_status(void) return (ret); } -uint64_t +static uint64_t vdev_label_offset(uint64_t psize, int l, uint64_t offset) { uint64_t label_offset; Modified: head/sys/cddl/boot/zfs/zfssubr.c ============================================================================== --- head/sys/cddl/boot/zfs/zfssubr.c Sat Dec 2 00:07:31 2017 (r326447) +++ head/sys/cddl/boot/zfs/zfssubr.c Sat Dec 2 00:07:37 2017 (r326448) @@ -250,7 +250,7 @@ zio_checksum_template_init(enum zio_checksum checksum, * all of the checksum context templates and deallocates any that were * initialized using the algorithm-specific template init function. */ -void +static void zio_checksum_templates_free(spa_t *spa) { for (enum zio_checksum checksum = 0;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712020007.vB207bVF034051>